Learn / Practice

MuJoCo obstacle clearance: a point path is not a body path

EMBODIED-AI / EXPLORE · Engineering cases

Six contact trajectories compare direct, edge and clearance paths while separating geometry from controller tracking.

INTERMEDIATE · 9 MIN · UPDATED 2026-10-07 · FOCUSED READING

What was published after this article?

The original conclusions and next-step proposals are retained. These published follow-ups do not imply that every limitation has been resolved.

Related content

  1. Engineering cases

    Delayed MuJoCo feedback: can an old observation predict now?

    Twenty-four paired traces compare delay, position noise and constant-velocity prediction, retaining incomplete recoveries.

    9 MINPublished
On this page 4
Reproduce from a clean checkout · this article’s revision

Windows PowerShell with Python 3.12. Copy and run the whole block. Clone, checkout, installation or execution failures stop the block before auditing the wrong revision. Use a new directory: each article pins its own revision, and the first revision does not contain later experiments.

& {
  $ErrorActionPreference = 'Stop'
  function Assert-StudyCommand {
    if ($LASTEXITCODE -ne 0) { throw "Command failed ($LASTEXITCODE). Read the error before continuing." }
  }
  if (Test-Path -LiteralPath 'hohoo-embodied-agent-study-831789c2') { throw 'Study directory already exists. Choose a new location.' }
  git clone https://github.com/VirtualSelect/hohoo-embodied-agent.git 'hohoo-embodied-agent-study-831789c2'; Assert-StudyCommand
  Set-Location -LiteralPath 'hohoo-embodied-agent-study-831789c2'
  git checkout --detach 831789c2a1efb4564c4cfabc2298e48e16ada879; Assert-StudyCommand
  python -m venv .venv; Assert-StudyCommand
  $py = '.\.venv\Scripts\python.exe'
  & $py -m pip install -r requirements-lock.txt; Assert-StudyCommand
  & $py experiments/planar_reach/run.py --out outputs/my-run; Assert-StudyCommand
  & $py experiments/planar_reach/audit.py outputs/my-run; Assert-StudyCommand
}

Expect raw trajectories, summaries and audit results. The study directory includes the revision; an existing directory stops setup without replacing it. Adjacent articles may share a runner; check the article before rerunning. No model calls are made. Video replay is separate. For later manual commands, specify the interpreter in .venv again: the block-local $py variable is not retained.

Troubleshooting: a missing experiment directory usually means the wrong revision; import failures require checking the interpreter and environment. OpenGL errors concern rendering steps. On Linux/macOS use .venv/bin/python; those platforms have not been retested.

Inspect the pinned code ↗

Pinned code · Raw evidence · Lab record

The empty scene reaches its target. Add a box at x=0.3m while keeping the target at x=0.6m and the controller unchanged: mass 1kg, Kp=80, Kd=18, ±5N per axis. A direct path hits the wall. A path that merely clears it for a point also fails because the actuator has a 35mm radius.

Fixed path comparison

The wall has x half-width 40mm and y half-width h of either 40mm or 90mm.

Route Targets
direct (0.6,0)
corner (0.16,h), (0.44,h), then goal
clearance (0.16,h+0.1), (0.44,h+0.1), then goal

The controller advances within 15mm of a waypoint. The 100mm clearance is a fixed teaching choice, not an optimized or certified safety distance.

For a sphere, expanding obstacles by its radius converts body clearance into a point-path question. Tracking error adds another margin: inertia can cut corners or overshoot. This example uses fixed waypoints, not a general planner.

Actual contact results

Wall half-height Route Contact samples Final error Completion
40mm direct 1850 374.79mm No
40mm corner 1680 376.86mm No
40mm clearance 0 <0.01mm Yes
90mm direct 1850 374.79mm No
90mm corner 1670 385.19mm No
90mm clearance 0 <0.01mm Yes

Contact samples are 2ms states containing contact, not separate collision events. Sustained contact contributes many samples. No impact-force or hardware-damage conclusion follows.

Six recorded planar trajectories comparing edge and clearance paths

Both clearance routes pass; the other four fail. This supports the need for body clearance in this scene, not universal obstacle avoidance.

Inspect the right trajectory

Waypoints are controller targets; mj_step integrates actual position. The plot uses recorded x/y, not a drawing of intended targets. Direct motion should stop at the wall, corner motion should remain blocked, and clearance should travel above it. If a run passes through the wall, inspect contact masks before celebrating the planner.

Exercise: enlarge the sphere without changing waypoints. Compute the geometric clearance, account for the waypoint tolerance, then inspect actual contacts. Lower damping as a second exercise to see whether a geometrically valid path remains trackable.

Dynamic obstacles, articulated robot configurations, narrow passages and hardware safety are outside this study. Next: delayed noisy feedback.

Reproduce from a clean checkout

Python 3.12. The runner executes all three comparisons; each article discusses its own subset.

git clone https://github.com/VirtualSelect/hohoo-embodied-agent.git hohoo-embodied-agent-study
cd hohoo-embodied-agent-study
git checkout 831789c2a1efb4564c4cfabc2298e48e16ada879
python -m pip install -r requirements-lock.txt
python experiments/planar_reach/run.py --out outputs/my-run
python experiments/planar_reach/audit.py outputs/my-run
python experiments/planar_reach/plot.py outputs/my-run

Use a new output directory. Windows was exercised; Linux/macOS were not rerun. No model API or key is required. The source commit in the manifest precedes the evidence commit linked above; source hashes bind the executed files.

A note to your future selfBefore you move on, keep one thought of your own.

Your private reading note stays in this browser; it is never uploaded or published. Clearing browser data removes it, so export a copy to keep. This article’s translations share the same note.

Recommended next reading:Delayed MuJoCo feedback: can an old observation predict now? →

Related study material

EXPLORE / Getting started with embodied AI

Focused reading. Use the prerequisites and published follow-ups above to choose what to read next.

Related content

  1. LAB / 037

    MuJoCo obstacle clearance: a point path is not a body path

    Six contact trajectories compare direct, edge and clearance paths while separating geometry from controller tracking.

    Completed
  2. PROJECT / 003

    Hohoo Embodied Experiments

    Two MuJoCo teaching scenes—pick-and-place and planar force control—record contracts, tuning, clearance and delayed-feedback outcomes, including failures.

    Experiment
  3. Engineering cases

    A second MuJoCo scene: why does the actuator overshoot?

    Compare mass and PD damping in a planar force-controlled actuator, separating target crossing from stable completion.

    9 MINPublished

Return to core and focused reading →

View count unavailable

← All writing

Use actual size to read small chart labels.