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, matching the coordinate layout of State.joint_q and DOF layout of State.joint_qd, respectively.

__init__()#
clear(model=None)#

Reset all control inputs to zero.

joint_target_q is special: zeroing it 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.

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, DISTANCE, and ROD 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, DISTANCE, and ROD joints, the wrench is applied in world frame with the child body’s center of mass (COM) as reference point.

joint_target_pos#

Data descriptor that turns a removed attribute into a hard error naming its replacement.

joint_target_q: array | None#

Joint position targets [m or rad, with unit quaternions for rotations of ball and free joints], shape (joint_coord_count,). Matches State.joint_q; index via Model.joint_target_q_start.

joint_target_qd: array | None#

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

joint_target_vel#

Data descriptor that turns a removed attribute into a hard error naming its replacement.

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.