Skip to content

mujoco: Fix joint limits parsing in MuJoCo plugin#1003

Merged
azeey merged 2 commits into
gazebosim:mainfrom
azeey:mujoco_joint_limits
Jun 11, 2026
Merged

mujoco: Fix joint limits parsing in MuJoCo plugin#1003
azeey merged 2 commits into
gazebosim:mainfrom
azeey:mujoco_joint_limits

Conversation

@azeey

@azeey azeey commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🦟 Bug fix

Summary

Before this PR, joint limits specified in SDFormat (which are in radians) were interpreted by MuJoCo's compiler as degrees. This happened because the default compiler.degree option in MuJoCo's spec is true. As a result, limits like [-0.5, 0.5] radians were compiled to [-0.0087, 0.0087] radians.

This PR sets worldInfo->mjSpecObj->compiler.degree = false; so that MuJoCo compiles all angles and limits directly as radians.

The existing CheckMujocoData test case in SDFFeatures_TEST.cc has been updated to assert that the compiled jnt_range for joint_limit_test correctly holds [-0.5, 0.5] instead of the incorrect degree-converted values.

Backport Policy

  • This is safe to backport to the following versions:
    • Jetty
    • Ionic
    • Harmonic
    • Fortress
  • This should not be backported
  • I am not sure
  • Other (fill in yourself)

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the fix (as needed)
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Gemini 3.5 Flash

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

Backports: If this is a backport, please use Rebase and Merge instead.

Set compiler.degree option to false to prevent MuJoCo from interpreting joint limits specified in radians as degrees.
Also added a test case asserting the compiled joint limits of joint_limit_test.

Generated-by: Gemini 3.5 Flash
Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
@github-project-automation github-project-automation Bot moved this from Inbox to In review in Core development Jun 11, 2026
@azeey
azeey enabled auto-merge (squash) June 11, 2026 17:51
@azeey
azeey merged commit 8a48173 into gazebosim:main Jun 11, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Core development Jun 11, 2026
@azeey
azeey deleted the mujoco_joint_limits branch June 11, 2026 22:08
shameekganguly pushed a commit that referenced this pull request Jun 26, 2026
Set compiler.degree option to false to prevent MuJoCo from interpreting joint limits specified in radians as degrees.
Also added a test case asserting the compiled joint limits of joint_limit_test.

Generated-by: Gemini 3.5 Flash

Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants