diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 3f9e90c..25efee2 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -14,3 +14,4 @@
# tests; own the whole folder. The nightly Newton-main workflow assigns failure
# issues to these owners. See CONTRIBUTING.md.
/examples/multiphysics/franka_pulley_mechanical_advantage/ @felixmey
+/examples/extended_simulation/industrial_lamination/ @Alex-Omar-Nvidia
diff --git a/README.md b/README.md
index 585bd4c..19f7c7c 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,25 @@ Choose a sample below for launch instructions, configuration, and validation.
|
|
+
+ Extended Simulation |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+ |
+ Industrial Lamination
+ |
+ |
+ |
+
## Contributing
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 93ce7a2..f5c7657 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -37,16 +37,28 @@ they are not bundled in this repository or its Python package.
The pulley, cable, and weight are generated by the example. Future assets should
be added to these notices with their sources, revisions, and licenses.
+## Runtime-downloaded UR5e robot asset
+
+Industrial Lamination loads the UR5e USD and meshes using
+`newton.utils.download_asset("universal_robots_ur5e", ref=...)`. These files are
+downloaded on demand and are not bundled in this repository or its Python package.
+
+- Asset collection: [newton-physics/newton-assets](https://github.com/newton-physics/newton-assets).
+- Pinned revision: `0deda9b1a68d1c202a6115a78ce0ff61ac861e00`.
+- [Asset source at that revision](https://github.com/newton-physics/newton-assets/tree/0deda9b1a68d1c202a6115a78ce0ff61ac861e00/universal_robots_ur5e).
+- License: BSD-3-Clause; Copyright 2018 ROS Industrial Consortium.
+- [Upstream license at that revision](https://github.com/newton-physics/newton-assets/blob/0deda9b1a68d1c202a6115a78ce0ff61ac861e00/universal_robots_ur5e/LICENSE).
+
## Dependency license inventory
This inventory records the reviewed dependencies for project version 1.0.0.
Python package names are matched to `uv.lock`; multiple versions reflect conditional
Python and platform dependencies. The build backend has the version range declared
-in `pyproject.toml`. The Franka asset is included for completeness.
+in `pyproject.toml`. The Franka and UR5e assets are included for completeness.
Package links point to public upstream package metadata; the downloaded package
-distributions carry their full license texts and copyright notices. The Franka
-asset's upstream license is linked above; the asset files are downloaded separately.
+distributions carry their full license texts and copyright notices. The robot
+assets' upstream licenses are linked above; the asset files are downloaded separately.
License labels below reproduce the reviewed inventory and do not select a branch
of a multiple-license expression.
@@ -175,6 +187,7 @@ Development-only tools `pytest` and `ruff` are outside this runtime/build invent
| zipp | 4.1.0 | MIT | [Package metadata](https://pypi.org/project/zipp/4.1.0/) |
| uv-build | >=0.11.0 | MIT OR Apache-2.0 | [Package metadata](https://pypi.org/project/uv-build/) |
| franka_emika_panda (FR3 URDF and meshes) | f8fb7abcbeba2318814a74f3eeb02780ad7925d6 | Apache-2.0; additional Willow Garage BSD notice | [Asset license](https://github.com/newton-physics/newton-assets/blob/f8fb7abcbeba2318814a74f3eeb02780ad7925d6/franka_emika_panda/LICENSE) |
+| universal_robots_ur5e (USD and meshes) | 0deda9b1a68d1c202a6115a78ce0ff61ac861e00 | BSD-3-Clause | [Asset license](https://github.com/newton-physics/newton-assets/blob/0deda9b1a68d1c202a6115a78ce0ff61ac861e00/universal_robots_ur5e/LICENSE) |
Dependency updates can change this inventory. Review the upstream license files
and update the entries and retained notices when updating the lockfile or assets.
diff --git a/conftest.py b/conftest.py
index e2beb8b..07adad8 100644
--- a/conftest.py
+++ b/conftest.py
@@ -21,6 +21,6 @@ def pytest_sessionstart(session):
@pytest.fixture
def cuda_device():
if not wp.is_cuda_available():
- pytest.skip("Coupled pulley regression requires CUDA")
+ pytest.skip("Simulation regression requires CUDA")
with wp.ScopedDevice("cuda:0"):
yield
diff --git a/examples/extended_simulation/__init__.py b/examples/extended_simulation/__init__.py
new file mode 100644
index 0000000..52a7a9d
--- /dev/null
+++ b/examples/extended_simulation/__init__.py
@@ -0,0 +1,2 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
diff --git a/examples/extended_simulation/industrial_lamination/README.md b/examples/extended_simulation/industrial_lamination/README.md
new file mode 100644
index 0000000..0879896
--- /dev/null
+++ b/examples/extended_simulation/industrial_lamination/README.md
@@ -0,0 +1,118 @@
+# Industrial Lamination
+
+[Back to Newton Samples](../../../README.md#examples) ·
+[Source](example_ur5e_laminate.py)
+
+
+
+This extensible proof of concept shows a UR5e robot using a deformable laminate
+roller to apply lamination to a curved windshield. The surface starts unadhered
+and changes from red through yellow to green as the roller bonds the laminate.
+
+Newton does not track adhesion itself. We take the soft-body contact forces
+from Newton's collision and solver pipeline and feed them into custom Warp
+kernels that compute and track adhesion. Adhesion is a custom engineering
+parameter added by this demo, not an output generated by Newton. This approach
+can extend Newton to many other use cases with application-specific engineering
+parameters; the adhesive behavior here is illustrative, not calibrated.
+
+## Run
+
+From the repository root, install the locked environment:
+
+```bash
+uv sync --locked --dev
+```
+
+Requires CUDA. The first run downloads the UR5e robot asset through
+`newton.utils.download_asset`; internet access and Git on `PATH` are needed.
+The windshield and roller are generated in Python. No local robot assets or
+Git LFS setup are required. The UR5e USD and meshes are downloaded at revision
+`0deda9b1a68d1c202a6115a78ce0ff61ac861e00`; see the
+[third-party notices](../../../THIRD_PARTY_NOTICES.md#runtime-downloaded-ur5e-robot-asset)
+for the source and BSD-3-Clause license.
+
+```bash
+uv run --locked -m examples ur5e_laminate --device cuda:0 --viewer gl
+```
+
+## Configuration and Measurements
+
+| Option | Description | Default |
+| --- | --- | --- |
+| `--roller-clearance` | Extra roller lift in meters; `0.10` exercises the no-contact case. | `0.0` |
+
+Common runner options are `--viewer gl` (interactive), `--viewer null`
+(headless), `--device cuda:0`, `--num-frames `, and `--test`
+(built-in final checks). Use `--help` for all runner options. The viewer displays adhesion coverage,
+contact load, pressure, and the roller's pressure footprint. The film is a
+conformal coating; its bond fraction integrates contact pressure above 200 Pa
+with an illustrative, spatially varying 5–40 kPa.s saturation dose.
+
+The roller hub follows the wrist with one-way coupling. Its tetrahedra deform
+and contact the windshield in VBD. Custom Warp kernels map Newton's
+`CONTACT_F` observable into the adhesion field. Control, IK, contact-force
+sampling, and bonding run in a CUDA graph.
+
+## Validation
+
+For headless validation, with no display or OpenGL context:
+
+```bash
+uv run --locked pytest examples/extended_simulation/industrial_lamination/tests/test_ur5e_laminate.py --require-cuda -q
+```
+
+The regression boots the demo with a null viewer, checks that the surface starts
+fully unadhered, and requires more than 90% of surface cells to be fully bonded
+after the first complete eight-lane sweep, before a second sweep begins.
+Additional tests cover contact forces, adhesion updates, and roller motion.
+
+For a short headless run with built-in state and tracking checks:
+
+```bash
+uv run --locked -m examples ur5e_laminate --device cuda:0 --viewer null --num-frames 1200 --test
+```
+
+This runs 20 simulated seconds at 60 frames per second and must bond some film;
+it does not validate full-sweep coverage. The pytest first-sweep regression above
+checks that stronger requirement. The eight strokes and seven transfers take
+100 seconds of path time, plus the initial approach and contact-settling pauses.
+Six substeps and ten VBD iterations per substep are fixed in the implementation.
+
+To verify that a lifted roller produces neither bonding nor laminate load:
+
+```bash
+uv run --locked -m examples ur5e_laminate --device cuda:0 --viewer null --roller-clearance 0.10 --num-frames 1200 --test
+```
+
+CPU discovery and geometry checks can run without CUDA:
+
+```bash
+uv run --locked pytest examples/extended_simulation/industrial_lamination/tests -m "not cuda"
+```
+
+The CUDA suite additionally covers pressure-force conservation, stale contact
+buffers, graph replay, contact settling, trajectory continuity, tool reach, and
+transfer lifts. Repository CI discovers these tests automatically, including the
+nightly run against Newton `main`.
+
+## Model Scope and Extension Points
+
+The film is a scalar bond field on a fixed surface. It does not model free-film
+motion, peeling, delamination, temperature, or calibrated adhesive chemistry.
+The roller hub follows the wrist with one-way coupling, so roller loads do not
+feed back into the arm dynamics. Treat coverage and force plots as illustrative
+simulation diagnostics rather than manufacturing acceptance predictions.
+
+To adapt the example, start with `surface_z` / `surface_normal` for the workpiece,
+`trajectory` / `advance_path` for robot motion and settling, `roller_mesh` for
+tool geometry, and `initialize_bond_dose` / `update_attachment` for the custom
+engineering parameter. Keep the surface mesh, normals, pressure-cell areas, and
+trajectory consistent when changing the workpiece geometry.
+
+## Provenance
+
+Migrated from [DevTech Newton Examples](https://github.com/NVIDIA-dev/devtech-newton-examples/tree/52961e6d4d2d52c77b7bf321daea887e0b7703e7/examples/industrial_lamination)
+at commit `52961e6d4d2d52c77b7bf321daea887e0b7703e7`. The original detailed guide and
+preview are collected in this sample folder. The
+entry point uses the Newton Samples runner and tests use the local package path.
diff --git a/examples/extended_simulation/industrial_lamination/__init__.py b/examples/extended_simulation/industrial_lamination/__init__.py
new file mode 100644
index 0000000..9881313
--- /dev/null
+++ b/examples/extended_simulation/industrial_lamination/__init__.py
@@ -0,0 +1 @@
+# SPDX-License-Identifier: Apache-2.0
diff --git a/examples/extended_simulation/industrial_lamination/example_ur5e_laminate.py b/examples/extended_simulation/industrial_lamination/example_ur5e_laminate.py
new file mode 100644
index 0000000..2b32cc1
--- /dev/null
+++ b/examples/extended_simulation/industrial_lamination/example_ur5e_laminate.py
@@ -0,0 +1,829 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 The Newton Developers
+# SPDX-License-Identifier: Apache-2.0
+"""Pressure-activated windshield laminate, UR5e + tetrahedral roller + VBD.
+
+uv run -m examples ur5e_laminate --device cuda:0 --viewer gl
+
+The film is a conformal coating, not a free cloth/peel simulation. Its local
+bond fraction integrates contact pressure above 200 Pa, saturating after a
+spatially varying 5–40 kPa.s dose. These illustrative adhesive parameters are not calibrated.
+The roller's driven hub is pinned to the simulated wrist (one-way coupling);
+its rubber tetrahedra deform and contact the windshield in VBD. Newton 1.7
+exports the contact wrenches through its public CONTACT_F observable. A Warp
+kernel maps their compressive normal forces into the laminate pressure field.
+All control, IK, contact-force sampling, and bonding run in a CUDA graph.
+"""
+
+import time
+from collections import deque
+
+import newton
+import newton.utils
+import numpy as np
+import warp as wp
+from newton import ik
+from newton.solvers import SolverVBD
+from scipy.spatial import Delaunay
+
+import examples
+
+NX, NY = 128, 112
+X0, X1 = 0.32, 0.76
+Y0, Y1 = -0.28, 0.28
+RADIUS, WIDTH = 0.025, 0.18
+HUB_RADIUS = 0.01
+APPROACH_TIME = 2.5
+LIFT_TIME, LOWER_TIME, TRANSFER_LIFT = 0.75, 1.75, 0.035
+LANES, PASS_TIME, TURN_TIME, RETURN_TIME = 8, 9.0, 4.0, 8.0
+CYCLE_TIME = LANES * (PASS_TIME + TURN_TIME) + RETURN_TIME - TURN_TIME
+# Newton assets revision fixes the USD geometry, physics, and flange frame together.
+ROBOT_ASSET_REVISION = "0deda9b1a68d1c202a6115a78ce0ff61ac861e00"
+# UR5e attachment_site: flange is 10 cm along wrist +Y, facing +Y.
+TOOL_FRAME = wp.transform(wp.vec3(0.0, 0.1, 0.0), wp.quat(-0.70710678, 0.0, 0.0, 0.70710678))
+TOOL_OFFSET = wp.vec3(0.0, 0.0, 0.10)
+
+
+@wp.func
+def ease(t: float):
+ t = wp.clamp(t, 0.0, 1.0)
+ return t * t * t * (10.0 + t * (-15.0 + 6.0 * t))
+
+
+@wp.func
+def surface_z(x: float, y: float):
+ return 0.32 + 0.14 * (x - 0.54) - 0.5 * (x - 0.54) ** 2.0 - 0.55 * y * y
+
+
+@wp.func
+def surface_normal(x: float, y: float):
+ return wp.normalize(wp.vec3(x - 0.54 - 0.14, 1.1 * y, 1.0))
+
+
+@wp.kernel
+def trajectory(
+ clock: wp.array[float],
+ stats: wp.array[float],
+ clearance: float,
+ target_p: wp.array[wp.vec3],
+ target_r: wp.array[wp.vec4],
+):
+ if stats[1] >= float(NX * NY) and clock[1] < 0.0:
+ clock[1] = clock[0]
+ t = clock[2] % CYCLE_TIME
+ lane = wp.min(int(t / (PASS_TIME + TURN_TIME)), LANES - 1)
+ elapsed = t - float(lane) * (PASS_TIME + TURN_TIME)
+ u = wp.min(elapsed / PASS_TIME, 1.0)
+ # Ease into and out of each stroke, with zero speed at the lane changes.
+ u = u * u * (3.0 - 2.0 * u)
+ x = X0 + (X1 - X0) * u
+ if lane % 2 != 0:
+ x = X1 - (X1 - X0) * u
+ y = Y0 + 0.025 + (Y1 - Y0 - 0.05) * float(lane) / float(LANES - 1)
+ lift = 0.04 * (1.0 - ease(clock[0] / APPROACH_TIME))
+ if elapsed > PASS_TIME:
+ duration = TURN_TIME
+ if lane == LANES - 1:
+ duration = RETURN_TIME
+ transfer = elapsed - PASS_TIME
+ # Lift along the surface normal, translate while clear, then lower.
+ move_time = duration - LIFT_TIME - LOWER_TIME
+ blend = ease((transfer - LIFT_TIME) / move_time)
+ next_y = Y0 + 0.025 + (Y1 - Y0 - 0.05) * float((lane + 1) % LANES) / float(LANES - 1)
+ y += (next_y - y) * blend
+ lift += TRANSFER_LIFT * ease(transfer / LIFT_TIME)
+ lift -= TRANSFER_LIFT * ease((transfer - duration + LOWER_TIME) / LOWER_TIME)
+ if clock[1] >= 0.0:
+ blend = wp.min((clock[0] - clock[1]) / 1.5, 1.0)
+ lift += 0.06 * blend * blend * (3.0 - 2.0 * blend)
+ n = surface_normal(x, y)
+ tx = wp.normalize(wp.vec3(1.0, 0.0, 0.14 - (x - 0.54)))
+ ty = wp.cross(n, tx)
+ rotation = wp.quat_from_matrix(wp.matrix_from_cols(tx, -ty, -n))
+ # Lean the holder around the roller axle to keep the arm away from reach
+ # limits. The cylindrical roller's axis remains tangent to the glass.
+ lean = (2.0 * (x - X0) / (X1 - X0) - 1.0) * (wp.pi / 3.0)
+ rotation = rotation * wp.quat_from_axis_angle(wp.vec3(0.0, 1.0, 0.0), lean)
+ center = wp.vec3(x, y, surface_z(x, y)) + n * (RADIUS - 0.001 + lift + clearance)
+ target_p[0] = center
+ target_r[0] = wp.vec4(rotation[0], rotation[1], rotation[2], rotation[3])
+
+
+@wp.kernel
+def measure_motion(velocity: wp.array[wp.vec3], speed: wp.array[float]):
+ wp.atomic_max(speed, 0, wp.length(velocity[wp.tid()]))
+
+
+@wp.kernel
+def advance_path(clock: wp.array[float], stats: wp.array[float], speed: wp.array[float], clearance: float, dt: float):
+ # Require a continuous quiet second, not just a fixed pause or one quiet frame.
+ load = stats[3]
+ if clock[0] >= APPROACH_TIME and clock[4] == 0.0:
+ stable = speed[0] < 0.012 and wp.abs(load - clock[5]) < wp.max(5.0, 0.05 * load)
+ if stable and (load > 1.0 or clearance >= 0.08):
+ clock[3] += dt
+ else:
+ clock[3] = 0.0
+ if clock[3] >= 1.0:
+ clock[4] = 1.0
+ if clock[4] == 1.0 and clock[1] < 0.0:
+ # Stop exactly at each new stroke, including the full-width return.
+ cycle = wp.floor(clock[2] / CYCLE_TIME)
+ local = clock[2] - cycle * CYCLE_TIME
+ lane = wp.min(int(local / (PASS_TIME + TURN_TIME)), LANES - 1)
+ boundary = cycle * CYCLE_TIME + float(lane + 1) * (PASS_TIME + TURN_TIME)
+ if lane == LANES - 1:
+ boundary = (cycle + 1.0) * CYCLE_TIME
+ next_time = clock[2] + dt
+ if next_time >= boundary:
+ clock[2] = boundary
+ clock[3] = 0.0
+ clock[4] = 0.0
+ else:
+ clock[2] = next_time
+ clock[5] = load
+
+
+@wp.kernel
+def compensate_arm_sag(
+ target: wp.array[wp.vec3], body_q: wp.array[wp.transform], wrist: int, correction: wp.array[float], dt: float
+):
+ desired = target[0]
+ actual = wp.transform_point(body_q[wrist] * TOOL_FRAME, TOOL_OFFSET)
+ n = surface_normal(desired[0], desired[1])
+ # Slow integral height correction; never adds downward indentation.
+ correction[0] = wp.clamp(correction[0] + 3.0 * dt * wp.dot(desired - actual, n), 0.0, 0.025)
+ target[0] = desired + n * correction[0]
+
+
+@wp.kernel
+def reduce_force_graphic(
+ pressure: wp.array[float],
+ body_q: wp.array[wp.transform],
+ wrist: int,
+ strip_force: wp.array[float],
+ footprint: wp.array[float],
+):
+ i = wp.tid()
+ ix, iy = i // NY, i % NY
+ x = X0 + float(ix) * (X1 - X0) / float(NX - 1)
+ y = Y0 + float(iy) * (Y1 - Y0) / float(NY - 1)
+ area = ((X1 - X0) / float(NX - 1)) * ((Y1 - Y0) / float(NY - 1)) / surface_normal(x, y)[2]
+ local = wp.transform_point(wp.transform_inverse(body_q[wrist] * TOOL_FRAME), wp.vec3(x, y, surface_z(x, y)))
+ strip = wp.clamp(int((local[1] / WIDTH + 0.5) * 12.0), 0, 11)
+ wp.atomic_add(strip_force, strip, pressure[i] * area)
+ # 8x8 maximum pooling preserves small contact patches in the side graphic.
+ wp.atomic_max(footprint, (ix // 8) * 14 + iy // 8, pressure[i])
+
+
+@wp.kernel
+def move_hub(
+ body_q: wp.array[wp.transform],
+ wrist: int,
+ rest: wp.array[wp.vec3],
+ mass: wp.array[float],
+ roll: wp.array[float],
+ q: wp.array[wp.vec3],
+ qd: wp.array[wp.vec3],
+ dt: float,
+):
+ i = wp.tid()
+ if mass[i] == 0.0:
+ tf = body_q[wrist] * TOOL_FRAME
+ spin = wp.quat_from_axis_angle(wp.vec3(0.0, 1.0, 0.0), roll[0])
+ p = wp.transform_point(tf, TOOL_OFFSET + wp.quat_rotate(spin, rest[i]))
+ qd[i] = (p - q[i]) / dt
+ q[i] = p
+
+
+@wp.kernel
+def roll_hub(
+ body_q: wp.array[wp.transform],
+ wrist: int,
+ roll: wp.array[float],
+ previous_center: wp.array[wp.vec3],
+ previous_lean: wp.array[float],
+):
+ tf = body_q[wrist] * TOOL_FRAME
+ p = wp.transform_point(tf, TOOL_OFFSET)
+ tangent = wp.normalize(wp.vec3(1.0, 0.0, 0.14 - (p[0] - 0.54)))
+ axis_x = wp.transform_vector(tf, wp.vec3(1.0, 0.0, 0.0))
+ lean = wp.atan2(wp.dot(axis_x, surface_normal(p[0], p[1])), wp.dot(axis_x, tangent))
+ roll[0] -= wp.dot(p - previous_center[0], tangent) / RADIUS + lean - previous_lean[0]
+ previous_lean[0] = lean
+ previous_center[0] = p
+
+
+@wp.kernel
+def read_contact_forces(
+ count: wp.array[int],
+ shapes: wp.array[int],
+ normals: wp.array[wp.vec3],
+ contact_f: wp.array[wp.spatial_vector],
+ soft_offset: int,
+ glass: int,
+ forces: wp.array[float],
+):
+ c = wp.tid()
+ forces[c] = 0.0
+ if c < count[0] and shapes[c] == glass:
+ # Soft rows follow the rigid CAPACITY, not the active rigid count.
+ # Newton reports force on the shape (glass), opposite to the outward
+ # normal. The first three wrench components are force; the rest torque.
+ force_on_glass = wp.spatial_top(contact_f[soft_offset + c])
+ forces[c] = wp.max(-wp.dot(force_on_glass, normals[c]), 0.0)
+
+
+@wp.kernel
+def distribute_pressure(
+ count: wp.array[int], points: wp.array[wp.vec3], forces: wp.array[float], pressure: wp.array[float]
+):
+ c = wp.tid()
+ if c >= count[0] or forces[c] <= 0.0:
+ return
+ p = points[c]
+ dx = (X1 - X0) / float(NX - 1)
+ dy = (Y1 - Y0) / float(NY - 1)
+ cx = int(wp.round((p[0] - X0) / dx))
+ cy = int(wp.round((p[1] - Y0) / dy))
+ # A 12 mm footprint reconstructs pressure between the roller's surface
+ # vertices. Normalize over the full stencil, including cells outside the
+ # film: cropping at its boundary must not invent extra force.
+ norm = 0.0
+ for i in range(-5, 6):
+ for j in range(-3, 4):
+ rx = X0 + float(cx + i) * dx - p[0]
+ ry = Y0 + float(cy + j) * dy - p[1]
+ norm += wp.max(1.0 - (rx * rx + ry * ry) / 0.000144, 0.0)
+ for i in range(-5, 6):
+ for j in range(-3, 4):
+ ix, iy = cx + i, cy + j
+ if ix >= 0 and ix < NX and iy >= 0 and iy < NY:
+ rx = X0 + float(ix) * dx - p[0]
+ ry = Y0 + float(iy) * dy - p[1]
+ w = wp.max(1.0 - (rx * rx + ry * ry) / 0.000144, 0.0)
+ n = surface_normal(X0 + float(ix) * dx, Y0 + float(iy) * dy)
+ cell_area = dx * dy / n[2]
+ wp.atomic_add(pressure, ix * NY + iy, forces[c] * w / (norm * cell_area))
+
+
+@wp.kernel
+def initialize_bond_dose(required_dose: wp.array[float]):
+ i = wp.tid()
+ x = float(i // NY) / float(NX - 1)
+ y = float(i % NY) / float(NY - 1)
+ # Smooth, repeatable tougher patches; pressure alone determines bonding.
+ patch_a = wp.exp(-((x - 0.65) ** 2.0 / 0.035 + (y - 0.6) ** 2.0 / 0.06))
+ patch_b = wp.exp(-((x - 0.2) ** 2.0 / 0.025 + (y - 0.2) ** 2.0 / 0.04))
+ required_dose[i] = 5000.0 + 35000.0 * wp.max(patch_a, patch_b)
+
+
+@wp.kernel
+def update_attachment(
+ pressure: wp.array[float], attachment: wp.array[float], required_dose: wp.array[float], dt: float
+):
+ i = wp.tid()
+ attachment[i] = wp.min(1.0, attachment[i] + wp.max(pressure[i] - 200.0, 0.0) * dt / required_dose[i])
+
+
+@wp.kernel
+def update_display(
+ attachment: wp.array[float], pressure: wp.array[float], uvs: wp.array[wp.vec2], stats: wp.array[float]
+):
+ i = wp.tid()
+ a = attachment[i]
+ uvs[i] = wp.vec2(0.005 + 0.99 * a, 0.5)
+ wp.atomic_add(stats, 0, a)
+ if a >= 0.999:
+ wp.atomic_add(stats, 1, 1.0)
+ p = pressure[i]
+ wp.atomic_max(stats, 2, p)
+ x = X0 + float(i // NY) * (X1 - X0) / float(NX - 1)
+ y = Y0 + float(i % NY) * (Y1 - Y0) / float(NY - 1)
+ area = ((X1 - X0) / float(NX - 1)) * ((Y1 - Y0) / float(NY - 1)) / surface_normal(x, y)[2]
+ wp.atomic_add(stats, 3, p * area) # Integral of normal pressure over the laminate, in N.
+ if p > 0.0:
+ wp.atomic_add(stats, 4, area)
+
+
+@wp.kernel
+def tick(clock: wp.array[float], dt: float):
+ clock[0] += dt
+
+
+def grid_mesh(xs, ys, offset=0.0):
+ """A crowned, doubly curved windshield patch, with upward triangle normals."""
+ vertices = np.array(
+ [(x, y, 0.32 + 0.14 * (x - 0.54) - 0.5 * (x - 0.54) ** 2 - 0.55 * y * y + offset) for x in xs for y in ys],
+ dtype=np.float32,
+ )
+ faces = []
+ for i in range(len(xs) - 1):
+ for j in range(len(ys) - 1):
+ a = i * len(ys) + j
+ faces.extend([a, a + len(ys), a + 1, a + 1, a + len(ys), a + len(ys) + 1])
+ return vertices, np.array(faces, dtype=np.int32)
+
+
+def roller_mesh():
+ """Extrude a triangulated circular section into consistently split prisms."""
+ section = [(0.0, 0.0)]
+ for radius in (HUB_RADIUS, RADIUS):
+ section.extend((radius * np.cos(a), radius * np.sin(a)) for a in np.linspace(0, 2 * np.pi, 24, endpoint=False))
+ section = np.asarray(section)
+ triangles = Delaunay(section).simplices
+ m = len(section)
+ vertices = np.array([(x, y, z) for y in np.linspace(-WIDTH / 2, WIDTH / 2, 11) for x, z in section])
+ tets = []
+ for layer in range(10):
+ for tri in triangles:
+ a, b, c = np.sort(tri) + layer * m
+ tets.extend([(a, b, c, c + m), (a, b, b + m, c + m), (a, a + m, b + m, c + m)])
+ tets = np.array(tets)
+ p = vertices[tets]
+ inverted = np.linalg.det(np.stack((p[:, 1] - p[:, 0], p[:, 2] - p[:, 0], p[:, 3] - p[:, 0]), axis=-1)) < 0
+ tets[inverted, :2] = tets[inverted, 1::-1]
+ return vertices.astype(np.float32), tets.astype(np.int32)
+
+
+class Example:
+ def __init__(self, viewer, args):
+ self.viewer = viewer
+ self.sim_time = 0.0
+ self.frame_dt = 1.0 / 60.0
+ self.substeps = 6 # Even: graph replay preserves ping-pong buffer identities.
+ self.sim_dt = self.frame_dt / self.substeps
+ self.clearance = args.roller_clearance
+ # Clock: time, completion time, path time, quiet duration, ready, previous load.
+ # One small readback for the HUD; all simulation state remains on device.
+ self.hud = wp.zeros(5 + 6 + 12 + 16 * 14, dtype=float)
+ self.clock = self.hud[5:11]
+ self.clock.assign(np.array([0.0, -1.0, 0.0, 0.0, 0.0, 0.0], dtype=np.float32))
+ self.motion = wp.zeros(1, dtype=float)
+ self.display_phase = "Approaching slowly"
+ self.stats = self.hud[:5]
+ self.display_stats = np.zeros(5)
+ self.force_history = deque(maxlen=180)
+ self.last_display_time = -1.0
+ self.last_hud_read = -1.0
+ self.target_p = wp.zeros(1, dtype=wp.vec3)
+ self.target_r = wp.zeros(1, dtype=wp.vec4)
+ wp.launch(trajectory, 1, [self.clock, self.stats, self.clearance, self.target_p, self.target_r])
+
+ asset = newton.utils.download_asset("universal_robots_ur5e", ref=ROBOT_ASSET_REVISION)
+ builder = newton.ModelBuilder()
+ builder.add_usd(
+ str(asset / "usd_structured/ur5e.usda"),
+ floating=False,
+ collapse_fixed_joints=True,
+ enable_self_collisions=False,
+ force_position_velocity_actuation=True,
+ )
+ self.wrist = next(i for i, label in enumerate(builder.body_label) if label.endswith("wrist_3_link"))
+ # Only the windshield collides with the soft rubber. Keep the holder
+ # visual, rather than generating artificial rubber/axle self contacts.
+ builder.shape_flags[:] = [
+ int(f) & ~int(newton.ShapeFlags.COLLIDE_PARTICLES | newton.ShapeFlags.COLLIDE_SHAPES)
+ for f in builder.shape_flags
+ ]
+ builder.joint_target_ke[:] = [6000.0] * 6
+ builder.joint_target_kd[:] = [300.0] * 6
+ builder.joint_q[:] = [3.14, -1.0, 1.5, -2.0, -1.57, 0.0]
+
+ # Solve the starting pose before building the rubber, so it starts on
+ # the wrist rather than being teleported after the first solver step.
+ robot = builder.finalize()
+ self.pos_obj = ik.IKObjectivePosition(self.wrist, wp.transform_point(TOOL_FRAME, TOOL_OFFSET), self.target_p)
+ self.rot_obj = ik.IKObjectiveRotation(
+ self.wrist, wp.transform_get_rotation(TOOL_FRAME), self.target_r, weight=0.5
+ )
+ self.ik_solver = ik.IKSolver(
+ robot,
+ n_problems=1,
+ objectives=[
+ self.pos_obj,
+ self.rot_obj,
+ ik.IKObjectiveJointLimit(robot.joint_limit_lower, robot.joint_limit_upper),
+ ],
+ lambda_initial=0.05,
+ jacobian_mode=ik.IKJacobianType.ANALYTIC,
+ )
+ self.ik_q = wp.clone(robot.joint_q.reshape((1, robot.joint_coord_count)))
+ self.ik_solver.step(self.ik_q, self.ik_q, iterations=100)
+ builder.joint_q[:] = self.ik_q.numpy()[0].tolist()
+ newton.eval_fk(robot, self.ik_q.flatten(), robot.joint_qd, robot)
+ wrist_tf = wp.transform(*robot.body_q.numpy()[self.wrist]) * TOOL_FRAME
+ self.initial_center = wp.transform_point(wrist_tf, TOOL_OFFSET)
+
+ visual = newton.ModelBuilder.ShapeConfig(has_shape_collision=False, has_particle_collision=False)
+ # Compact fork: a short wrist mount, a crossbar, and two axle supports
+ # outside the rubber ends. The roller spins around the transverse axle.
+ metal = (0.65, 0.68, 0.72)
+ fork_y = WIDTH / 2 + 0.012
+ builder.add_shape_box(
+ self.wrist,
+ xform=TOOL_FRAME * wp.transform((0, 0, 0.0175), wp.quat_identity()),
+ hx=0.018,
+ hy=0.018,
+ hz=0.0175,
+ cfg=visual,
+ color=metal,
+ )
+ builder.add_shape_box(
+ self.wrist,
+ xform=TOOL_FRAME * wp.transform((0, 0, 0.035), wp.quat_identity()),
+ hx=0.012,
+ hy=fork_y + 0.006,
+ hz=0.007,
+ cfg=visual,
+ color=metal,
+ )
+ for side in (-1, 1):
+ builder.add_shape_box(
+ self.wrist,
+ xform=TOOL_FRAME * wp.transform((0, side * fork_y, 0.0675), wp.quat_identity()),
+ hx=0.009,
+ hy=0.006,
+ hz=0.0325,
+ cfg=visual,
+ color=metal,
+ )
+ builder.add_shape_cylinder(
+ self.wrist,
+ xform=TOOL_FRAME * wp.transform(TOOL_OFFSET, wp.quat_from_axis_angle(wp.vec3(1, 0, 0), np.pi / 2)),
+ radius=HUB_RADIUS,
+ half_height=fork_y + 0.008,
+ cfg=visual,
+ color=metal,
+ )
+ glass_v, glass_i = grid_mesh(np.linspace(X0, X1, 35), np.linspace(Y0, Y1, 41))
+ # Close the collision mesh so inside/outside queries have an unambiguous sign.
+ n = len(glass_v)
+ bottom = glass_v.copy()
+ bottom[:, 2] -= 0.008
+ border = (
+ [i * 41 for i in range(35)]
+ + [34 * 41 + j for j in range(1, 41)]
+ + [i * 41 + 40 for i in range(33, -1, -1)]
+ + [j for j in range(39, 0, -1)]
+ )
+ sides = []
+ for a, b in zip(border, border[1:] + border[:1], strict=True):
+ sides.extend([b, a, a + n, b, a + n, b + n])
+ glass_i = np.concatenate((glass_i, (glass_i.reshape(-1, 3)[:, ::-1] + n).flatten(), sides))
+ glass_v = np.concatenate((glass_v, bottom))
+ glass_cfg = newton.ModelBuilder.ShapeConfig(ke=1.0e6, kd=50.0, mu=0.4, margin=0.0, has_shape_collision=False)
+ self.glass = builder.add_shape_mesh(
+ -1, mesh=newton.Mesh(glass_v, glass_i), cfg=glass_cfg, color=(0.12, 0.24, 0.32), label="Windshield"
+ )
+ builder.add_shape_box(
+ -1,
+ xform=wp.transform((0.54, 0, 0.12), wp.quat_identity()),
+ hx=0.17,
+ hy=0.20,
+ hz=0.12,
+ cfg=visual,
+ color=(0.12, 0.14, 0.17),
+ )
+ builder.add_ground_plane(cfg=visual)
+ rest, tets = roller_mesh()
+ world = np.array([wp.transform_point(wrist_tf, TOOL_OFFSET + wp.vec3(p)) for p in rest])
+ builder.add_soft_mesh(
+ pos=wp.vec3(),
+ rot=wp.quat_identity(),
+ scale=1.0,
+ vel=wp.vec3(),
+ vertices=world,
+ indices=tets.flatten(),
+ density=1000.0,
+ k_mu=2.0e5,
+ k_lambda=4.0e5,
+ k_damp=0.02,
+ particle_radius=0.002,
+ color=(0.18, 0.35, 0.85),
+ label="Tetrahedral rubber roller",
+ )
+ for i, p in enumerate(rest):
+ if np.linalg.norm(p[[0, 2]]) < HUB_RADIUS + 1e-6:
+ builder.particle_mass[i] = 0.0
+ builder.particle_flags[i] = 0
+ builder.color()
+ self.model = builder.finalize()
+ self.device = self.model.device
+ newton.eval_fk(self.model, self.model.joint_q, self.model.joint_qd, self.model)
+ self.state_0, self.state_1 = self.model.state(), self.model.state()
+ for state in (self.state_0, self.state_1):
+ newton.eval_fk(self.model, self.model.joint_q, self.model.joint_qd, state)
+ self.control = self.model.control()
+ # Static geometry cannot deform; high contact stiffness limits numerical overlap.
+ self.model.soft_contact_ke = 1.0e6
+ self.model.soft_contact_kd = 50.0
+ self.height_correction = wp.zeros(1, dtype=float)
+ self.strip_force = self.hud[11:23]
+ self.footprint = self.hud[23:]
+ self.display_strips = np.zeros(12)
+ self.display_footprint = np.zeros((16, 14))
+ self.rest = wp.array(rest, dtype=wp.vec3)
+ self.roll = wp.zeros(1, dtype=float)
+ self.previous_center = wp.array([self.initial_center], dtype=wp.vec3)
+ self.previous_lean = wp.array([-np.pi / 3.0], dtype=float)
+ # Only particle/glass contacts exist: at most one per roller vertex.
+ self.collision = newton.CollisionPipeline(
+ self.model, rigid_contact_max=0, soft_contact_max=self.model.particle_count, soft_contact_gap=0.01
+ )
+ self.contacts = self.collision.contacts()
+ self.solver = SolverVBD(
+ self.model,
+ iterations=10,
+ rigid_compliant_alm=True,
+ rigid_joint_linear_ke=1e7,
+ rigid_joint_angular_ke=1e7,
+ particle_enable_self_contact=False,
+ )
+ # Allocate once before CUDA capture; every substep refreshes these GPU arrays.
+ self.observables = self.solver.observables(kinds={self.solver.ObservableKind.CONTACT_F}, contacts=self.contacts)
+ self.forces = wp.zeros(self.contacts.soft_contact_max, dtype=float)
+ self.pressure = wp.zeros(NX * NY, dtype=float)
+ self.attachment = wp.zeros(NX * NY, dtype=float)
+ self.required_dose = wp.empty(NX * NY, dtype=float)
+ wp.launch(initialize_bond_dose, NX * NY, [self.required_dose])
+ film_v, film_i = grid_mesh(np.linspace(X0, X1, NX), np.linspace(Y0, Y1, NY), offset=0.0008)
+ self.film_points = wp.array(film_v, dtype=wp.vec3)
+ normals = np.column_stack((film_v[:, 0] - 0.68, 1.1 * film_v[:, 1], np.ones(len(film_v))))
+ normals /= np.linalg.norm(normals, axis=1)[:, None]
+ self.film_normals = wp.array(normals, dtype=wp.vec3)
+ self.film_indices = wp.array(film_i, dtype=int)
+ self.film_xform = wp.array([wp.transform_identity()], dtype=wp.transform)
+ self.film_color = wp.array([wp.vec3(1.0)], dtype=wp.vec3)
+ self.film_material = wp.array([wp.vec4(0.7, 0.0, 0.0, 1.0)], dtype=wp.vec4)
+ self.uvs = wp.zeros(NX * NY, dtype=wp.vec2)
+ # Static color ramp; GPU UVs select each vertex's current attachment color.
+ stops = np.array([[0.85, 0.07, 0.04], [1.0, 0.75, 0.05], [0.03, 0.8, 0.22]])
+ self.texture = (
+ 255
+ * np.array([np.interp(np.linspace(0, 1, 256), [0, 0.5, 1], stops[:, c]) for c in range(3)]).T[None, :, :]
+ ).astype(np.uint8)
+ self.viewer.set_model(self.model)
+ self.viewer.set_camera(wp.vec3(1.6, -1.5, 1.4), pitch=-28.0, yaw=135.0)
+ if hasattr(self.viewer, "register_ui_callback"):
+ self.viewer.register_ui_callback(self.force_overlay, position="free")
+ self.graph = None
+ if self.device.is_cuda:
+ with wp.ScopedCapture() as capture:
+ self.simulate()
+ self.graph = capture.graph
+
+ def simulate(self):
+ wp.launch(trajectory, 1, [self.clock, self.stats, self.clearance, self.target_p, self.target_r])
+ wp.launch(
+ compensate_arm_sag,
+ 1,
+ [self.target_p, self.state_0.body_q, self.wrist, self.height_correction, self.frame_dt],
+ )
+ self.ik_solver.step(self.ik_q, self.ik_q, iterations=8)
+ wp.copy(self.control.joint_target_q, self.ik_q.flatten())
+ for _ in range(self.substeps):
+ self.state_0.clear_forces()
+ wp.launch(
+ roll_hub, 1, [self.state_0.body_q, self.wrist, self.roll, self.previous_center, self.previous_lean]
+ )
+ wp.launch(
+ move_hub,
+ self.model.particle_count,
+ [
+ self.state_0.body_q,
+ self.wrist,
+ self.rest,
+ self.model.particle_mass,
+ self.roll,
+ self.state_0.particle_q,
+ self.state_0.particle_qd,
+ self.sim_dt,
+ ],
+ )
+ self.collision.collide(self.state_0, self.contacts)
+ self.solver.step(
+ self.state_0,
+ self.state_1,
+ self.control,
+ self.contacts,
+ self.sim_dt,
+ observables=self.observables,
+ )
+ c = self.contacts
+ wp.launch(
+ read_contact_forces,
+ c.soft_contact_max,
+ [
+ c.soft_contact_count,
+ c.soft_contact_shape,
+ c.soft_contact_normal,
+ self.observables.contact_f,
+ c.rigid_contact_max,
+ self.glass,
+ self.forces,
+ ],
+ )
+ self.pressure.zero_()
+ wp.launch(
+ distribute_pressure,
+ c.soft_contact_max,
+ [c.soft_contact_count, c.soft_contact_body_pos, self.forces, self.pressure],
+ )
+ wp.launch(update_attachment, NX * NY, [self.pressure, self.attachment, self.required_dose, self.sim_dt])
+ self.state_0, self.state_1 = self.state_1, self.state_0
+ wp.launch(tick, 1, [self.clock, self.sim_dt])
+ self.stats.zero_()
+ wp.launch(update_display, NX * NY, [self.attachment, self.pressure, self.uvs, self.stats])
+ self.strip_force.zero_()
+ self.footprint.zero_()
+ wp.launch(
+ reduce_force_graphic,
+ NX * NY,
+ [self.pressure, self.state_0.body_q, self.wrist, self.strip_force, self.footprint],
+ )
+ self.motion.zero_()
+ wp.launch(measure_motion, self.model.particle_count, [self.state_0.particle_qd, self.motion])
+ wp.launch(advance_path, 1, [self.clock, self.stats, self.motion, self.clearance, self.frame_dt])
+
+ def step(self):
+ if self.graph is not None:
+ wp.capture_launch(self.graph)
+ else:
+ self.simulate()
+ self.sim_time += self.frame_dt
+
+ def render(self):
+ # Read only HUD scalars and a small GPU-reduced graphic; the full field stays on GPU.
+ now = time.perf_counter()
+ if getattr(self.viewer, "gui", None) is not None and now - self.last_hud_read >= 0.05:
+ hud = self.hud.numpy()
+ self.last_hud_read = now
+ self.display_stats = hud[:5]
+ clock = hud[5:11]
+ self.display_phase = (
+ "Complete / retracting"
+ if clock[1] >= 0
+ else "Rolling"
+ if clock[4]
+ else "Approaching slowly"
+ if clock[0] < APPROACH_TIME
+ else "Waiting for roller to settle"
+ )
+ if self.display_phase == "Rolling":
+ local = float(clock[2]) % CYCLE_TIME
+ lane = min(int(local / (PASS_TIME + TURN_TIME)), LANES - 1)
+ transfer = local - lane * (PASS_TIME + TURN_TIME) - PASS_TIME
+ duration = RETURN_TIME if lane == LANES - 1 else TURN_TIME
+ if transfer > 0:
+ self.display_phase = (
+ "Lifting roller"
+ if transfer < LIFT_TIME
+ else "Moving to next pass"
+ if transfer < duration - LOWER_TIME
+ else "Lowering roller"
+ )
+ self.display_strips = hud[11:23]
+ self.display_footprint = hud[23:].reshape(16, 14)
+ if self.sim_time != self.last_display_time:
+ self.force_history.append(float(self.display_stats[3]))
+ self.last_display_time = self.sim_time
+ self.viewer.begin_frame(self.sim_time)
+ self.viewer.log_state(self.state_0)
+ self.viewer.log_mesh(
+ "Laminate attachment",
+ self.film_points,
+ self.film_indices,
+ normals=self.film_normals,
+ uvs=self.uvs,
+ texture=self.texture,
+ backface_culling=False,
+ hidden=True,
+ dynamic=True,
+ )
+ self.viewer.log_instances(
+ "Bond field",
+ "Laminate attachment",
+ self.film_xform,
+ scales=None,
+ colors=self.film_color,
+ materials=self.film_material,
+ )
+ self.viewer.end_frame()
+
+ def gui(self, ui):
+ stats = self.display_stats
+ ui.text(self.display_phase)
+ ui.text_wrapped("Windshield laminate | VBD tetrahedral roller")
+ ui.text_wrapped("Red: loose Yellow: bonding Green: attached")
+ ui.progress_bar(float(stats[1] / (NX * NY)), (-1, 0), f"{100 * stats[1] / (NX * NY):.1f}% bonded")
+ ui.text(f"Peak contact pressure: {stats[2] / 1000:.1f} kPa")
+ ui.text_wrapped("Overlapping passes repeat until every cell is bonded.")
+
+ def force_graphic(self, ui):
+ ui.separator()
+ ui.text("Force across roller width")
+ width = max(120.0, ui.get_content_region_avail().x - 4.0)
+ origin = ui.get_cursor_screen_pos()
+ draw = ui.get_window_draw_list()
+ color = ui.color_convert_float4_to_u32
+ vec = ui.ImVec2
+ draw.add_rect_filled(
+ vec(origin.x, origin.y + 3),
+ vec(origin.x + width, origin.y + 20),
+ color((0.18, 0.4, 0.95, 1.0)),
+ rounding=7.0,
+ )
+ maximum = max(float(self.display_strips.max()), 1e-6)
+ for i, force in enumerate(self.display_strips):
+ if force <= 0.01:
+ continue
+ x = origin.x + (i + 0.5) * width / 12
+ top, tip = origin.y + 24, origin.y + 31 + 55 * force / maximum
+ shade = color((1.0, 0.8 - 0.6 * force / maximum, 0.1, 1.0))
+ draw.add_line(vec(x, top), vec(x, tip - 5), shade, thickness=2.0)
+ draw.add_triangle_filled(vec(x, tip), vec(x - 4, tip - 7), vec(x + 4, tip - 7), shade)
+ ui.dummy((width, 92))
+ ui.text(f"Peak strip: {self.display_strips.max():.1f} N")
+ ui.text("Arrow lengths relative to peak")
+ ui.text("Live pressure footprint")
+ origin = ui.get_cursor_screen_pos()
+ height = width * (X1 - X0) / (Y1 - Y0)
+ for ix in range(16):
+ for iy in range(14):
+ t = float(np.clip(self.display_footprint[ix, iy] / 100000.0, 0.0, 1.0))
+ rgb = (t, 0.08 + 0.65 * np.sin(np.pi * t), 0.18 + 0.65 * (1.0 - t) * min(t * 8, 1.0))
+ x, y = origin.x + iy * width / 14, origin.y + (15 - ix) * height / 16
+ draw.add_rect_filled(vec(x, y), vec(x + width / 14 + 0.5, y + height / 16 + 0.5), color((*rgb, 1.0)))
+ ui.dummy((width, height))
+ ui.text("0 (dark) 100+ kPa (red)")
+
+ def force_overlay(self, ui):
+ size = ui.get_io().display_size
+ ui.set_next_window_pos((size.x - 16, size.y - 16), pivot=(1.0, 1.0))
+ ui.set_next_window_bg_alpha(0.85)
+ flags = (
+ ui.WindowFlags_.no_decoration
+ | ui.WindowFlags_.always_auto_resize
+ | ui.WindowFlags_.no_saved_settings
+ | ui.WindowFlags_.no_move
+ | ui.WindowFlags_.no_focus_on_appearing
+ | ui.WindowFlags_.no_nav
+ )
+ ui.begin("Roller contact forces", flags=flags)
+ load, area = self.display_stats[3:5]
+ ui.text("ROLLER / LAMINATE CONTACT")
+ ui.text(f"Normal load: {load:7.1f} N")
+ ui.text(f"Peak pressure: {self.display_stats[2] / 1000:6.1f} kPa")
+ mean_pressure = load / area / 1000 if area > 0 else 0.0
+ ui.text(f"Mean loaded pressure: {mean_pressure:6.1f} kPa")
+ self.force_graphic(ui)
+ if self.force_history:
+ history = np.asarray(self.force_history, dtype=np.float32)
+ ui.plot_lines(
+ "##normal_load",
+ history,
+ graph_size=(260, 60),
+ scale_min=0.0,
+ scale_max=max(100.0, float(history.max()) * 1.1),
+ overlay_text="Normal load (N)",
+ )
+ ui.end()
+
+ def test_final(self):
+ a = self.attachment.numpy()
+ assert np.isfinite(self.state_0.particle_q.numpy()).all(), "Non-finite roller state"
+ assert np.isfinite(self.state_0.body_q.numpy()).all(), "Non-finite robot state"
+ assert np.all((a >= 0) & (a <= 1)), "Invalid adhesion field"
+ newton.eval_ik(self.model, self.state_0, self.state_0.joint_q, self.state_0.joint_qd)
+ error = np.max(np.abs(self.state_0.joint_q.numpy() - self.ik_q.numpy()[0]))
+ assert error < 0.10, f"Robot tracking error: {error:.3f} rad"
+ assert int(self.contacts.soft_contact_count.numpy()[0]) <= self.contacts.soft_contact_max
+
+ if self.clearance >= 0.08:
+ assert np.max(a) == 0, "Film bonded without roller contact"
+ assert self.stats.numpy()[3] == 0, "Nonzero laminate load with lifted roller"
+ elif self.sim_time >= 2.0 * (CYCLE_TIME + LANES) + APPROACH_TIME + 3.0:
+ assert np.all(a >= 0.999), f"Incomplete coverage: {np.mean(a >= 0.999):.2%}"
+ elif self.sim_time >= 20.0:
+ assert np.max(a) > 0.99, "Roller did not bond any film"
+ print(
+ f"Laminate test passed: {self.sim_time:.1f}s, bonded={np.mean(a >= 0.999):.2%}, "
+ f"min={a.min():.3f}, mean={a.mean():.3f}, CUDA graph={self.graph is not None}"
+ )
+
+ @staticmethod
+ def create_parser():
+ parser = examples.create_parser()
+ parser.add_argument(
+ "--roller-clearance",
+ type=float,
+ default=0.0,
+ help="Extra roller lift in meters; 0.10 tests that no contact means no bonding.",
+ )
+ return parser
+
+
+if __name__ == "__main__":
+ viewer, args = examples.init(Example.create_parser())
+ example = Example(viewer, args)
+ examples.run(example, args)
diff --git a/examples/extended_simulation/industrial_lamination/images/preview.jpg b/examples/extended_simulation/industrial_lamination/images/preview.jpg
new file mode 100644
index 0000000..1311ee6
Binary files /dev/null and b/examples/extended_simulation/industrial_lamination/images/preview.jpg differ
diff --git a/examples/extended_simulation/industrial_lamination/tests/__init__.py b/examples/extended_simulation/industrial_lamination/tests/__init__.py
new file mode 100644
index 0000000..52a7a9d
--- /dev/null
+++ b/examples/extended_simulation/industrial_lamination/tests/__init__.py
@@ -0,0 +1,2 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
diff --git a/examples/extended_simulation/industrial_lamination/tests/test_ur5e_laminate.py b/examples/extended_simulation/industrial_lamination/tests/test_ur5e_laminate.py
new file mode 100644
index 0000000..73bed90
--- /dev/null
+++ b/examples/extended_simulation/industrial_lamination/tests/test_ur5e_laminate.py
@@ -0,0 +1,401 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 The Newton Developers
+# SPDX-License-Identifier: Apache-2.0
+
+import newton
+import numpy as np
+import pytest
+import warp as wp
+
+from examples.extended_simulation.industrial_lamination import example_ur5e_laminate as demo
+
+
+def test_lamination_is_discoverable():
+ from examples import get_examples
+
+ assert get_examples()["ur5e_laminate"] == demo.__name__
+
+
+def test_windshield_triangles_face_outward():
+ vertices, indices = demo.grid_mesh(np.linspace(demo.X0, demo.X1, 7), np.linspace(demo.Y0, demo.Y1, 9))
+ triangles = vertices[indices.reshape(-1, 3)]
+ normals = np.cross(triangles[:, 1] - triangles[:, 0], triangles[:, 2] - triangles[:, 0])
+ assert np.all(normals[:, 2] > 0), "Collision surface must face the roller"
+ raised, raised_indices = demo.grid_mesh(
+ np.linspace(demo.X0, demo.X1, 7), np.linspace(demo.Y0, demo.Y1, 9), offset=0.0008
+ )
+ np.testing.assert_array_equal(raised_indices, indices)
+ np.testing.assert_allclose(raised[:, :2], vertices[:, :2])
+ np.testing.assert_allclose(raised[:, 2] - vertices[:, 2], 0.0008, atol=3e-8)
+
+
+def test_roller_tetrahedra_fill_cylinder_without_inversion():
+ vertices, indices = demo.roller_mesh()
+ tets = vertices[indices]
+ volumes = (
+ np.linalg.det(np.stack((tets[:, 1] - tets[:, 0], tets[:, 2] - tets[:, 0], tets[:, 3] - tets[:, 0]), axis=-1))
+ / 6.0
+ )
+ assert np.all(volumes > 0), "VBD requires nondegenerate, consistently oriented tetrahedra"
+ assert volumes.sum() == pytest.approx(np.pi * demo.RADIUS**2 * demo.WIDTH, rel=0.02)
+ np.testing.assert_allclose(np.ptp(vertices[:, 1]), demo.WIDTH)
+ assert np.max(np.linalg.norm(vertices[:, [0, 2]], axis=1)) == pytest.approx(demo.RADIUS)
+
+
+@pytest.mark.cuda
+def test_headless_first_sweep_adheres_over_90_percent(cuda_device, monkeypatch):
+ from types import SimpleNamespace
+
+ from newton.viewer import ViewerNull
+
+ monkeypatch.delenv("DISPLAY", raising=False)
+ monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)
+ example = demo.Example(ViewerNull(), SimpleNamespace(roller_clearance=0.0))
+ np.testing.assert_array_equal(example.attachment.numpy(), 0.0)
+ example.render()
+
+ # One pass means a full windshield sweep, ending after the eighth stroke
+ # and before the return or any second-sweep pressure can improve coverage.
+ sweep_end = (demo.LANES - 1) * (demo.PASS_TIME + demo.TURN_TIME) + demo.PASS_TIME
+ # Allow bounded time for approach and contact settling at each landing.
+ max_frames = int((demo.APPROACH_TIME + sweep_end + 10.0 * demo.LANES) / example.frame_dt)
+ for _ in range(max_frames):
+ example.step()
+ clock = example.clock.numpy()
+ if clock[2] >= sweep_end or clock[1] >= 0.0:
+ break
+ else:
+ pytest.fail(f"First sweep did not finish: path time={clock[2]:.2f}s, settled={clock[4]}")
+
+ adhered = np.mean(example.attachment.numpy() >= 0.999)
+ assert adhered > 0.90, f"Only {adhered:.2%} of the windshield adhered after the first sweep"
+ example.render()
+ example.test_final()
+
+
+@pytest.mark.cuda
+def test_public_contact_wrench_sign_offset_filter_and_stale_rows(cuda_device):
+ # Two rigid-capacity rows precede the soft rows. Torque and tangential
+ # force must not contribute to compressive normal load.
+ wrenches = wp.array(
+ [
+ [0, 0, -999, 0, 0, 0],
+ [0, 0, -999, 0, 0, 0],
+ [3, 4, -10, 100, 200, 300],
+ [0, 0, -20, 0, 0, 0],
+ [0, 0, 5, 0, 0, 0],
+ [0, 0, -99, 0, 0, 0],
+ ],
+ dtype=wp.spatial_vector,
+ )
+ count = wp.array([3], dtype=int)
+ shapes = wp.array([7, 8, 7, 7], dtype=int)
+ normals = wp.array([[0, 0, 1]] * 4, dtype=wp.vec3)
+ forces = wp.full(4, 123.0, dtype=float)
+ wp.launch(demo.read_contact_forces, 4, [count, shapes, normals, wrenches, 2, 7, forces])
+ np.testing.assert_array_equal(forces.numpy(), [10, 0, 0, 0])
+ count.zero_()
+ wp.launch(demo.read_contact_forces, 4, [count, shapes, normals, wrenches, 2, 7, forces])
+ np.testing.assert_array_equal(forces.numpy(), 0)
+
+
+@pytest.mark.cuda
+def test_vbd_observables_feed_bonding_inside_cuda_graph(cuda_device):
+ builder = newton.ModelBuilder()
+ glass = builder.add_ground_plane()
+ builder.add_particle(pos=wp.vec3(0.54, 0.0, 0.045), vel=wp.vec3(), mass=1.0, radius=0.05)
+ builder.color()
+ model = builder.finalize()
+ pipeline = newton.CollisionPipeline(model)
+ contacts = pipeline.contacts()
+ solver = demo.SolverVBD(model)
+ observables = solver.observables(kinds={solver.ObservableKind.CONTACT_F}, contacts=contacts)
+ state_in, state_out = model.state(), model.state()
+ forces = wp.zeros(contacts.soft_contact_max)
+ pressure = wp.zeros(demo.NX * demo.NY)
+ bond = wp.zeros_like(pressure)
+ dose = wp.full(demo.NX * demo.NY, 5000.0)
+
+ with wp.ScopedCapture() as capture:
+ pipeline.collide(state_in, contacts)
+ solver.step(state_in, state_out, None, contacts, 1.0 / 480, observables=observables)
+ wp.launch(
+ demo.read_contact_forces,
+ contacts.soft_contact_max,
+ [
+ contacts.soft_contact_count,
+ contacts.soft_contact_shape,
+ contacts.soft_contact_normal,
+ observables.contact_f,
+ contacts.rigid_contact_max,
+ glass,
+ forces,
+ ],
+ )
+ pressure.zero_()
+ wp.launch(
+ demo.distribute_pressure,
+ contacts.soft_contact_max,
+ [contacts.soft_contact_count, contacts.soft_contact_body_pos, forces, pressure],
+ )
+ wp.launch(demo.update_attachment, demo.NX * demo.NY, [pressure, bond, dose, 1.0 / 480])
+ wp.capture_launch(capture.graph)
+ assert contacts.soft_contact_count.numpy()[0] > 0
+ assert forces.numpy().sum() > 0
+ assert pressure.numpy().max() > 200
+ assert bond.numpy().max() > 0
+ # Replay with a separated particle: exported forces and pressure must clear,
+ # while the persistent bond field remains unchanged.
+ before = bond.numpy().copy()
+ state_in.particle_q.assign(np.array([[0.54, 0, 1]], dtype=np.float32))
+ state_in.particle_qd.zero_()
+ wp.capture_launch(capture.graph)
+ assert not observables.contact_f.numpy().any()
+ assert not forces.numpy().any()
+ assert not pressure.numpy().any()
+ np.testing.assert_array_equal(bond.numpy(), before)
+
+
+@pytest.mark.cuda
+def test_contact_pressure_is_local_and_conserves_force(cuda_device):
+ count = wp.array([1], dtype=int)
+ points = wp.array([wp.vec3(0.54, 0.0, 0.32)], dtype=wp.vec3)
+ forces = wp.array([10.0], dtype=float)
+ pressure = wp.zeros(demo.NX * demo.NY, dtype=float)
+ wp.launch(demo.distribute_pressure, 1, [count, points, forces, pressure])
+ p = pressure.numpy().reshape(demo.NX, demo.NY)
+ x = np.linspace(demo.X0, demo.X1, demo.NX)[:, None]
+ y = np.linspace(demo.Y0, demo.Y1, demo.NY)[None, :]
+ dx = (demo.X1 - demo.X0) / (demo.NX - 1)
+ dy = (demo.Y1 - demo.Y0) / (demo.NY - 1)
+ areas = dx * dy * np.sqrt(1 + (x - 0.68) ** 2 + (1.1 * y) ** 2)
+ assert np.sum(p * areas) == pytest.approx(10.0, rel=1e-5)
+ assert np.all(p[(x - 0.54) ** 2 + y**2 > 0.0121**2] == 0)
+ # An inactive/stale contact buffer must never contribute pressure.
+ count.zero_()
+ pressure.zero_()
+ wp.launch(demo.distribute_pressure, 1, [count, points, forces, pressure])
+ assert np.all(pressure.numpy() == 0)
+
+
+@pytest.mark.cuda
+def test_attachment_retains_bond_without_pressure_and_saturates(cuda_device):
+ bond = wp.array([0.0, 0.5, 0.0, 0.99], dtype=float)
+ pressure = wp.array([0.0, 0.0, 200.0, 20200.0], dtype=float)
+ dose = wp.full(4, 10000.0, dtype=float)
+ wp.launch(demo.update_attachment, 4, [pressure, bond, dose, 1.0])
+ np.testing.assert_allclose(bond.numpy(), [0.0, 0.5, 0.0, 1.0])
+
+
+@pytest.mark.cuda
+def test_raster_turns_have_no_position_jump(cuda_device):
+ stats = wp.zeros(3, dtype=float)
+ position = wp.zeros(1, dtype=wp.vec3)
+ rotation = wp.zeros(1, dtype=wp.vec4)
+ # Both sides of every pass/turn boundary, including the cycle wrap.
+ for lane in range(demo.LANES):
+ for boundary in (
+ lane * (demo.PASS_TIME + demo.TURN_TIME) + demo.PASS_TIME,
+ demo.CYCLE_TIME if lane == demo.LANES - 1 else (lane + 1) * (demo.PASS_TIME + demo.TURN_TIME),
+ ):
+ positions = []
+ for offset in (-1e-4, 1e-4):
+ clock = wp.array([10.0, -1.0, boundary + offset, 1.0, 1.0, 0.0], dtype=float)
+ wp.launch(demo.trajectory, 1, [clock, stats, 0.0, position, rotation])
+ positions.append(position.numpy()[0])
+ assert np.linalg.norm(positions[1] - positions[0]) < 0.0001
+
+
+@pytest.mark.cuda
+def test_tougher_patch_requires_repeated_pressure(cuda_device):
+ bond = wp.zeros(2, dtype=float)
+ pressure = wp.array([20200.0, 20200.0], dtype=float)
+ dose = wp.array([20000.0, 60000.0], dtype=float)
+ wp.launch(demo.update_attachment, 2, [pressure, bond, dose, 1.0])
+ np.testing.assert_allclose(bond.numpy(), [1.0, 1.0 / 3.0])
+ for _ in range(2):
+ wp.launch(demo.update_attachment, 2, [pressure, bond, dose, 1.0])
+ np.testing.assert_allclose(bond.numpy(), [1.0, 1.0])
+
+
+@pytest.mark.cuda
+def test_hud_integrates_laminate_force(cuda_device):
+ count = wp.array([1], dtype=int)
+ points = wp.array([wp.vec3(0.54, 0.0, 0.32)], dtype=wp.vec3)
+ forces = wp.array([10.0], dtype=float)
+ pressure = wp.zeros(demo.NX * demo.NY, dtype=float)
+ bond = wp.zeros_like(pressure)
+ uvs = wp.zeros(demo.NX * demo.NY, dtype=wp.vec2)
+ stats = wp.zeros(5, dtype=float)
+ wp.launch(demo.distribute_pressure, 1, [count, points, forces, pressure])
+ wp.launch(demo.update_display, demo.NX * demo.NY, [bond, pressure, uvs, stats])
+ assert stats.numpy()[3] == pytest.approx(10.0, rel=1e-5)
+ pressure.zero_()
+ stats.zero_()
+ wp.launch(demo.update_display, demo.NX * demo.NY, [bond, pressure, uvs, stats])
+ np.testing.assert_array_equal(stats.numpy()[2:], 0.0)
+
+
+@pytest.mark.cuda
+def test_force_graphic_preserves_load_and_pressure_peaks(cuda_device):
+ pressure = wp.zeros(demo.NX * demo.NY, dtype=float)
+ wp.launch(
+ demo.distribute_pressure,
+ 1,
+ [
+ wp.array([1], dtype=int),
+ wp.array([wp.vec3(0.54, 0.0, 0.32)], dtype=wp.vec3),
+ wp.array([10.0], dtype=float),
+ pressure,
+ ],
+ )
+ body = wp.array([wp.transform_identity()], dtype=wp.transform)
+ strips, footprint = wp.zeros(12), wp.zeros(16 * 14)
+ wp.launch(demo.reduce_force_graphic, demo.NX * demo.NY, [pressure, body, 0, strips, footprint])
+ assert strips.numpy().sum() == pytest.approx(10.0, rel=1e-5)
+ expected = pressure.numpy().reshape(16, 8, 14, 8).max(axis=(1, 3))
+ np.testing.assert_array_equal(footprint.numpy().reshape(16, 14), expected)
+ pressure.zero_()
+ strips.zero_()
+ footprint.zero_()
+ wp.launch(demo.reduce_force_graphic, demo.NX * demo.NY, [pressure, body, 0, strips, footprint])
+ assert not strips.numpy().any()
+ assert not footprint.numpy().any()
+
+
+@pytest.mark.cuda
+def test_rolling_waits_for_sustained_settled_contact(cuda_device):
+ clock = wp.array([demo.APPROACH_TIME, -1.0, 0.0, 0.0, 0.0, 10.0], dtype=float)
+ stats = wp.array([0.0, 0.0, 0.0, 10.0, 0.0], dtype=float)
+ speed = wp.array([0.05], dtype=float)
+ for _ in range(120):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, 1.0 / 60.0])
+ assert clock.numpy()[2] == 0 # A fixed delay cannot bypass continued bouncing.
+ speed.zero_()
+ for _ in range(30):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, 1.0 / 60.0])
+ assert clock.numpy()[4] == 0
+ stats.assign(np.array([0, 0, 0, 100, 0], dtype=np.float32))
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, 1.0 / 60.0])
+ assert clock.numpy()[3] == 0 # A force spike restarts the quiet interval.
+ for _ in range(61):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, 1.0 / 60.0])
+ assert clock.numpy()[4] == 1
+ assert clock.numpy()[2] > 0
+
+
+@pytest.mark.cuda
+def test_settling_requires_contact(cuda_device):
+ clock = wp.array([demo.APPROACH_TIME, -1.0, 0.0, 0.0, 0.0, 0.0], dtype=float)
+ stats, speed = wp.zeros(5), wp.zeros(1)
+ for _ in range(120):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, 1.0 / 60.0])
+ assert clock.numpy()[4] == 0
+ assert clock.numpy()[2] == 0
+
+
+@pytest.mark.cuda
+def test_compact_tool_reaches_entire_windshield_path(cuda_device):
+ from types import SimpleNamespace
+
+ from newton.viewer import ViewerNull
+
+ example = demo.Example(ViewerNull(), SimpleNamespace(roller_clearance=0.0))
+ assert example.model.joint_coord_count == 6
+ # The baked tool frame must match the attachment site in the pinned USD.
+ site = next(i for i, label in enumerate(example.model.shape_label) if label.endswith("/attachment_site"))
+ assert example.model.shape_body.numpy()[site] == example.wrist
+ flange = wp.transform(*example.model.shape_transform.numpy()[site])
+ # USD transform composition can leave roundoff in nominally zero components.
+ np.testing.assert_allclose(
+ wp.transform_get_translation(flange), wp.transform_get_translation(demo.TOOL_FRAME), atol=1e-7
+ )
+ assert abs(np.dot(wp.transform_get_rotation(flange), wp.transform_get_rotation(demo.TOOL_FRAME))) > 0.99999
+ for path_time in np.linspace(0.0, demo.CYCLE_TIME, 49):
+ example.clock.assign(np.array([10.0, -1.0, path_time, 1.0, 1.0, 0.0], dtype=np.float32))
+ wp.launch(demo.trajectory, 1, [example.clock, example.stats, 0.0, example.target_p, example.target_r])
+ example.ik_solver.step(example.ik_q, example.ik_q, iterations=100)
+ newton.eval_fk(example.model, example.ik_q.flatten(), example.model.joint_qd, example.state_0)
+ wrist = wp.transform(*example.state_0.body_q.numpy()[example.wrist])
+ center = np.asarray(wp.transform_point(wrist * demo.TOOL_FRAME, demo.TOOL_OFFSET))
+ error = np.linalg.norm(center - example.target_p.numpy()[0])
+ tool_rotation = np.asarray(wp.transform_get_rotation(wrist * demo.TOOL_FRAME))
+ assert abs(np.dot(tool_rotation, example.target_r.numpy()[0])) > 0.99999
+ assert error < 0.002, f"Unreachable roller target at path time {path_time:.2f}: {error:.4f} m"
+
+
+@pytest.mark.cuda
+def test_captured_demo_establishes_contact_and_starts_bonding(cuda_device):
+ from types import SimpleNamespace
+
+ from newton.viewer import ViewerNull
+
+ example = demo.Example(ViewerNull(), SimpleNamespace(roller_clearance=0.0))
+ assert example.graph is not None
+ for _ in range(600):
+ example.step()
+ clock = example.clock.numpy()
+ assert clock[4] == 1.0, "Roller never established sustained, settled contact"
+ assert clock[2] > 1.0, "Captured controller did not start the raster"
+ assert example.stats.numpy()[3] > 1.0
+ assert example.attachment.numpy().max() >= 0.999
+ assert example.contacts.soft_contact_count.numpy()[0] < example.contacts.soft_contact_max
+ example.test_final()
+ # At 14 s the first stroke is over and the roller traverses above the glass.
+ for _ in range(240):
+ example.step()
+ assert example.stats.numpy()[3] == 0.0
+ bond = example.attachment.numpy().copy()
+ for _ in range(15):
+ example.step()
+ np.testing.assert_array_equal(example.attachment.numpy(), bond)
+ for _ in range(345):
+ example.step()
+ assert example.clock.numpy()[2] > demo.PASS_TIME + demo.TURN_TIME
+ assert example.clock.numpy()[4] == 1.0
+ assert example.stats.numpy()[3] > 1.0
+
+
+@pytest.mark.cuda
+@pytest.mark.parametrize("lane", [0, demo.LANES - 1])
+def test_transfer_lifts_before_moving_and_lowers_at_next_lane(cuda_device, lane):
+ stats, position, rotation = wp.zeros(5), wp.zeros(1, dtype=wp.vec3), wp.zeros(1, dtype=wp.vec4)
+ start = lane * (demo.PASS_TIME + demo.TURN_TIME) + demo.PASS_TIME
+ duration = demo.RETURN_TIME if lane == demo.LANES - 1 else demo.TURN_TIME
+
+ def target(t):
+ clock = wp.array([10.0, -1.0, t, 0.0, 1.0, 0.0], dtype=float)
+ wp.launch(demo.trajectory, 1, [clock, stats, 0.0, position, rotation])
+ return position.numpy()[0].copy()
+
+ down = target(start)
+ raised = target(start + demo.LIFT_TIME)
+ before_lower = target(start + duration - demo.LOWER_TIME)
+ landed = target(start + duration)
+ assert np.linalg.norm(raised - down) == pytest.approx(demo.TRANSFER_LIFT, abs=1e-5)
+ assert np.linalg.norm(before_lower - landed) == pytest.approx(demo.TRANSFER_LIFT, abs=1e-5)
+ # The departure and arrival segments follow the local normal, without sliding.
+ lift_direction = (raised - down) / np.linalg.norm(raised - down)
+ assert np.linalg.norm(np.cross(target(start + demo.LIFT_TIME / 2) - down, lift_direction)) < 1e-5
+ lower_direction = (before_lower - landed) / np.linalg.norm(before_lower - landed)
+ assert np.linalg.norm(np.cross(target(start + duration - demo.LOWER_TIME / 2) - landed, lower_direction)) < 1e-5
+ assert np.linalg.norm(before_lower - raised) > 0.05
+
+
+@pytest.mark.cuda
+@pytest.mark.parametrize("boundary", [demo.PASS_TIME + demo.TURN_TIME, demo.CYCLE_TIME])
+def test_each_landing_rearms_the_contact_settling_gate(cuda_device, boundary):
+ dt = 1.0 / 60.0
+ clock = wp.array([30.0, -1.0, boundary - dt / 2, 1.0, 1.0, 100.0], dtype=float)
+ stats = wp.array([0, 0, 0, 100, 0], dtype=float)
+ speed = wp.array([0.1], dtype=float)
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, dt])
+ assert clock.numpy()[2] == pytest.approx(boundary)
+ assert clock.numpy()[4] == 0
+ for _ in range(120):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, dt])
+ assert clock.numpy()[2] == pytest.approx(boundary)
+ speed.zero_()
+ for _ in range(61):
+ wp.launch(demo.advance_path, 1, [clock, stats, speed, 0.0, dt])
+ assert clock.numpy()[4] == 1
+ assert clock.numpy()[2] > boundary