Contact dynamics

On this page 7

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.

QuantityMeaningTypical effect when wrong
Contact normalDirection along which bodies push apartObjects slide or bounce sideways
Penetration depthHow far shapes overlapVisible sinking or explosive separation
Normal forcePush that prevents interpenetrationObjects fall through or jitter
Friction forceTangential resistance to slidingGrasps slip or feet skid
Restitution coefficientFraction of normal velocity kept after impactUnrealistic bouncing or dead impacts
Core quantities in contact computation

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 familyCore ideaStrengthsWeaknesses
Rigid complementarityZero gap or zero forceNo visible penetrationExpensive, may have no unique solution
Penalty spring-damperForce grows with penetrationSimple and fastStiff springs need tiny time steps
Soft convex contactOptimization with tunable softnessStable, smooth, differentiableSmall, parameter-dependent penetration
Impulse-basedInstant velocity changes at impactGood for sparse collisionsWeak for resting and stacked contacts
Comparison of contact model families

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.

ChoiceDescriptionPractical consequence
Elliptic friction coneExact Coulomb limit in all tangential directionsIsotropic but nonlinear to solve
Pyramidal approximationCone replaced by flat facetsFaster, with direction-dependent bias
Torsional frictionResists spinning about the normalPrevents objects twisting in a pinch grasp
Rolling frictionResists rolling of round objectsStops balls and wheels rolling forever
Typical friction modeling choices

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.

SettingTypical rangeEffect of increasing it
Time step0.5 to 10 msFaster simulation, less stable contacts
Solver iterations4 to 100 per stepMore accurate forces, higher cost
Contact stiffnessEngine-specific unitsLess penetration, more stiffness problems
Contact marginFractions of a millimeter to a few millimetersEarlier detection, possible floating contacts
Settings that shape contact behavior

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.