RobotGuide

Engineering practice · topic F1 · 40 hours

Physics simulation (MuJoCo / Isaac)

Trial and error in simulation costs three orders of magnitude less than crashing the real robot. Simulation is also the only realistic path to RL training.

Core stage · Intermediate
Algorithm · Proficient System software · Hands-on Embedded & controls · Aware Mechanical · Aware

Tools
Tools

What to learn

  • The modeling pipeline: from URDF to MJCF / USD, and which parameters you must fill in by hand
  • Contact models and solver parameters: friction, restitution, iteration count
  • Where the sim-to-real gap comes from: latency, friction, compliance, sensor noise
  • Cost estimation for parallel simulation and large-scale data collection

The lesson · plain words

Physical simulation is «faking the world with numerical integration»: every step of dt approximates real physics. Contact (collision, grasping) is where things blow up most easily — it is essentially an ultra-stiff spring, and a slightly too-large dt makes the numerics diverge.

This page builds your intuition for «step size and stability», the first lesson of all simulation work.

dt and explosions: contact is an ultra-stiff spring

Drag the sim-step slider below: make dt large and the ball instantly explodes off screen — the contact stiffness is Kc=40000 N/m, and dt must be small enough to resolve its oscillation period. That is the mathematical nature of a «sim explosion»: the numerical integrator cannot keep up with the fastest physical process.

Explicit Euler explodes most easily; implicit / semi-implicit Euler is far more stable — MuJoCo and Isaac both use semi-implicit internally. You do not need the derivation, but you must know «when it explodes, first cut dt or switch integrators».

Interactive figure · drag it and see

What this figure shows: a ball bouncing under a physics engine with a sim-step dt slider — at large dt the ball explodes out of the frame (blown up: dt too big, contact forces diverge), at small dt it settles stably as energy decays by the restitution coefficient, with readouts comparing a 1 kHz sim to the 1 kHz control loop. Takeaway: contact in a physics engine is an ultra-stiff spring; dt must be small enough to resolve it — dragging dt up and back once is the first daily lesson of a sim engineer.

Division of labor: MuJoCo vs Isaac

MuJoCo: accurate contact dynamics, small scenes, fast RL training — the academic standard. Isaac: thousands of GPU-parallel environments, photorealistic rendering, large-scale training — but its contact accuracy is below MuJoCo. Choose by task: fine manipulation research goes to MuJoCo, large-scale RL goes to Isaac.

A universal engineering calculation: one sim step must finish inside the real control period (1 kHz control → sim stepping at 1 kHz at minimum, plus rendering). A simulation that cannot hit real-time rate makes both training and validation untrustworthy.

Three uses of simulation, each with its own trap

① Algorithm validation (planning/control): the trap is an inaccurate model — do F2's system identification first. ② RL training: the trap is overfitting the sim — you need domain randomization (G5). ③ Regression testing: the trap is fragile scenarios — use fixed seeds so results are reproducible.

The acceptance question for any simulation system: «where does this sim differ from the real robot?» If you can list the differences (friction, latency, sensor noise), you understand simulation; if you cannot, you only know which buttons to press.

How deep to go

You can load a model in MuJoCo and run a control loop against it (MJCF or URDF + MJX); explain what dt, solver iteration count, and restitution each affect; and keep the sim stepping in sync with the control loop at a fixed rate. Only then do F2 and F3 connect.

Three questions — do you really get it?

1. What is the most common cause of a sim «exploding»?

  • ANot enough CPU
  • BA step size too large to resolve the stiff contact dynamics
  • CA mistake in the model file
Show answer

B. Contact = an ultra-stiff spring. Explicit integration is step-size sensitive; cut dt or switch to an implicit integrator.

2. Which simulator is the first choice for fine manipulation research (grasping, insertion)?

  • AIsaac (large parallel scenes)
  • BMuJoCo (contact accuracy)
  • CGazebo (richest ecosystem)
Show answer

B. MuJoCo's soft contact model accuracy is industry-recognized; Isaac's strength is massive parallelism and rendering.

3. What does a fixed random seed do in simulation regression testing?

  • ASpeeds up the simulation
  • BSaves memory
  • CMakes results reproducible — a failure you can reproduce is one you can fix
Show answer

C. The value of regression testing is reproducibility. Fixed seed + fixed scenario = a catchable bug.

Keep going deeper

Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.

How it fails in the field

  • Contact parameters filled in casually in sim; on the real robot the friction is completely wrong and it walks like it is on ice
  • Actuator latency not modeled in sim; the trained policy oscillates forever on hardware

You have learned enough when

You can import a robot you built yourself into a simulator and make it move on command, and you can list the three major differences between sim and hardware.

The Chinese edition carries the full topic page for Physics simulation (MuJoCo / Isaac), including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/F1/.