Repository navigation
Keep impedance control active across a world reset - #14
Merged
lgulich merged 3 commits intoNov 23, 2026
Merged
Conversation
A world reset disabled impedance mode on every actuator and fell back to the default position PID or effort mode. A controller that still claims the kp/kd interfaces never re-switches modes after a reset, so the commanded gains, feed-forward effort, and velocity were ignored for the rest of the session. Keep the impedance flags, which follow the claimed interfaces, and clear the cached actuator parameters so the next write reprograms the gains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pyupgrade v3.17.0 crashes on Python 3.14, the runner default, with "cannot use a bytes pattern on a string-like object" in tokenize. v3.22.0 matches upstream and passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| EXPECT_NEAR(observed_effort, expected_effort, 1e-9); | ||
| } | ||
|
|
||
| TEST_F(HeadlessInitTest, MotorImpedanceSurvivesWorldReset) |
There was a problem hiding this comment.
This seems like a huge test addition for a very small change - would pre-existing tests cover this?
Collaborator
Author
There was a problem hiding this comment.
Good point, removed it in e9c4709. The updated PositionImpedanceHonorsAuthoredRangesAndRestoresAuthoredGains test already covers the reset path: it no longer re-sends the mode switch after reset_world, and without the fix it fails, getting gain 3 instead of 20. In the Lyrical CI image, mujoco_ros2_control passes all 193 tests with the fix and has 2 failures without it. The PR is now +12/−15.
The updated position-impedance test already fails without the reset fix, so the extra motor-actuator test added no coverage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A world reset disabled impedance control on every actuator and fell back to the default mode: position PID when
pid_gainsare set, otherwise effort. A controller that still claimskp/kddoesn't switch modes again after a reset, so the plugin ignored its gains, feed-forward effort, and velocity for the rest of the session.reset_simulation_state()now keeps the impedance flags, which follow the claimed interfaces. It clearslast_requested_parametersso the nextwrite()programs the gains again.Found with the Franka FR3 cuMotion IK MuJoCo test in Isaac ROS. The test calls
reset_worldafter the controllers activate, and the arm then sagged about 5 cm against the P=600 fallback PID. Commanded kp and feed-forward effort had no effect.Tests
PositionImpedanceHonorsAuthoredRangesAndRestoresAuthoredGainsasserted the old behavior: the authored gains came back after a reset, and impedance needed an explicit mode switch to resume. It now expects the commanded gains to stay in effect afterreset_worldwithout a new mode switch. Restoring the authored gains when a controller stops claiming the interfaces, and on deactivation, is still covered.docker/Dockerfile, Lyrical),mujoco_ros2_controlpasses all 193 tests. Without the fix, the updated test fails, getting gain 3 instead of 20.CI
.pre-commit-config.yamlnow pinspyupgradev3.22.0, matching upstream. v3.17.0 crashes on Python 3.14, which the format workflow now gets by default, withTypeError: cannot use a bytes pattern on a string-like object.pre-commit run --all-filespasses on Python 3.14 with the new pin.build_and_test (rolling)fails on the base branch too. Rolling removed the raw-pointerStateInterface/CommandInterfaceconstructors, and upstream migrated in Migrate to the new Command/StateInterface API ros-controls/mujoco_ros2_control#296. That migration is out of scope here.🤖 Generated with Claude Code