Skip to content

Apply the mimic joint offset in GazeboSimSystem::write (backport #953) - #954

Merged
christophfroehlich merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-953
Aug 29, 2026
Merged

Apply the mimic joint offset in GazeboSimSystem::write (backport #953)#954
christophfroehlich merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-953

Conversation

@mergify

@mergify mergify Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #952.

URDF defines a mimic joint as follower = multiplier * driver + offset. MimicJoint::offset reaches the plugin and is printed at startup (gz_system.cpp:391), but the arithmetic that drives the follower never referenced it, so a URDF declaring an offset produced a follower tracking multiplier * driver with the offset silently dropped and no warning.

gazebo_ros2_control, the sibling plugin in this org, already applies the full form in gazebo_system.cpp (lines 511 and 795).

The existing mimic fixtures declare <mimic joint="..."/> with no multiplier or offset, so the default offset of zero made this invisible to the test suite. This adds an explicit multiplier and offset to the position gripper fixture and asserts the follower satisfies the URDF relationship once it settles. The follower is driven by a velocity proportional to its position error, so the assertion samples until the position stabilises rather than taking the first /joint_states message.

Verification

Built and run against Gazebo 8.11 on the jazzy branch, which carries the same code, using a gripper whose mimic joint declares offset="0.05":

before   driver 0.1500   follower 0.1500   expected 0.2000   error -0.0500
after    driver 0.1500   follower 0.2000   expected 0.2000   error  0.0000

The error before the change is exactly the dropped offset.

colcon test --packages-select gz_ros2_control_tests --ctest-args -R gripper_mimic_joint_position

passes with the change and fails without it, with the source change reverted and the test kept:

AssertionError: mimic offset not applied: follower 0.1500 != 1.0 * 0.15 + 0.05 = 0.2

gripper_mimic_joint_effort_test fails in my environment both with and without this change, on check_controllers_running, so it looks unrelated to this patch.

Credit

@omnilink-tech reported this in #952 with the analysis and the one-line patch, and noted they do not open PRs. The diff to gz_system.cpp is theirs; I verified it, added the fixture and test coverage, and am submitting it.


This is an automatic backport of pull request #953 done by [Mergify](https://mergify.com).

@mergify
mergify Bot requested a review from ahcorde as a code owner August 29, 2026 10:57
@christophfroehlich
christophfroehlich merged commit 2773580 into jazzy Aug 29, 2026
5 of 6 checks passed
@christophfroehlich
christophfroehlich deleted the mergify/bp/jazzy/pr-953 branch August 29, 2026 12:06
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