Overview#

SAP Warp is a Warp-based implementation of the SAP contact formulation from An Unconstrained Convex Formulation of Compliant Contact with additional improvements for robust, stable, and efficient simulation of frictional contact for robotics. The project follows Drake’s implementation as a reference and exposes a compact Python/Warp runtime for scene loading, collision generation, solver benchmarking, and visualization.

Learn More

Start with Quick Start for a first run. For the solver behavior and runtime options, read Solver.

Core Concepts#

  • load_sap_scene() turns YAML/JSON scene files, imported assets, inline bodies, and post-build edits into runtime arrays.

  • SapModel stores articulated topology, body inertia, materials, drives, limits, and shape metadata consumed by the solver.

  • SapState stores generalized positions, generalized velocities, body poses, body velocities, and external body forces.

  • SapControl stores direct generalized forces, targets, and actuator arrays.

  • SapCollisionPipeline generates active contacts from the collision model and current body poses.

  • SolverSAP advances one timestep from state_in to state_out.

The runtime is easiest to read as one loop. Load a scene once, allocate two states, allocate one control object, allocate one contact buffer, then repeat: clear forces, refresh contacts from the current poses, solve one SAP timestep, and swap the state buffers. Most public APIs exist to support one step in that loop; lower-level Newton-derived kernels are intentionally left out of the main reference unless they are useful for debugging the SAP path.

Where to Go Next#

  • User Guide - Installation sets up the repository environment, and Quick Start runs a first scene and steps from Python.

  • Concepts - Convention, Loader, Collision, and Solver explain runtime conventions, scene schema, contact generation, and solver behavior.

  • Benchmarking - Benchmarking covers the command-line benchmark workflow and runtime sizing.

  • Visualization - Viser Viewer inspects scenes interactively and records MP4 videos with Viser.

  • Reference - API Reference lists public and semi-public entry points.