newton.eval_inverse_dynamics_passive#
- newton.eval_inverse_dynamics_passive(model, state, *, mass_matrix=None, gravity_force=None, coriolis_force=None, mask=None)[source]#
Compute passive inverse-dynamics quantities for articulated systems.
Each non-
Noneoutput is computed independently. Omitted outputs are not computed. Callers allocate the requested output arrays:mass_matrix← the joint-space mass matrixM(q)[kg, kg·m, or kg·m^2, depending on the joint types of the row/column DOFs];gravity_force← the gravity forceg(q) = ∂U/∂q[N or N·m, depending on joint type], whereU(q)is the system’s gravitational potential energysum_i -m_i * g . x_com_i. This is the joint-space force that holds the articulation static under gravity;coriolis_force← the Coriolis + centrifugal forceC(q, q_dot)*q_dot[N or N·m, depending on joint type].
All three quantities follow the standard manipulator-equation convention
tau = M(q)*joint_qdd + C(q,q_dot)*q_dot + g(q).Requires
state.body_qto be consistent withstate.joint_q; callers must invokeeval_fk()(or otherwise updatestate.body_q) before this function.Note
Inverse dynamics considers only the kinematic tree. As a consequence, loop-closure joints (
EqType.CONNECT,EqType.WELD,EqType.JOINT) play no role in the inverse dynamics evaluation.CABLEjoints are not supported because they do not define generalized coordinates or a motion subspace for this inverse-dynamics formulation.Experimental
Experimental feature. API, behavior, defaults, and supported use cases may change without prior notice.
- Parameters:
model (Model) – Model providing articulation topology and inertial parameters.
state (State) – State providing the current generalized coordinates and velocities.
state.body_qmust already reflectstate.joint_q.mass_matrix (wp.array3d[wp.float32] | None) – Optional output for the joint-space mass matrix, shape
(model.articulation_count, model.max_dofs_per_articulation, model.max_dofs_per_articulation), dtype float. The padded rows and columns beyond each articulation’s DOF count are zero.gravity_force (wp.array[wp.float32] | None) – Optional output for
g(q) = ∂U/∂q[N or N·m, depending on joint type], shape(model.joint_dof_count,), dtype float.coriolis_force (wp.array[wp.float32] | None) – Optional output for
C(q, q_dot)*q_dot[N or N·m, depending on joint type], shape(model.joint_dof_count,), dtype float.mask (wp.array[bool] | None) – Optional
wp.array[bool]of shape(articulation_count,)selecting which articulations to compute. Entries belonging to unselected articulations are zero in the output buffers (mirroringeval_mass_matrix()’s mask convention). IfNone, all articulations are computed.
- Raises:
ValueError – If the model contains a
CABLEjoint, no outputs are requested, or an output or mask has an unexpected shape.