Skip to content

The physical AI stack

A robot is a stack of loops: fast ones that hold a joint where it should be, slower ones that decide where it should be.

A robot that picks up a cube or walks across a room runs several layers of software at once. Each layer has its own job, its own rate and its own failure modes. This book teaches them bottom-up, in the order you need them.

LayerJobTypical toolsBook
Physics and simulationPredict how bodies move and collideMuJoCo, MJCF/URDF modelsPart 1
GeometryDescribe where things are and how they are orientedRotation matrices, quaternions, transformsPart 2
KinematicsMap joint angles to the gripper pose and backFK, Jacobians, IKPart 3
Low-level controlTurn a target into motor torques, safelyPD/PID, servos, impedance control, limitsPart 4
State estimation and perceptionTurn noisy sensors and pixels into a stateFilters, Kalman filter, camera calibration, detectionPart 5
Planning and optimal controlFind feasible motions, optimize controlsRRT, trajectory optimization, LQR, MPCPart 6
Learned policiesMap observations to actions from data or rewardBehavior cloning, ACT, diffusion policies, PPOParts 7–8
DeploymentMake sim-trained behavior work on hardwareLatency handling, system identification, domain randomization, LeRobotPart 9
Task layerDecide what to do from language and contextVLAs, LLM agents with robot tools, world modelsPart 10

Lower layers run faster than higher ones. Two concrete examples used in this book:

  • In Unitree’s open training code for the Go2, the learned policy picks new joint targets every 20 ms (50 Hz) while a PD rule turns them into torques every 5 ms (sim.dt = 0.005, decimation = 4 in legged_robot_config.py). Lesson 12 uses these numbers.
  • LeRobot records demonstrations on the SO-101 at about 30 frames per second (LeRobot docs); the servos close their own position loop inside the motor (lesson 12).

On real robots the layers usually run as separate processes that exchange messages; ROS 2 is the most common middleware for that (nodes, topics, services, actions). This book keeps every experiment in a single Python process with MuJoCo so the algorithms stay visible; the same algorithms are what you would put inside ROS 2 nodes. LeRobot, used in Parts 7 and 9, talks to the SO-101 directly over its serial bus.

RobotWhat it isModel
SO-101Low-cost 6-motor arm (5 joints + gripper) used with LeRobotMenagerie robotstudio_so101
Franka Panda7-DoF research arm, used where redundancy or torque control mattersMenagerie franka_emika_panda
Unitree Go212-joint quadruped, used for control and locomotionMenagerie unitree_go2

All three models come from MuJoCo Menagerie and are fetched by experiments/common/menagerie.py.