newton.solvers.SolverSemiImplicit#

class newton.solvers.SolverSemiImplicit(model, angular_damping=0.05, friction_smoothing=1.0, joint_attach_ke=1.0e4, joint_attach_kd=1.0e2, enable_tri_contact=True)[source]#

Bases: SolverBase

A semi-implicit integrator using symplectic Euler.

After constructing Model and State objects this time-integrator may be used to advance the simulation state forward in time.

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.SolverSemiImplicit(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, friction_smoothing=1.0, joint_attach_ke=1.0e4, joint_attach_kd=1.0e2, enable_tri_contact=True)#
Parameters:
  • model (Model) – the model to be simulated.

  • angular_damping (float, optional) – Angular damping factor to be used in rigid body integration. Defaults to 0.05.

  • friction_smoothing (float, optional) – Huber norm delta used for friction velocity normalization (see warp.math.norm_huber()). Defaults to 1.0.

  • joint_attach_ke (float, optional) – Joint attachment spring stiffness. Defaults to 1.0e4.

  • joint_attach_kd (float, optional) – Joint attachment spring damping. Defaults to 1.0e2.

  • enable_tri_contact (bool, optional) – Enable triangle contact. Defaults to True.

step(state_in, state_out, control, contacts, dt)#

Simulate the model for a given time step using the given control input.

Parameters:
  • state_in (State) – The input state.

  • state_out (State) – The output state.

  • control (Control | None) – The control input. Defaults to None which means the control values from the Model are used.

  • contacts (Contacts | None) – The contact information. Defaults to None which means no contacts are used.

  • dt (float) – The time step (typically in seconds).

Warning

The eval_particle_contact kernel for particle-particle contact handling may corrupt the gradient computation for simulations involving particle collisions. To disable it, set newton.Model.particle_grid to None prior to calling step().