Skip to content

Sleeping

With enable_sleeping=True, articulations in contact are joined into islands each step. Static geometry supports an island without joining it; a fixed-base robot with moving joints joins the island of everything it touches. A supported island whose bodies stay below sleep_linear_threshold (0.05 m/s) and sleep_angular_threshold (0.15 rad/s) for sleep_quiet_time (0.5 s) falls asleep: its published state is frozen and, with sleep_skip_constraints=True, its rows and dynamics are skipped. Collision keeps running, so a contact with an awake or moving body wakes it.

Figure 10Islands falling asleep, and one waking.

Step through the schematic; the chart is the awake-body count Steel recorded for the same scene. Tutorial: Sleeping islands

  • Other wake events: nonzero or non-finite body_f or joint_f, a changed state or gravity, lost support or row capacity, reset of its world, notify_model_changed for its properties.
  • Driven articulations (nonzero drive gains) and articulations with passive springs stay awake.
  • Sleeping is rejected with contact_warmstart, velocity_iterations, models without articulations, and serial propagation. With colored propagation on CUDA, a captured step in which everything that can sleep is asleep skips the propagation solve where conditional graph nodes are supported.
  • Contacts of sleeping islands report zero in contact_f while their rows are skipped. Pass sleep_skip_constraints=False if force consumers read them.

Replicated worlds. The default collision pipeline can write the same contacts in a different order on each call, depending on GPU scheduling, and sleeping rules out warm start, so each step’s cold-started sweep leaves a slightly different residual. Resting bodies keep a small jitter whose fast tail reaches the default sleep_angular_threshold. An island must stay under the thresholds on every step of sleep_quiet_time, so whether it sleeps is very sensitive to that tail: in 16 to 128 copies of the tower scene from the tutorial, most bodies stayed awake after 6 s, and the outcome varied between runs and did not change monotonically with the world count. Nothing couples the worlds. CollisionPipeline(deterministic=True) sorts the contacts; in these tower measurements that roughly halved the jitter and every island slept within one or two seconds; a larger sleep_angular_threshold, such as 0.3 rad/s, also works. Check body_awake in batched runs before counting on the saving. Solver documentation of this is in review in skild-ai/newton#25.