newton.Control#
- class newton.Control[source]#
Bases:
objectTime-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_qandjoint_target_qd. The shape ofjoint_target_qdepends onnewton.use_coord_layout_targets— coord-shaped whenTrue, DOF-shaped otherwise.- __init__()#
- clear(model=None)#
Reset all control inputs to zero.
joint_target_qis special: zeroing it under coord layout corrupts FREE/BALL/DISTANCE quaternion slots ((0,0,0,0)is not a valid rotation). Passmodelto restore it frommodel.joint_target_qinstead. Withoutmodelit falls back to the legacy zero-fill.
- joint_act: array | None#
Per-DOF feedforward actuation input, shape
(joint_dof_count,), typefloat(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 typefloat.The degrees of freedom for FREE and DISTANCE joints are included in this array and have the same convention as the
newton.State.body_farray where the 6D wrench is defined as(f_x, f_y, f_z, t_x, t_y, t_z), wheref_x,f_y, andf_zare the components of the force vector (linear) [N] andt_x,t_y, andt_zare 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.
- joint_target_pos#
Data descriptor that turns a removed attribute into a hard error.
Deleting an attribute outright is silent on assignment:
obj.old_name = valuesimply creates an unused instance attribute, so code written against the old API keeps running while its writes are ignored. Shadowing the name with a data descriptor makes reads, writes, and deletes raiseAttributeErrornaming the replacement instead.Reads raise
AttributeError, sohasattr()reportsFalseandgetattr(obj, name, default)still falls back to default.
- joint_target_q: array | None#
Joint position targets [m or rad]. Shape is
(joint_coord_count,)whennewton.use_coord_layout_targetsisTrue, otherwise(joint_dof_count,)(legacy layout).
- joint_target_qd: array | None#
Joint velocity targets [m/s or rad/s], shape
(joint_dof_count,). Matchesjoint_qd.
- joint_target_vel#
Data descriptor that turns a removed attribute into a hard error.
Deleting an attribute outright is silent on assignment:
obj.old_name = valuesimply creates an unused instance attribute, so code written against the old API keeps running while its writes are ignored. Shadowing the name with a data descriptor makes reads, writes, and deletes raiseAttributeErrornaming the replacement instead.Reads raise
AttributeError, sohasattr()reportsFalseandgetattr(obj, name, default)still falls back to default.
- muscle_activations: array | None#
Array of muscle activations [dimensionless, 0 to 1] with shape
(muscle_count,)and typefloat.Note
Support for muscle dynamics is not yet implemented.