Skip to content

mujoco: Implement joint velocity commands#1004

Draft
azeey wants to merge 1 commit into
gazebosim:mainfrom
azeey:joint_velocity_cmd
Draft

mujoco: Implement joint velocity commands#1004
azeey wants to merge 1 commit into
gazebosim:mainfrom
azeey:joint_velocity_cmd

Conversation

@azeey

@azeey azeey commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🎉 New feature

Toward #299

Summary

This PR implements joint velocity commands for the MuJoCo physics engine via native velocity actuators (mjBIAS_AFFINE).

To make velocity tracking configuration-independent and uniform, we dynamically compute the servo gain at each step as $k_v = J / \tau_s$, where $J$ is the un-factored joint inertia from d->qM[m->dof_Madr[dofIndex]] and $\tau_s = 0.05 \cdot \text{timestep}$ (5% of the timestep). This implements a proportional velocity controller using MuJoCo's native velocity actuators (mjBIAS_AFFINE).

Additionally, instead of using joint-level effort limits (actfrcrange), which are solved as soft constraints in MuJoCo and introduce compliance and phase lag, we set force limits directly on the actuator (forcerange) using the SDF effort limits. This enforces limits as a hard input saturation clip, which prevents solver compliance and keeps the control loop stable.

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)

Test it

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • Added tests
  • Added example and/or tutorial
  • 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.

…or MuJoCo

* Support joint velocity commands via native velocity actuators (mjBIAS_AFFINE).
* Compute configuration-independent gains based on the joint's locked inertia.
* Enforce joint effort limits on the actuator force range instead of the joint axis to prevent solver compliance and control loop oscillations.

Generated-by: Gemini 3.5 Flash
Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
@azeey azeey changed the title mujoco: Implement joint velocity commands and effort limit handling f… mujoco: Implement joint velocity commands Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant