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-None output is computed independently. Omitted outputs are not computed. Callers allocate the requested output arrays:

  • mass_matrix ← the joint-space mass matrix M(q) [kg, kg·m, or kg·m^2, depending on the joint types of the row/column DOFs];

  • gravity_force ← the gravity force g(q) = ∂U/∂q [N or N·m, depending on joint type], where U(q) is the system’s gravitational potential energy sum_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 force C(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_q to be consistent with state.joint_q; callers must invoke eval_fk() (or otherwise update state.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.

CABLE joints 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_q must already reflect state.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 (mirroring eval_mass_matrix()’s mask convention). If None, all articulations are computed.

Raises:

ValueError – If the model contains a CABLE joint, no outputs are requested, or an output or mask has an unexpected shape.