newton.solvers.SolverFeatherstone#
- class newton.solvers.SolverFeatherstone(model, *, angular_damping=0.05, update_mass_matrix_interval=1, friction_smoothing=1.0, use_tile_gemm=False, fuse_cholesky=True, deterministic=None)[source]#
Bases:
SolverBase,CouplingInterfaceA semi-implicit integrator using symplectic Euler that operates on reduced (also called generalized) coordinates to simulate articulated rigid body dynamics based on Featherstone’s composite rigid body algorithm (CRBA).
See: Featherstone, Roy. Rigid Body Dynamics Algorithms. Springer US, 2014.
Instead of maximal coordinates
body_q(rigid body positions) andbody_qd(rigid body velocities) as is the case inSolverSemiImplicitandSolverXPBD,SolverFeatherstoneusesjoint_qandjoint_qdto represent the positions and velocities of joints without allowing any redundant degrees of freedom.After constructing
ModelandStateobjects this time-integrator may be used to advance the simulation state forward in time.Note
Unlike
SolverSemiImplicitandSolverXPBD,SolverFeatherstonedoes not simulate rigid bodies with nonzero mass as floating bodies if they are not connected through any joints. Floating-base systems require an explicit free joint with which the body is connected to the world, seenewton.ModelBuilder.add_joint_free().Semi-implicit time integration is a variational integrator that preserves energy, however it not unconditionally stable, and requires a time-step small enough to support the required stiffness and damping forces.
See: https://en.wikipedia.org/wiki/Semi-implicit_Euler_method
This solver uses the routines from
SolverSemiImplicitto simulate particles, cloth, and soft bodies.- Joint limitations:
Supported joint types: PRISMATIC, REVOLUTE, BALL, FIXED, FREE, DISTANCE (treated as FREE), D6. ROD joints are not supported.
joint_armature,joint_limit_ke/joint_limit_kd,joint_target_ke/joint_target_kd, andjoint_fare supported.Position/velocity target tracking (
joint_target_q/joint_target_qd) is applied only to PRISMATIC, REVOLUTE, and D6 joints. For BALL, FREE, and DISTANCE joints the target arrays are read but no drive force is applied.joint_friction,joint_effort_limit,joint_velocity_limit,joint_enabled, andjoint_target_modeare not supported.Joint-owned mimic relationships are supported for PRISMATIC, REVOLUTE, and D6 joints. Equality constraints and the deprecated sparse mimic constraints are not supported.
See Joint Feature Support for the full comparison across solvers.
- Extended state attributes:
body_parent_fis populated when requested viarequest_state_attributes(). The reported wrench is the per-body net spatial force from the RNEA backward pass translated to the body’s COM (linear[N]first, torque[N·m]in world frame at the COM), matching the wrench-transmitted-through- the-inbound-joint convention used bySolverMuJoCo’scfrc_int. In equilibrium this reaction counters all forces acting on the body’s subtree (gravity, contacts,State.body_f, and the net effect ofjoint_f) by Newton’s third law.Free-floating roots (bodies whose only inbound joint is FREE) are not special-cased: the same RNEA sum is written, which for such bodies is the residual force balance from the recursion (e.g. contacts vs. gravity in equilibrium, or the gyroscopic
v x* (I*v)term during tumbling) rather than a true joint reaction. Treat it as a diagnostic in that case.
Example
solver = newton.solvers.SolverFeatherstone(model) # simulation loop for i in range(100): solver.step(state_in, state_out, control, contacts, dt) state_in, state_out = state_out, state_in
- __init__(model, *, angular_damping=0.05, update_mass_matrix_interval=1, friction_smoothing=1.0, use_tile_gemm=False, fuse_cholesky=True, deterministic=None)#
- Parameters:
model (Model) – The model to be simulated.
angular_damping (float) – Angular damping factor. Defaults to 0.05.
update_mass_matrix_interval (int) – How often to update the mass matrix (every n-th time the
step()function gets called). Defaults to 1.friction_smoothing (float) – The delta value for the Huber norm (see
warp.norm_huber()) used for the friction velocity normalization. Defaults to 1.0.use_tile_gemm (bool) – Whether to use operators from Warp’s Tile API to solve for joint accelerations. Defaults to False.
fuse_cholesky (bool) – Whether to fuse the Cholesky decomposition into the inertia matrix evaluation kernel when using the Tile API. Only used if use_tile_gemm is true. Defaults to True.
deterministic (DeterministicMode | None) – Opt-in determinism for this solver’s atomic-emitting kernel modules. Pass a
warp.DeterministicMode, orNone(default) to inherit the currentwp.config.deterministicmode.
- notify_model_changed(flags)#
- step(state_in, state_out, control, contacts, dt)#