newton.solvers.FeatherstoneSolver#
- class newton.solvers.FeatherstoneSolver(model, angular_damping=0.05, update_mass_matrix_interval=1, friction_smoothing=1.0, use_tile_gemm=False, fuse_cholesky=True)[source]#
Bases:
SolverBase
A 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 inSemiImplicitSolver
andXPBDSolver
,FeatherstoneSolver
usesjoint_q
andjoint_qd
to represent the positions and velocities of joints without allowing any redundant degrees of freedom.After constructing
Model
andState
objects this time-integrator may be used to advance the simulation state forward in time.Note
Unlike
SemiImplicitSolver
andXPBDSolver
,FeatherstoneSolver
does 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
Example
solver = newton.solvers.FeatherstoneSolver(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)#
- Parameters:
model (Model) – the model to be simulated.
angular_damping (float, optional) – Angular damping factor. Defaults to 0.05.
update_mass_matrix_interval (int, optional) – How often to update the mass matrix (every n-th time the
step()
function gets called). Defaults to 1.friction_smoothing (float, optional) – The delta value for the Huber norm (see
warp.math.norm_huber()
) used for the friction velocity normalization. Defaults to 1.0.use_tile_gemm (bool, optional) – Whether to use operators from Warp’s Tile API to solve for joint accelerations. Defaults to False.
fuse_cholesky (bool, optional) – 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.
- step(state_in, state_out, control, contacts, dt)#