Skip to content

refactor(hero_agent): TDC cleanup, physics tuning, test rewrite - #1

Merged
luckkim123 merged 2 commits into
mainfrom
refactor/tdc-cleanup-and-physics-tuning
May 25, 2026
Merged

luckkim123 merged 2 commits into
mainfrom
refactor/tdc-cleanup-and-physics-tuning

Conversation

@luckkim123

@luckkim123 luckkim123 commented Feb 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • TDC controller cleanup: Remove dead self._cfg attribute, merge duplicated Lambda computation into single _compute_lambda_and_inv with pre-allocated scratch buffers, add F_bu property, name magic constant _EPSILON_DET, eliminate redundant tdc_dt calculation in env
  • Physics parameter tuning: Disable C_RB double-counting (use_full_coriolis=False), lower added mass stability factor, reduce actuator Kp/Kd for softer arm motion, add explicit M_A*v_dot update, set control_decimation=4 for 50Hz TDC matching C++ reference
  • Test rewrite: Full rewrite of test_tdc_controller.py — updated for TDCControllerCfg constructor, fixed Lambda sign expectations, fixed IK round-trip test, removed stale TestUDEMode, added TestUpdateParams, improved mock infrastructure (19/19 tests pass)

Test plan

  • python3 -m pytest source/isaaclab_tasks/test/test_tdc_controller.py -v (19/19 pass)
  • ruff check on all modified files (all checks passed)
  • ruff format on all modified files (formatted)
  • Run TDC env with Isaac Sim: ./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-HeroAgent-TDC-v0 --num_envs 16 --headless --max_iterations 1

Summary by CodeRabbit

  • New Features

    • Added comprehensive system architecture documentation and TDC controller tuning reference guide.
    • Introduced consolidated TDC environment with deterministic control flow using improved inverse kinematics.
  • Bug Fixes

    • Improved numerical stability with Damped Least Squares kinematics and updated hydrodynamic parameters.
  • Documentation

    • New architecture reference and TDC literature survey documents.
  • Refactor

    • Simplified TDC controller with modular state management and cleaner configuration structure.
    • Consolidated reward functions and environment variants for reduced code duplication.
  • Tests

    • Added comprehensive unit test suite for TDC controller functionality.

luckkim123 and others added 2 commits February 9, 2026 07:27
…ler and fix 8 bugs

Rewrite HeroAgentTDCEnv from RL-integrated gain tuner to standalone classical
TDC controller for baseline comparison. Simplify TDC controller, env config,
reward system, and agent configs. Add ALBC kinematics module and unit tests.

TDC environment changes:
- Replace RL gain output (4D) with direct TDC control (no RL actions)
- TDC runs at 100Hz (control_decimation=1) for accurate TDE
- Remove TDC-specific reward terms and encoder variant
- Add console logging for real-time TDC diagnostics

Bug fixes from systematic 5-round code review:
- Fix buoyancy force sign convention (repulsive, not attractive)
- Fix gravity vector initialization (use PhysX gravity, not hardcoded)
- Fix CoB/CoG offset handling in restoring torque computation
- Fix inertia tensor access for added mass terms
- Fix potential reward to use roll/pitch only (exclude yaw)
- Fix observation stale _prev_actions_obs after reset
- Fix _attitude_error caching for correct logging after reset
- Fix TDC buoyancy update to only affect reset environments

Other changes:
- Add ALBCKinematics class (2-link planar FK/IK/Jacobian)
- Add test_tdc_controller.py unit tests
- Simplify HeroAgentEnvCfg (remove TDC-specific reward configs)
- Clean up agent configs and environment registrations
- Remove unused tdc_sweep.py script and actor_critic_encoder_tdc.py

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…tests

TDC controller cleanup:
- Remove unused self._cfg attribute from TDCController
- Add F_bu read-only property (replaces private attribute access)
- Merge _compute_lambda + _compute_lambda_inv into _compute_lambda_and_inv
- Pre-allocate Lambda scratch buffers to avoid per-step allocation
- Name magic constant _EPSILON_DET in kinematics.py
- Store tdc_dt as self._tdc_dt in tdc_env (eliminates redundant calculation)
- Export TDCControllerCfg from controllers/__init__.py and hero_agent/__init__.py

Physics tuning:
- Disable C_RB (use_full_coriolis=False) to avoid double-counting with PhysX gyroscopic forces
- Lower added_mass_stability_factor (0.8->0.5/0.4) for numerical stability
- Reduce actuator stiffness/damping (Kp=500->100, Kd=10->3) for softer arm motion
- Add explicit added mass force (M_A * v_dot) update in _apply_actions
- Set control_decimation=4 for 50Hz TDC matching C++ reference

Test rewrite:
- Rewrite test_tdc_controller.py for TDCControllerCfg-based constructor
- Fix Lambda sign expectations to match corrected physics
- Fix IK round-trip test (add current_joint_angles, use small perturbation)
- Remove TestUDEMode (UDE mode no longer exists)
- Add TestUpdateParams (update_controller_params, update_buoyancy_force, F_bu property)
- Improve mock infrastructure for standalone testing without Isaac Sim

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai

coderabbitai Bot commented Feb 10, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR refactors the Hero Agent ALBC system by removing the TDC gain sweep utility, consolidating TDC-encoder training variants into a single unified TDC environment, replacing analytical arm kinematics with a DLS-based Jacobian approach, and redesigning the TDC controller with clearer state management. Configuration updates to hydrodynamics and environment timing support the overhaul.

Changes

Cohort / File(s) Summary
Script & Utility Removal
scripts/hero_agent/tdc_sweep.py
Entire 420-line TDC gain sweep utility removed, including CLI, gain-to-action conversion, episode runner, logging setup, and parameterized sweep orchestration.
Hydrodynamics & Robot Configuration
source/isaaclab_assets/isaaclab_assets/robots/uuv/hero_agent/hero_agent.py, source/isaaclab_assets/isaaclab_assets/robots/uuv/uuv_cfg.py
Added body_mass field to hydrodynamics configs; disabled full Coriolis (True→False); adjusted added_mass_stability_factor (0.8→0.5/0.4); reduced solver iteration counts (16→8, 8→4); added optional body_mass to base HydrodynamicsCfg with CoG correction support.
Arm Kinematics Redesign
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/controllers/kinematics.py
Replaced analytical 2-link elbow-up IK with DLS Jacobian pseudo-inverse; added forward kinematics; updated init signature with link length defaults; modified inverse() signature to accept target_position and current_joint_angles; introduced adaptive damping for singularity handling.
TDC Controller Architecture
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/controllers/tdc.py
Complete rewrite: reorganized init signature (parameter order/defaults), added public methods (update_buoyancy_force, update_ee_position, update_controller_params), introduced modular internal helpers (_estimate_angular_acceleration, _compute_pd_torque, _compute_tde_torque, etc.), replaced old compute flow with per-env state buffers and TDE saturation.
Encoder-TDC Variant Removal
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/encoder/actor_critic_encoder_tdc.py, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/agents/rsl_rl_ppo_cfg.py, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/encoder/encoder_runner.py
Deleted ActorCriticEncoderTDC class; removed TDC-based PPO runner configs (RslRlPpoActorCriticEncoderTDCCfg, HeroAgentBaseTDCPPORunnerCfg, HeroAgentEncoderTDCPPORunnerCfg); removed TDC integration logic from EncoderRunner; simplified from 3 runners to 2 standard PPO variants.
Public API Consolidation
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/__init__.py, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/agents/__init__.py, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/controllers/__init__.py
Renamed Isaac-HeroAgent-Encoder-TDC-v0 to Isaac-HeroAgent-TDC-v0; unified HeroAgentEncoderTDCEnvCfg and HeroAgentBaseTDCEnvCfg into HeroAgentTDCEnvCfg; replaced TDCRewardCfg with TDCControllerCfg; updated all exports; re-exported TDCControllerCfg from hero_agent_env_cfg.
Environment Configuration
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/hero_agent_env_cfg.py
Added new TDCControllerCfg with PD gains, inertia, geometry, and damping parameters; introduced HeroAgentTDCEnvCfg; added disable_all() method to DomainRandomizationCfg; updated HeroAgentEnvCfg decimation (1→2), dt (0.01→0.005), control_decimation (1→4); added albc_joint_stiffness/damping fields; removed encoder-TDC environment variants; added HERO_AGENT_ALBC_LINK\* length imports.
Environment Control Flow
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/hero_agent_env.py
Replaced quat_apply with quat_apply_inverse; added public compute_attitude_error method; switched reward term albc_action_cost→squared_action_cost; updated payload weight transformation to body frame; added update_physx_state calls for added-mass hydrodynamics; integrated joint stiffness/damping writes during reset; adjusted control cadence to step_dt; refined attitude error caching for logging.
TDC-Specific Environment
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/hero_agent_tdc_env.py
Simplified TDC-only environment: replaced RL-based gain inputs with TDC controller computing desired EE position; integrated IK-based joint target generation with rate limiting; removed reward manager and MDP components; added _setup_logger(), _log_control_state(), _log_reset_info() for diagnostics; removed encoder-z integration; updated reset to handle per-env TDC state and buoyancy.
Rewards & MDP Consolidation
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/mdp/rewards.py, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/mdp/__init__.py
Removed TDC-specific reward classes (TDCRewardCfg, BaseTDCRewardCfg) and functions (tdc_attitude_penalty, tdc_stability_reward, tdc_gain_smoothness_reward, tdc_gain_magnitude_cost, albc_action_cost); consolidated into single squared_action_cost function; retained ALBCRewardCfg with simplified docstrings.
Hydrodynamics Integration
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/mdp/events.py, source/isaaclab_tasks/isaaclab_tasks/models/hydrodynamics.py
Extended set_ocean_current to propagate current to buoy hydro; added CoG-based gravity restoring correction in hydrodynamics with _r_cg_nominal tracking and conditional M_corr torque application when body_mass defined.
Documentation & Testing
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/ARCHITECTURE.md, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/TDC_LITERATURE_SURVEY.md, source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/tdc-tuning-history-2026-02-09.md, source/isaaclab_tasks/test/test_tdc_controller.py
Added comprehensive ARCHITECTURE.md documenting system overview, simulation loop, physical parameters, kinematics, observations, and controller integration; added TDC_LITERATURE_SURVEY.md covering theory and applications; added tuning-history document with 9 attempt iterations and final configuration; added 480-line test suite covering Lambda computation, restoring torque, control loops, resets, and parameter updates.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A sweep is gone, a controller reborn,
With DLS and Jacobians to weather the storm,
TDC variants merged in unified light,
Kinematics and dynamics now working just right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(hero_agent): TDC cleanup, physics tuning, test rewrite' accurately summarizes the main changes: removing dead code and cleanup in the TDC controller, tuning physics parameters, and rewriting tests.
Docstring Coverage ✅ Passed Docstring coverage is 93.51% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/tdc-cleanup-and-physics-tuning

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In
`@source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/TDC_LITERATURE_SURVEY.md`:
- Around line 31-33: Add language identifiers to every fenced code block in
TDC_LITERATURE_SURVEY.md that contains equations or plain text (use "math" or
"text"), e.g., change the fence wrapping the equation "M(q)q_ddot + C(q,
q_dot)q_dot + g(q) + f(q_dot) + d(t) = tau" to ```math (or ```text) and do the
same for the other untyped fences that contain equations or math expressions in
the file (the blocks referenced in the review), ensuring each opening
triple-backtick includes the chosen language token.
- Around line 160-167: The table under "### Error Characteristics" has a
misaligned separator row and uses emphasis markers with spaces; update the pipe
count in the separator line so it matches the two columns (e.g.,
"|:-------|:--------------------|") and remove any spaces inside emphasis
markers (change "* text *" or "_ text _" to "*text*" or "_text_") where present
in that section; ensure the table header, separator and rows all have the same
number of columns and no spaced emphasis tokens so the file renders cleanly.

In
`@source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/tdc-tuning-history-2026-02-09.md`:
- Around line 43-79: Fix spelling typos in the Attempt history blocks: open the
sections headed "Attempt 1: H_hat EMA Filter (alpha=0.05)", "Attempt 2: T_b
Separation (U_hat Only Filtered)", "Attempt 3: Filter Off (alpha=1.0) + 100Hz",
and "Attempt 4: 200Hz + Aggressive PD" and correct misspelled result words
(e.g., change any truncated “stagnatio…” to “stagnation” and ensure
“divergence”/“발산” is consistently and correctly spelled), keep language
consistent across Result lines, and re-run a quick spellcheck to catch any
remaining typos.

In `@source/isaaclab_tasks/test/test_tdc_controller.py`:
- Around line 218-224: In test_lambda_structure_zero_angles, replace the unused
assigned variable Lambda_inv from the call to
controller._compute_lambda_and_inv(roll, pitch) with an underscore (e.g.,
"Lambda, _ = controller._compute_lambda_and_inv(roll, pitch)") so the test still
receives both return values but does not assign the unused one, satisfying the
RUF059 linter rule; update only the assignment in the test function
test_lambda_structure_zero_angles.
🧹 Nitpick comments (3)
source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/mdp/events.py (1)

237-239: Implementation looks correct; consider encapsulating access to _current_velocity.

The logic correctly propagates the randomized current from the main body to the buoy, ensuring physical consistency. However, directly accessing the private _current_velocity attribute creates tight coupling to HydrodynamicsModel internals.

Consider adding a public property or getter method (e.g., current_velocity or get_current_velocity(env_ids)) to HydrodynamicsModel if this access pattern is used elsewhere or expected to grow.

source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/mdp/rewards.py (1)

125-125: Consider adding strict=True to zip() for defensive programming.

Both lists are populated from the same loop in __init__, so lengths are guaranteed to match. However, adding strict=True documents this invariant and would catch any future bugs if the initialization logic changes.

🔧 Proposed fix
-        for name, term_cfg in zip(self._term_names, self._term_cfgs):
+        for name, term_cfg in zip(self._term_names, self._term_cfgs, strict=True):
source/isaaclab_tasks/test/test_tdc_controller.py (1)

34-40: Rename unused kwargs to _kwargs to silence the ARG002 lint warning.

The _MockModule.__call__ method accepts **kwargs but doesn't use them. Use the underscore prefix convention to indicate the parameter is intentionally unused.

Suggested fix
-    def __call__(self, *args, **kwargs):
+    def __call__(self, *args, **_kwargs):

Comment on lines +31 to +33
```
M(q)q_ddot + C(q, q_dot)q_dot + g(q) + f(q_dot) + d(t) = tau
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifiers to fenced code blocks (MD040).
Several code fences are untyped; markdownlint flags this. Please add a language (e.g., text, math) to each fence.

Suggested pattern
-```
+```text
 M(q)q_ddot + C(q, q_dot)q_dot + g(q) + f(q_dot) + d(t) = tau

</details>


Also applies to: 47-49, 70-73, 100-112, 152-154, 194-196, 278-290

<details>
<summary>🤖 Prompt for AI Agents</summary>

In
@source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/TDC_LITERATURE_SURVEY.md
around lines 31 - 33, Add language identifiers to every fenced code block in
TDC_LITERATURE_SURVEY.md that contains equations or plain text (use "math" or
"text"), e.g., change the fence wrapping the equation "M(q)q_ddot + C(q,
q_dot)q_dot + g(q) + f(q_dot) + d(t) = tau" to math (or text) and do the
same for the other untyped fences that contain equations or math expressions in
the file (the blocks referenced in the review), ensuring each opening
triple-backtick includes the chosen language token.


</details>

<!-- fingerprinting:phantom:poseidon:eagle -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +160 to +167
### Error Characteristics

| Factor | Effect on TDE Error |
|:-------|:--------------------|
| Smaller L (sampling period) | Smaller error |
| Faster-changing dynamics | Larger error |
| Higher accelerations | Larger error (N depends on q_ddot) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix markdownlint issues in the “Error Characteristics” table/emphasis (MD056/MD037).
The table alignment row has extra columns and markdownlint also reports spaces inside emphasis markers in this section. Please align the column count and remove spaces inside emphasis markers.

Example table fix
-|:-------|:-----|:-----|
+|:-------|:--------------------|
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 160-160: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)


[warning] 160-160: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)


[warning] 160-160: Table column count
Expected: 3; Actual: 5; Too many cells, extra data will be missing

(MD056, table-column-count)


[warning] 163-163: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)


[warning] 163-163: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

🤖 Prompt for AI Agents
In
`@source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/TDC_LITERATURE_SURVEY.md`
around lines 160 - 167, The table under "### Error Characteristics" has a
misaligned separator row and uses emphasis markers with spaces; update the pipe
count in the separator line so it matches the two columns (e.g.,
"|:-------|:--------------------|") and remove any spaces inside emphasis
markers (change "* text *" or "_ text _" to "*text*" or "_text_") where present
in that section; ensure the table header, separator and rows all have the same
number of columns and no spaced emphasis tokens so the file renders cleanly.

Comment on lines +43 to +79
### Attempt 1: H_hat EMA Filter (alpha=0.05)

**Config**: h_hat_filter_alpha=0.05, 100Hz, Kp=10, Kd=5

**Result**: 50도 stagnation (수렴 실패)

**Root cause**: H_hat 필터에 T_b가 포함되어 있어, delta_T_b = T_b_prev - T_b 취소가 bias를 가짐. 필터가 T_b_prev의 오래된 값을 유지하므로 정적 오프셋 발생.

---

### Attempt 2: T_b Separation (U_hat Only Filtered)

**Config**: U_hat만 필터링, T_b는 delta_T_b로 직접 취소

**Result**: 동일한 50도 stagnation

**Root cause**: 필터가 순수 uncertainty에도 여전히 bias를 유발. 근본적으로 필터 접근 자체가 문제.

---

### Attempt 3: Filter Off (alpha=1.0) + 100Hz

**Config**: h_hat_filter_alpha=1.0 (필터 비활성화), 100Hz

**Result**: 발산 (M*nu_dot ~ 29 Nm)

**Root cause**: 100Hz에서 nu_dot finite difference가 매우 noisy. 필터 없이는 noise가 TDE를 통해 증폭.

---

### Attempt 4: 200Hz + Aggressive PD

**Config**: decimation=1 (200Hz), Kp=40, Kd=12, alpha=1.0

**Result**: 발산 (M*nu_dot ~ 39 Nm, pEE_raw_r > 1.0)

**Root cause**: 200Hz로 올려도 nu_dot가 여전히 크고, TDE가 PD의 25배 크기. Workspace saturation → TDE positive feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix a couple of spelling typos in the Attempt history section.
LanguageTool flagged possible misspellings around the Attempt 1/4 results (e.g., “stagnatio…”). Please verify and correct if present.

🧰 Tools
🪛 LanguageTool

[grammar] ~45-~45: Ensure spelling is correct
Context: ...) Config: h_hat_filter_alpha=0.05, 100Hz, Kp=10, Kd=5 Result: 50도 stagnatio...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~73-~73: Ensure spelling is correct
Context: ...noise가 TDE를 통해 증폭. --- ### Attempt 4: 200Hz + Aggressive PD Config: decimation...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
In
`@source/isaaclab_tasks/isaaclab_tasks/direct/hero_agent/docs/tdc-tuning-history-2026-02-09.md`
around lines 43 - 79, Fix spelling typos in the Attempt history blocks: open the
sections headed "Attempt 1: H_hat EMA Filter (alpha=0.05)", "Attempt 2: T_b
Separation (U_hat Only Filtered)", "Attempt 3: Filter Off (alpha=1.0) + 100Hz",
and "Attempt 4: 200Hz + Aggressive PD" and correct misspelled result words
(e.g., change any truncated “stagnatio…” to “stagnation” and ensure
“divergence”/“발산” is consistently and correctly spelled), keep language
consistent across Result lines, and re-run a quick spellcheck to catch any
remaining typos.

Comment on lines +218 to +224
def test_lambda_structure_zero_angles(self, controller):
"""Lambda at zero roll/pitch: lf = F_bu, anti-diagonal [[0,lf],[-lf,0]]."""
roll = torch.zeros(NUM_ENVS)
pitch = torch.zeros(NUM_ENVS)

Lambda, Lambda_inv = controller._compute_lambda_and_inv(roll, pitch)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, verify the file exists and read the relevant section
if [ -f "source/isaaclab_tasks/test/test_tdc_controller.py" ]; then
    echo "=== File exists. Reading lines 215-230 for context ==="
    sed -n '215,230p' source/isaaclab_tasks/test/test_tdc_controller.py | cat -n
else
    echo "File not found"
    find . -name "test_tdc_controller.py" -type f 2>/dev/null | head -5
fi

Repository: luckkim123/IsaacLab

Length of output: 986


🏁 Script executed:

#!/bin/bash
# Check RUF059 violations in the file
ruff check source/isaaclab_tasks/test/test_tdc_controller.py --select RUF059 2>&1

Repository: luckkim123/IsaacLab

Length of output: 758


🏁 Script executed:

#!/bin/bash
# Search for any usage of Lambda_inv in the entire test function scope around line 218-224
# Get broader context to ensure Lambda_inv is not used elsewhere in that test
sed -n '215,250p' source/isaaclab_tasks/test/test_tdc_controller.py | cat -n

Repository: luckkim123/IsaacLab

Length of output: 1910


Replace unused Lambda_inv variable with _ to satisfy RUF059.

The variable is assigned but never used in this test; replace with underscore to keep the test intent while satisfying the linter.

-        Lambda, Lambda_inv = controller._compute_lambda_and_inv(roll, pitch)
+        Lambda, _ = controller._compute_lambda_and_inv(roll, pitch)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_lambda_structure_zero_angles(self, controller):
"""Lambda at zero roll/pitch: lf = F_bu, anti-diagonal [[0,lf],[-lf,0]]."""
roll = torch.zeros(NUM_ENVS)
pitch = torch.zeros(NUM_ENVS)
Lambda, Lambda_inv = controller._compute_lambda_and_inv(roll, pitch)
def test_lambda_structure_zero_angles(self, controller):
"""Lambda at zero roll/pitch: lf = F_bu, anti-diagonal [[0,lf],[-lf,0]]."""
roll = torch.zeros(NUM_ENVS)
pitch = torch.zeros(NUM_ENVS)
Lambda, _ = controller._compute_lambda_and_inv(roll, pitch)
🧰 Tools
🪛 Ruff (0.14.14)

[warning] 223-223: Unpacked variable Lambda_inv is never used

Prefix it with an underscore or any other dummy variable pattern

(RUF059)

🤖 Prompt for AI Agents
In `@source/isaaclab_tasks/test/test_tdc_controller.py` around lines 218 - 224, In
test_lambda_structure_zero_angles, replace the unused assigned variable
Lambda_inv from the call to controller._compute_lambda_and_inv(roll, pitch) with
an underscore (e.g., "Lambda, _ = controller._compute_lambda_and_inv(roll,
pitch)") so the test still receives both return values but does not assign the
unused one, satisfying the RUF059 linter rule; update only the assignment in the
test function test_lambda_structure_zero_angles.

luckkim123 added a commit that referenced this pull request May 24, 2026
Summary of key analyses:
- 24-run retrospective rank: r11_emabias #1, r12_baseline isaac-sim#7 (regression)
- Sample-mean divergence hypothesis rejected (baseline and intervention rates match)
- r12_baseline config lineage revealed: r11+latent16+k_bias=-1.0 (half strength)
- R13_A/B parallel launched with ocean DR DORAEMON integration

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@luckkim123
luckkim123 merged commit 1f87e4a into main May 25, 2026
@luckkim123
luckkim123 deleted the refactor/tdc-cleanup-and-physics-tuning branch July 12, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant