Simulation checkpoints¶
trusty.save_checkpoint(world, path) writes the state a world's next step starts from to an .npz
file, and trusty.load_checkpoint(world, path) restores it, so a run can restart part-way.
world = build_world() # the script's own scene
for _ in range(100):
world.step()
trusty.save_checkpoint(world, "run.npz")
restarted = build_world() # the same script
trusty.load_checkpoint(restarted, "run.npz")
restarted.step() # continues the saved trajectory
A checkpoint holds every body's dynamic state (positions, velocities, a rod's twist, an MPM particle's deformation gradient) and each body's previous step, so a BDF2 run resumes exactly. It does not hold the scene or the commands: load into a world built by the same script, whose bodies are matched by their handles. Commands set before or after the load (pin targets, activations) are kept. Outputs derived from the state (a subspace body's deformed positions, joint positions, pin reactions) refresh at the next step.
A checkpoint that does not match the world raises and leaves the world unchanged.