qfrc_bias to qfrc_applied. This allows joints to hold their position against gravity without active control.
Signature
Usage
Toggle via State
How It Works
Each physics frame (viauseBeforePhysicsStep):
qfrc_bias contains the passive forces (gravity, Coriolis, centrifugal) computed by MuJoCo. Adding these to qfrc_applied exactly cancels gravity, making the robot behave as if it’s weightless.
When to Use
- IK gizmo interaction: Prevents the arm from collapsing when you drag the end-effector
- Teleoperation: Lets the operator focus on desired motion without fighting gravity
- Testing: Isolate control issues from gravity effects
Notes
- Also available as a prop on
MujocoCanvas:<MujocoCanvas gravityCompensation /> - Composes correctly with other
useBeforePhysicsStephooks since the provider zerosqfrc_appliedfirst and all hooks add to it - This is different from
api.setGravity([0, 0, 0])which removes gravity for all bodies. Gravity compensation only affects actuated joints.