newton.solvers#

Solvers are used to integrate the dynamics of a Newton model. The typical workflow is to construct a Model and a State object, then use a solver to advance the state forward in time via the step() method:

        ---
config:
  theme: forest
  themeVariables:
    lineColor: '#76b900'

---
flowchart LR
    subgraph Input["Input Data"]
        M[newton.Model]
        S[newton.State]
        C[newton.Control]
        K[newton.Contacts]
        DT[Time step dt]
    end

    STEP["solver.step()"]

    subgraph Output["Output Data"]
        SO["newton.State (updated)"]
    end

    %% Connections
    M --> STEP
    S --> STEP
    C --> STEP
    K --> STEP
    DT --> STEP
    STEP --> SO
    

Supported Features#

Solver

Integration

Rigid bodies

Articulations

Particles

Cloth

Soft bodies

Differentiable

SolverFeatherstone

Explicit

✅ generalized coordinates

🟨 no self-collision

🟨 basic 2

SolverImplicitMPM

Implicit

SolverKamino

Semi-implicit: Euler, Moreau-Jean

✅ maximal coordinates

✅ maximal coordinates

SolverMuJoCo

Explicit, Semi-implicit, Implicit

1

✅ generalized coordinates

SolverSemiImplicit

Semi-implicit

✅ maximal coordinates

🟨 no self-collision

🟨 basic 2

SolverStyle3D

Implicit

SolverVBD

Implicit

🟨 limited joint support

SolverXPBD

Implicit

✅ maximal coordinates

🟨 no self-collision

🟨 experimental

1 Uses its own collision pipeline from MuJoCo/mujoco_warp by default, unless use_mujoco_contacts is set to False.
2 basic means Newton includes several examples that use these solvers in diffsim workflows, see Differentiability for further details.

Joint Feature Support#

Not every solver supports every joint type or joint property. The tables below document which joint features each solver handles.

Only SolverFeatherstone and SolverMuJoCo operate on articulations (generalized/reduced coordinates). The maximal-coordinate solvers (SolverSemiImplicit, SolverXPBD, and SolverKamino) enforce joints as pairwise body constraints but do not use the articulation kinematic-tree structure. SolverVBD supports a subset of joint types via soft constraints (AVBD). SolverStyle3D and SolverImplicitMPM do not support joints.

Joint types

Joint type

SolverFeatherstone

SolverSemiImplicit

SolverXPBD

SolverMuJoCo

SolverVBD

SolverKamino

PRISMATIC

REVOLUTE

BALL

FIXED

FREE

DISTANCE

🟨 1

🟨 1

D6

CABLE

1 DISTANCE joints are treated as FREE (no distance constraint enforcement).

Joint properties

Property

SolverFeatherstone

SolverSemiImplicit

SolverXPBD

SolverMuJoCo

SolverVBD

SolverKamino

joint_enabled

joint_armature

joint_friction

joint_limit_lower / joint_limit_upper

2

joint_limit_ke / joint_limit_kd

2

joint_effort_limit

joint_velocity_limit

2 Not enforced for BALL joints in SemiImplicit.

Actuation and control

Feature

SolverFeatherstone

SolverSemiImplicit

SolverXPBD

SolverMuJoCo

SolverVBD

SolverKamino

joint_target_ke / joint_target_kd

2

🟨 4

joint_target_mode

joint_f (feedforward forces)

Constraints

Feature

SolverFeatherstone

SolverSemiImplicit

SolverXPBD

SolverMuJoCo

SolverVBD

SolverKamino

Equality constraints (CONNECT, WELD, JOINT)

Mimic constraints

3

3 Mimic constraints in MuJoCo are supported for REVOLUTE and PRISMATIC joints only.
4 Used for CABLE joints only (as stretch/bend stiffness and damping).

Differentiability#

Differentiable simulation in Newton typically runs a forward rollout inside wp.Tape(), computes a scalar loss from the simulated state, and then calls tape.backward(loss) to populate gradients on differentiable state, control, or model arrays. In practice, this starts by calling finalize() with requires_grad=True.

import warp as wp
import newton

@wp.kernel
def loss_kernel(particle_q: wp.array(dtype=wp.vec3), target: wp.vec3, loss: wp.array(dtype=float)):
    delta = particle_q[0] - target
    loss[0] = wp.dot(delta, delta)

builder = newton.ModelBuilder()
builder.add_particle(pos=wp.vec3(0.0, 0.0, 0.0), vel=wp.vec3(1.0, 0.0, 0.0), mass=1.0)

model = builder.finalize(requires_grad=True)
solver = newton.solvers.SolverSemiImplicit(model)

state_in = model.state()
state_out = model.state()
control = model.control()
loss = wp.zeros(1, dtype=float, requires_grad=True)
target = wp.vec3(0.25, 0.0, 0.0)

tape = wp.Tape()
with tape:
    state_in.clear_forces()
    solver.step(state_in, state_out, control, None, 1.0 / 60.0)
    wp.launch(
        loss_kernel,
        dim=1,
        inputs=[state_out.particle_q, target],
        outputs=[loss],
    )

tape.backward(loss)
initial_velocity_grad = state_in.particle_qd.grad.numpy()
assert float(initial_velocity_grad[0, 0]) < 0.0

See the DiffSim examples on GitHub for the current reference workflows.

Submodules

Classes

SolverBase

Generic base class for solvers.

SolverFeatherstone

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).

SolverImplicitMPM

Implicit MPM solver.

SolverKamino

A physics solver for simulating constrained multi-body systems containing kinematic loops, under-/overactuation, joint-limits, hard frictional contacts and restitutive impacts.

SolverMuJoCo

This solver provides an interface to simulate physics using the MuJoCo physics engine, optimized with GPU acceleration through mujoco_warp.

SolverNotifyFlags

Flags indicating which parts of the model have been updated and require the solver to be notified.

SolverSemiImplicit

A semi-implicit integrator using symplectic Euler.

SolverStyle3D

Projective dynamics based cloth solver.

SolverVBD

An implicit solver using Vertex Block Descent (VBD) for particles and Augmented VBD (AVBD) for rigid bodies.

SolverXPBD

An implicit integrator using eXtended Position-Based Dynamics (XPBD) for rigid and soft body simulation.