Contact dynamics is the modeling and computation of the forces, friction and impulses that arise when two bodies touch, collide, slide or separate. In robotics simulation, it decides whether a simulated gripper holds an object, whether a legged robot’s foot slips and how a pushed box comes to rest, which makes it the most difficult and error-prone part of any physics engine used for robots.
Unlike smooth free-space motion, contact is non-smooth: forces switch on and off abruptly, friction changes between sticking and sliding, and impacts change velocities almost instantly. How a simulator approximates these effects largely determines its accuracy, speed and stability, and therefore how well simulated behavior transfers to real hardware.
How contact dynamics is computed in a simulator
Each simulation step resolves contact in a fixed sequence. First, collision detection finds which geometries overlap or nearly touch and produces contact points, normals and penetration depths. Then a contact solver computes forces or impulses that prevent interpenetration and respect friction, and finally the integrator advances positions and velocities.
Collision detection usually has a broad phase that discards distant pairs with bounding volumes and a narrow phase that computes exact contacts with algorithms such as GJK and EPA for convex shapes. The quality of the contact points is critical: a single missing or flickering point can make a grasp fail even when the solver itself is excellent.
The table below lists the main quantities a contact solver works with.
| Quantity | Meaning | Typical effect when wrong |
|---|---|---|
| Contact normal | Direction along which bodies push apart | Objects slide or bounce sideways |
| Penetration depth | How far shapes overlap | Visible sinking or explosive separation |
| Normal force | Push that prevents interpenetration | Objects fall through or jitter |
| Friction force | Tangential resistance to sliding | Grasps slip or feet skid |
| Restitution coefficient | Fraction of normal velocity kept after impact | Unrealistic bouncing or dead impacts |
Rigid, compliant and soft contact models
Simulators choose between three broad families of contact models, each with a different trade-off between physical fidelity and numerical behavior.
Rigid contact models treat bodies as perfectly hard and formulate contact as a complementarity problem: either the gap is zero and a force acts, or the gap is positive and the force is zero. Time-stepping formulations of this kind are solved as a linear or nonlinear complementarity problem with iterative methods such as projected Gauss-Seidel. Penalty or compliant models instead allow small penetration and apply a spring-damper force proportional to depth and velocity. Soft contact models, used for example in MuJoCo, solve a convex optimization problem that allows controlled softness and keeps the solution unique and smooth.
| Model family | Core idea | Strengths | Weaknesses |
|---|---|---|---|
| Rigid complementarity | Zero gap or zero force | No visible penetration | Expensive, may have no unique solution |
| Penalty spring-damper | Force grows with penetration | Simple and fast | Stiff springs need tiny time steps |
| Soft convex contact | Optimization with tunable softness | Stable, smooth, differentiable | Small, parameter-dependent penetration |
| Impulse-based | Instant velocity changes at impact | Good for sparse collisions | Weak for resting and stacked contacts |
No family is universally best. Grasping and manipulation usually benefit from stable soft or complementarity solvers, while large-scale reinforcement learning favors fast, parallel solvers that tolerate small errors in exchange for throughput.
Friction models and the friction cone
Most robot simulators use Coulomb friction, which limits the tangential force to the friction coefficient times the normal force. The set of allowed contact forces forms a friction cone; inside it the contact sticks, and on its boundary the contact slides. Many solvers replace the circular cone with a polyhedral pyramid approximation with four or more facets to keep the problem linear.
| Choice | Description | Practical consequence |
|---|---|---|
| Elliptic friction cone | Exact Coulomb limit in all tangential directions | Isotropic but nonlinear to solve |
| Pyramidal approximation | Cone replaced by flat facets | Faster, with direction-dependent bias |
| Torsional friction | Resists spinning about the normal | Prevents objects twisting in a pinch grasp |
| Rolling friction | Resists rolling of round objects | Stops balls and wheels rolling forever |
Friction coefficients for common robot materials typically lie between about 0.3 and 1.2, but real values depend on surface finish, contamination and load. Treating them as uncertain parameters rather than precise constants is usually more realistic.
How simulators and solver settings differ
Robot simulators such as MuJoCo, PyBullet, Gazebo, Webots and Isaac Sim expose different contact formulations and parameters. In practice, solver iterations, time step and contact softness influence results as much as the choice of engine.
| Setting | Typical range | Effect of increasing it |
|---|---|---|
| Time step | 0.5 to 10 ms | Faster simulation, less stable contacts |
| Solver iterations | 4 to 100 per step | More accurate forces, higher cost |
| Contact stiffness | Engine-specific units | Less penetration, more stiffness problems |
| Contact margin | Fractions of a millimeter to a few millimeters | Earlier detection, possible floating contacts |
A good rule is to change one parameter at a time and to validate against simple reference experiments, such as a block sliding down an incline or a ball dropped from a known height, before trusting complex scenes.
Limitations, artifacts and the sim-to-real gap
Contact dynamics is the largest single source of the sim-to-real gap in manipulation and locomotion. Real contacts involve deformation, micro-slip, surface texture and material hysteresis that rigid-body simulators approximate only coarsely.
- Jitter and creep: resting objects vibrate or slowly drift because of solver tolerance and insufficient iterations.
- Tunneling: thin or fast objects pass through each other when the time step is too large for the collision geometry.
- Energy gain: poorly tuned stiffness and damping inject energy, causing objects to jump or explode apart.
- Exploitable artifacts: reinforcement learning agents discover unrealistic contact tricks that fail on hardware.
Common mitigations include domain randomization of friction and stiffness, finer collision meshes or convex decomposition, smaller time steps around critical phases and hardware-in-the-loop validation. Differentiable contact models are also increasingly used to fit simulator parameters to real measurements.
A plain-language summary
Contact dynamics is how a computer works out what happens when things touch. When a robot hand squeezes a cup, the simulator must decide how hard the cup pushes back, whether it slips and whether it stays put.
It is a bit like a referee who must judge every bump and slide in a game, instantly and thousands of times per second. If the referee is sloppy, objects pass through each other or bounce wildly. Good contact modeling keeps virtual objects behaving like real ones, which matters because robots trained in simulation must later work in the real world.
An example from practice
A research team trains a parallel-jaw gripper in simulation to pick small plastic parts. The first policy reaches a very high grasp success rate in simulation but drops many parts on the real robot. Analysis shows that the simulator used a friction coefficient of 1.0 and a single contact point per finger, so parts never rotated inside the grasp.
The engineers switch to a soft contact model with torsional friction, reduce the time step from 5 ms to 2 ms and randomize friction between 0.4 and 0.9 during training. They also replace coarse collision boxes with convex decompositions of the real part meshes.
After retraining, the simulated success rate drops slightly, but the real-world success rate rises substantially and failures become predictable. The team concludes that a slightly harder, more realistic simulation produced a policy that transferred far better to hardware.