Skip to content

Contact warm start

26 · Convergence

The eight-box stack again, at 4 iterations per step. contact_warmstart starts each step from the matched contacts' impulses of the previous step, so the solve continues where it left off. The collision pipeline must be created with contact matching to find last step's contacts.

0.00 s

Cost

Time per step, CUDA graph replay, median of 7 interleaved rounds on one NVIDIA RTX PRO 6000 Blackwell Server Edition; ratios are against the first row. Solver allocation is the GPU memory the solver allocates at construction, before warm-up and graph capture. Scene: the 8-box stack in each world, 8 steps of 1/240 s per frame.

Option1 world64 worlds1024 worldssolver allocation, 1024 worldsresult in this tutorial
iterations=40.55 ms0.72 ms1.09 ms215 MBsag 7.0 mm
iterations=4 + warm start0.69 ms 1.26×1.03 ms 1.42×1.51 ms 1.39×230 MBsag 0.5 mm mean, chatters (sd 1.1 mm)
iterations=8 + warm start0.91 ms 1.65×1.26 ms 1.75×1.76 ms 1.62×230 MBseparate run: sag 0.04 mm mean, sd 0.45 mm
iterations=121.01 ms 1.84×1.21 ms 1.68×1.64 ms 1.51×215 MBsag 2.1 mm

What to look at

  • Cold start at 4 iterations: about 7 mm sag.
  • Warm start at 4 iterations: about 0.5 mm on average, better than 12 cold iterations, but the top box chatters by about ±1.5 mm.
  • With contact_warmstart_decay=0.9 the chatter falls to about a third (standard deviation 0.33 vs 1.1 mm) at about 1 mm mean sag, still below 12 cold iterations and cheaper per step (see Cost).

Key parameter

contact_warmstart

Needs CollisionPipeline(model, contact_matching="latest" or "sticky"). contact_warmstart_decay scales the carried impulses.

Try changing

  • Use contact_matching="sticky".
  • Set contact_warmstart_decay=0.5.

Concept

Warm start

What it is

Contacts that persist from step to step usually need similar impulses. With contact_warmstart the solve starts from last step's impulses, matched by contact identity, scaled by the step ratio and clamped to the current friction cone.

In this scene

At 4 iterations the sag drops from 7.0 mm to 0.5 mm on average, better than 12 cold iterations (2.1 mm), but the top box chatters (standard deviation 1.1 mm). A decay of 0.9 cuts the chatter to 0.33 mm at 1.0 mm mean sag.

Considerations

Cost
+26% per step in one world and +39% in 1024 worlds (1.09 → 1.51 ms), plus 15 MB of solver memory for 1024 worlds; the pipeline's contact matching adds its own memory and about 3% time (separate run).
Interactions
Needs pipeline contact_matching; not with sleeping, contact compliance or torsion.
Failure modes
Stale impulses can cause chatter at low iteration counts; contact_warmstart_decay below 1 trades some sag for less chatter.
Use it when
Persistent stacks or grasps where 4 warm iterations beat 12 cold ones in both sag and time, as here.

The script

cd tutorials && python 26_contact_warmstart.py prints each variant's final metric; --record out.json also writes the replay. Every tutorial imports replay.py from the same folder.

tutorials/26_contact_warmstart.py
# SPDX-FileCopyrightText: Copyright (c) 2026 Skild AI and the Steel contributors
# SPDX-License-Identifier: Apache-2.0
"""contact_warmstart: start each step from the matched contacts' previous impulses."""
import newton
import warp as wp
from newton.solvers import SolverSteel
from replay import Recorder
DT = 1.0 / 240.0
SUBSTEPS = 8
N, H = 8, 0.05
def build():
builder = newton.ModelBuilder()
builder.add_ground_plane(cfg=newton.ModelBuilder.ShapeConfig(mu=0.6))
for i in range(N):
box = builder.add_body(
xform=wp.transform((0.0, 0.0, H + 2 * H * i + 0.0002 * i), wp.quat_identity())
)
builder.add_shape_box(box, hx=H, hy=H, hz=H, cfg=newton.ModelBuilder.ShapeConfig(mu=0.6))
return builder.finalize()
def simulate(rec, label, warmstart, iterations, decay=1.0):
model = build()
solver = SolverSteel(
model, iterations=iterations, contact_warmstart=warmstart, contact_warmstart_decay=decay
)
# warm start finds last step's impulses through the pipeline's contact matching
pipeline = newton.CollisionPipeline(
model, contact_matching="latest" if warmstart else "disabled"
)
contacts = pipeline.contacts()
state_0, state_1, control = model.state(), model.state(), model.control()
run = rec.variant(label, model)
for _ in range(rec.frames(4.0)):
top = state_0.body_q.numpy()[N - 1, 2]
run.frame(state_0, sag_mm=1000.0 * (H * (2 * N - 1) - top))
for _ in range(SUBSTEPS):
pipeline.collide(state_0, contacts)
solver.step(state_0, state_1, control, contacts, DT)
state_0, state_1 = state_1, state_0
run.check(solver)
if __name__ == "__main__":
rec = Recorder()
simulate(rec, "iterations=4, cold start (default)", False, 4)
simulate(rec, "iterations=4, contact_warmstart=True", True, 4)
simulate(rec, "iterations=4, warm start, decay 0.9", True, 4, decay=0.9)
simulate(rec, "iterations=12, cold start", False, 12)
rec.save()

Recorded with SolverSteel on Newton 1.9.0.dev0, Warp 1.19.0, NVIDIA RTX PRO 6000 Blackwell Server Edition. Replays read the state back every frame, so they are not a speed benchmark. Script · page text