newton.Control#

class newton.Control[source]#

Bases: object

Time-varying control data for a Model.

Carries joint torques, control inputs, muscle activations, and tri/tet activation forces. Create via newton.Model.control().

Position and velocity targets live on joint_target_q and joint_target_qd. The shape of joint_target_q depends on newton.use_coord_layout_targets — coord-shaped when True, DOF-shaped otherwise. Legacy joint_target_pos / joint_target_vel aliases are available under False and raise under True.

__init__()#
clear(model=None)#

Reset all control inputs to zero.

joint_target_q is special: zeroing it under coord layout corrupts FREE/BALL/DISTANCE quaternion slots ((0,0,0,0) is not a valid rotation). Pass model to restore it from model.joint_target_q instead. Without model it falls back to the legacy zero-fill.

Parameters:

model (Model | None) – Optional source Model whose joint_target_q seeds this Control. Required for models with FREE/BALL/DISTANCE joints under coord layout.

joint_act: array | None#

Per-DOF feedforward actuation input, shape (joint_dof_count,), type float (optional).

This is an additive feedforward term used by actuators (e.g. ActuatorPD) in their control law before PD/PID correction is applied.

joint_f: array | None#

Array of generalized joint forces [N or N·m, depending on joint type] with shape (joint_dof_count,) and type float.

The degrees of freedom for FREE and DISTANCE joints are included in this array and have the same convention as the newton.State.body_f array where the 6D wrench is defined as (f_x, f_y, f_z, t_x, t_y, t_z), where f_x, f_y, and f_z are the components of the force vector (linear) [N] and t_x, t_y, and t_z are the components of the torque vector (angular) [N·m]. For FREE and DISTANCE joints, the wrench is applied in world frame with the child body’s center of mass (COM) as reference point.

property joint_target_pos: array | None#

Deprecated alias for joint_target_q (DOF-shape only). Raises AttributeError under newton.use_coord_layout_targets True.

Deprecated since version 1.3: Use joint_target_q instead.

joint_target_q: array | None#

Joint position targets [m or rad]. Shape is (joint_coord_count,) when newton.use_coord_layout_targets is True, otherwise (joint_dof_count,) for legacy compat with joint_target_pos.

joint_target_qd: array | None#

Joint velocity targets [m/s or rad/s], shape (joint_dof_count,). Matches joint_qd; replaces joint_target_vel.

property joint_target_vel: array | None#

Deprecated alias for joint_target_qd. Raises AttributeError under newton.use_coord_layout_targets True.

Deprecated since version 1.3: Use joint_target_qd instead.

muscle_activations: array | None#

Array of muscle activations [dimensionless, 0 to 1] with shape (muscle_count,) and type float.

Note

Support for muscle dynamics is not yet implemented.

tet_activations: array | None#

Array of tetrahedral element activations [dimensionless] with shape (tet_count,) and type float.

tri_activations: array | None#

Array of triangle element activations [dimensionless] with shape (tri_count,) and type float.