Learning outcomes
- Derive computed-torque control under explicit assumptions.
- Distinguish bias compensation from full inverse dynamics.
- Diagnose force accounting with MuJoCo.
Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.
Compensation as a model-based feedforward term
Consider a fully actuated robot without contact:
At zero velocity, c is the gravity bias for a conventional mechanical model. With nonzero velocity, it is generally not just gravity. If damping is already a passive force in the simulator, include it explicitly in any exact cancellation argument.
Computed torque
For hinge coordinates with
Underactuated robots cannot realize an arbitrary generalized force. With
Worked pendulum
For
If the true inertia is twice the model inertia, the cancellation is imperfect. Run the model-mismatch experiment before presenting exact-model behavior as robustness.
MuJoCo force queries
After mj_forward, retrieve c from qfrc_bias and the passive force from qfrc_passive. Use mj_fullM to materialize the dense mass matrix when needed for these small examples.
mj_inverse answers a related query after qacc is set. With constraints and passive forces present, interpreting its result requires the documented decomposition. It is not automatically an actuator command.
Exercise and practice
Practice 2 compares PD, bias-compensated PD, and computed torque on the same two-link arm. Plot error and saturation, then reduce the motor limit.
Check: Why can adding exact gravity compensation worsen an experiment? Possible causes include a wrong sign, wrong frame, double-counted compensation, stale bias data, or actuator saturation. Compensation also consumes some of the available motor force. Diagnose these before changing the feedback gains.