Robotic Systems

Robotic Systems · teaching-draft · v0.2.0

Collision detection and contact geometry

Lecture 11 · Week 6 · 90 minutes

Learning outcomes

  • Explain broad-phase and narrow-phase collision detection.
  • Interpret contact points, normals, and distances.
  • Separate geometric detection from force response.

Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.

Geometry before forces

Collision detection asks which shapes are close or intersecting and how to describe their local geometry. Contact response asks what forces or impulses should result. A detection algorithm can return an accurate distance while a poor response model produces unrealistic motion.

Broad-phase methods cheaply reject distant pairs, often using bounding volumes and spatial organization. Narrow-phase methods examine the remaining shape pairs in detail. Primitive pairs can have specialized formulas. Convex methods such as GJK reason about support points of the Minkowski difference; penetration-depth methods such as EPA extend that geometric picture. This lecture focuses on their role rather than implementing a production collision library.

Contact data

A contact description includes a point, a normal or local contact frame, signed distance, and the participating geometries. Sign and frame conventions are engine-specific. Geometry contact candidates do not always become active force constraints. A positive-distance contact within a margin may be useful for prediction or stabilization.

Multiple contacts approximate an extended contact patch. Their number and location affect the resulting wrench and solver workload. Replacing a box by a sphere changes contact geometry even when mass and inertia stay equal.

Worked sphere-plane distance

For a sphere of radius r centered at height z above a horizontal plane at zero, signed gap is ϕ=z−r\phi=z-r. With r=0.1r=0.1 m and z=0.08z=0.08 m, ϕ=−0.02\phi=-0.02 m indicates 2 cm geometric penetration. This number alone does not determine force. A compliant response also needs stiffness-like parameters and normal velocity.

At z=0.12z=0.12 m, gap is positive. A configured contact margin can still cause the engine to report a candidate, so contact count alone is not a binary collision verdict.

MuJoCo inspection

Practice 6 drops and slides a body on a plane. After refreshing dynamics, inspect ncon and data.contact. Use the contact index with mj_contactForce to retrieve a wrench in the contact frame. Do not add these local components directly to a world-frame force sum.

Compare geometric penetration, active forces, and motion on separate traces. Rendering contact points is useful for inspection, but headless numerical output remains the reproducible record.

Exercise

Two models have identical inertias but different collision meshes. Should their contact trajectories agree? Answer: not generally. Geometry changes normals, distances, contact locations, and lever arms. To compare solver behavior, first hold geometry and inertial properties fixed.

As an extension, replace a primitive with a convex approximation and measure both contact count and runtime. Explain whether changed behavior comes from approximation quality, response parameters, or numerical resolution.

Reading and source connections

Advanced Robot Dynamics and Simulation — lecture series — CMU 16-715. Companion video series for modeling, integration, rigid-body dynamics, constraints, and contact.

MuJoCo computation — MuJoCo contributors. Authoritative force, generalized-coordinate, actuator, and constraint conventions.

Robotic Manipulation — online notes — Russ Tedrake. Further reading on contact-rich manipulation and learned policies; source notation is translated explicitly.