Skip to content

Keep impedance control active across a world reset - #14

Merged
lgulich merged 3 commits into
impedence-control-supportfrom
lgulich/reset-keeps-impedance
Nov 23, 2026
Merged

lgulich merged 3 commits into
impedence-control-supportfrom
lgulich/reset-keeps-impedance

Conversation

@lgulich

@lgulich lgulich commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A world reset disabled impedance control on every actuator and fell back to the default mode: position PID when pid_gains are set, otherwise effort. A controller that still claims kp/kd doesn'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 clears last_requested_parameters so the next write() programs the gains again.

Found with the Franka FR3 cuMotion IK MuJoCo test in Isaac ROS. The test calls reset_world after 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

  • PositionImpedanceHonorsAuthoredRangesAndRestoresAuthoredGains asserted 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 after reset_world without a new mode switch. Restoring the authored gains when a controller stops claiming the interfaces, and on deactivation, is still covered.
  • Locally, in the CI Docker image (docker/Dockerfile, Lyrical), mujoco_ros2_control passes all 193 tests. Without the fix, the updated test fails, getting gain 3 instead of 20.
  • Downstream, the Isaac ROS FR3 IK, reach, freeze-controller, and joint-position MuJoCo launch tests each pass with this change.

CI

  • .pre-commit-config.yaml now pins pyupgrade v3.22.0, matching upstream. v3.17.0 crashes on Python 3.14, which the format workflow now gets by default, with TypeError: cannot use a bytes pattern on a string-like object. pre-commit run --all-files passes on Python 3.14 with the new pin.
  • build_and_test (rolling) fails on the base branch too. Rolling removed the raw-pointer StateInterface/CommandInterface constructors, 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

lgulich and others added 2 commits November 20, 2026 17:44
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)

@kajananchinniahNV kajananchinniahNV Nov 23, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This seems like a huge test addition for a very small change - would pre-existing tests cover this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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>
@lgulich
lgulich merged commit 209d44a into impedence-control-support Nov 23, 2026
7 of 8 checks passed
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.

2 participants