mujoco: Implement joint velocity commands#1004
Draft
azeey wants to merge 1 commit into
Draft
Conversation
…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>
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.
🎉 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 $\tau_s = 0.05 \cdot \text{timestep}$ (5% of the timestep). This implements a proportional velocity controller using MuJoCo's native velocity actuators (
d->qM[m->dof_Madr[dofIndex]]andmjBIAS_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
Test it
Checklist
codecheckpassed (See contributing)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-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.