newton.State#
- class newton.State[source]#
Bases:
object
Represents the time-varying state of a
Model
in a simulation.The State object holds all dynamic quantities that change over time during simulation, such as particle and rigid body positions, velocities, and forces, as well as joint coordinates.
State objects are typically created via
newton.Model.state()
and are used to store and update the simulation’s current configuration and derived data.- __init__()#
- clear_forces()#
Clear all force arrays (for particles and bodies) in the state object.
Sets all entries of
particle_f
andbody_f
to zero, if present.
- body_f: array | None#
Rigid body forces (spatial), shape (body_count,), dtype
spatial_vector
. First three entries: linear force; last three: torque.Note
body_f
represents external wrenches in world frame, measured at the body’s center of mass for all solvers exceptSolverFeatherstone
, which expects wrenches at the world origin.
- body_qd: array | None#
Rigid body velocities (spatial), shape (body_count,), dtype
spatial_vector
. First three entries: linear velocity; last three: angular velocity.
- property joint_coord_count: int#
The number of generalized joint position coordinates represented in the state.
- property joint_dof_count: int#
The number of generalized joint velocity coordinates represented in the state.
- joint_q: array | None#
Generalized joint position coordinates, shape (joint_coord_count,), dtype float.