Perception, planning and AI

← Robot list · The basics

How a robot understands the world and decides what to do: sensors and vision, filtering noisy measurements, mapping and localisation, finding a path, planning the motion of an arm among obstacles, organising behaviours, and learning from data. Many robots from the previous courses become “autonomous” thanks to the ideas of this course.

The autonomy loop: sense, think, act

Autonomy is a loop with four questions. The lessons of this course follow them:

QuestionWhere do you find the answer?Lessons
What do I see?Sensors, vision, point clouds1, 2
Where am I, and what is around me?Filters, localisation, mapping (SLAM)3, 4
How do I get there?Path planning, motion planning5, 6
What should I do?Behaviours, task planning, learning, teams7, 8, 9

The result then goes to the control layer of the previous course.

1

Sensing the world: the sensors of a robot

12 min
You will learn

the main exteroceptive sensors, what each one is good at, and how to choose.

SensorWhat it givesStrengthsWeaknesses
Colour cameraA 2D image: colour, texture, text, shapes.Rich, cheap, works with deep learning.No direct distance; light-dependent; motion blur.
Stereo cameraTwo images give depth by triangulation.Passive, outdoors, long range.Needs texture; error grows fast with distance.
RGB-D / time-of-flight cameraAn image plus a distance for each pixel.Dense depth, indoors, short range: bin picking.Sunlight, shiny or black surfaces.
2D lidarA slice of distances all around (for example 270°, 10-40 Hz).Accurate, reliable: the standard of indoor mobile robots.Sees only one plane: misses a table edge.
3D lidarA cloud of 3D points, 360°.Long range, day and night: autonomous cars, outdoor robots.Cost, rain and fog, glass.
RadarDistance and speed with radio waves.Works in fog, rain, dust; measures speed directly.Coarse resolution.
Ultrasonic sensorA single distance (cone).Very cheap; sees glass.Wide beam, slow, soft materials absorb.
Tactile / force sensing skinContact position, pressure, slip.The only way to feel a grasp.Fragile, fewer products, complex wiring.
GNSS (GPS) + IMUGlobal position and attitude outdoors.Absolute reference; RTK gives centimetres.No signal indoors or between tall buildings.
Event camera, microphone, gas sensor…Very fast changes; sound; smells.Specialised tasks.Need special algorithms.

1.1 Depth from two cameras

Two cameras separated by a baseline B see the same point with a horizontal shift, the disparity d (in pixels). With the focal length f in pixels, the depth is Z = f B / d. The error in depth for a disparity error Δd is:

ΔZ ≈ Z² Δd / (f B)

Worked example

f = 700 px, B = 0.1 m, Δd = 0.5 px. At Z = 2 m: ΔZ = 4 × 0.5 / (700 × 0.1) ≈ 0.029 m = 3 cm. At Z = 5 m: 25 × 0.5 / 70 ≈ 0.18 m = 18 cm. The error grows with the square of the distance: a wider baseline helps, and stereo is for near and medium range.

1.2 Choosing sensors

RobotTypical sensors
Robot vacuumBumper, cliff sensors, 2D lidar or a camera, wheel odometry, IMU.
Warehouse AMR2D safety lidar, 3D camera, wheel encoders, IMU, QR floor markers.
Picking armRGB-D camera above the bin, force-torque sensor, suction vacuum sensor.
Autonomous carCameras, 3D lidar, radars, ultrasonic, GNSS+IMU, wheel speed.
DroneIMU, barometer, GNSS, downward optical flow, camera, sometimes lidar.
Remember
  • No sensor is perfect: combine sensors with different weaknesses (sensor fusion, lesson 3).
  • Always know the rate (Hz), the latency, the range, the field of view and the noise.
  • Sensors must be calibrated (lesson 2) and time-synchronised.

Key terms

  • lidar
  • stereo
  • RGB-D
  • baseline
  • disparity
  • field of view
  • sensor fusion
  • GNSS
Check yourself
  1. A stereo pair has f = 800 px, B = 0.12 m. A point has a disparity of 16 px. What is its depth?

    Z = f B / d = 800 × 0.12 / 16 = 6 m.

  2. Which sensor would you choose for a robot working outdoors in fog?

    Radar: radio waves go through fog, unlike light-based sensors.

  3. Why use two different kinds of sensors on a car?

    Their weaknesses are different (camera in the dark, lidar in rain): fusion keeps working when one fails.

2

Vision for robots: cameras, calibration, detection, visual servoing

14 min
You will learn

how a camera becomes a measuring instrument, how to link it to the robot, and how to detect and grasp objects.

2.1 The pinhole camera

A point of the world (X, Y, Z) in the camera frame (Z along the viewing direction) lands on the pixel:

u = fx X / Z + cx, v = fy Y / Z + cy

fx, fy (focal lengths in pixels) and (cx, cy) (optical centre) are the intrinsic parameters, with the lens distortion. One pixel at distance Z covers Z/f metres. For f = 800 px and Z = 1 m, a point 0.1 m to the right of the axis lands 80 px from the centre, and one pixel is 1.25 mm.

2.2 Calibration

  • Intrinsic calibration: film a checkerboard in many poses; the software finds f, c and the distortion.
  • Hand-eye calibration: where is the camera with respect to the robot? Eye-in-hand (camera on the flange): find the fixed transform flange → camera. Eye-to-hand (camera fixed in the cell): find base → camera. The robot sees a marker from several poses and the equation A X = X B is solved for the unknown transform X. Without it, a perfect detection gives a missed grasp.

Both use the homogeneous matrices of the modelling course: the object pose in the base frame = baseTflange · flangeTcamera · cameraTobject.

2.3 From pixels to objects

LevelTechniqueUse
Classic 2DThresholding, edges, blobs, template matching, markers (QR, ArUco, AprilTag).Controlled lighting, known parts, markers for calibration and localisation.
Deep learning 2DDetection (YOLO, DETR), segmentation (Mask R-CNN, SAM), classification.Varied objects, clutter, people, defects.
3DPoint clouds, plane fitting, clustering, ICP (align a model to the data), 6D pose estimation.Bin picking, depalletising, measuring.

2.4 Visual servoing

Instead of “see, compute the pose, move blindly”, visual servoing moves the robot while looking, so the error of calibration does not matter. The error e is computed in the image and driven to zero with the camera velocity vc:

vc = −λ L+ e

where L is the “interaction matrix” linking the image features to the camera velocity (it is also a Jacobian, and its pseudo-inverse is the same tool as in the course on singularities). Two families: IBVS (error measured in the image, robust to calibration, but the camera path can be odd) and PBVS (error in the 3D pose, straight camera path, but sensitive to calibration).

Remember
  • A camera measures directions well; depth needs a second view or a depth sensor.
  • Calibrate (intrinsics + hand-eye) before blaming the algorithm.
  • Deep learning finds what and where roughly; geometry (ICP, PnP) gives the precise pose; servoing closes the last centimetres.

Key terms

  • pinhole model
  • intrinsic parameters
  • hand-eye calibration
  • ArUco / AprilTag
  • ICP
  • object detection
  • visual servoing
Check yourself
  1. f = 600 px. A point at Z = 1.5 m and X = 0.3 m. Where is it in the image relative to the centre?

    u − cx = 600 × 0.3 / 1.5 = 120 px to the right.

  2. Why does a perfect detection still produce a missed grasp if the hand-eye calibration is wrong?

    The object pose is expressed in the wrong frame: the transform camera → robot is off, so the target is shifted.

  3. What is the advantage of visual servoing over “look then move”?

    It corrects the motion while looking, so errors of calibration and of the robot model are compensated.

3

Estimation: filtering noise with Kalman and friends

13 min
You will learn

how to combine a model and noisy sensors to get a better estimate than either of them.

3.1 The idea

A robot never knows its state exactly. It has a prediction (from the model and the commands: “I drove 1 m forward”) which drifts, and a measurement (from a sensor: “the lidar says I am at 0.9 m”) which is noisy. A filter combines them, trusting each according to its uncertainty (its variance).

3.2 The one-dimensional Kalman filter

  1. Predict: x ← x + u (the motion), and the uncertainty grows: P ← P + Q (process noise Q).
  2. Gain: K = P / (P + R) (measurement noise R).
  3. Update: x ← x + K (z − x), P ← (1 − K) P.
Worked example

The robot thinks it is at x = 0 with variance P = 1 m². A sensor says z = 1 m with R = 1 m². Then K = 1/(1+1) = 0.5: x = 0 + 0.5 × (1 − 0) = 0.5 m and P = 0.5 m²: the new estimate is the average and is more certain than either. If the sensor were much better (R = 0.1): K = 1/1.1 ≈ 0.91, x ≈ 0.91 m: we trust the sensor. If it were poor (R = 10): K ≈ 0.09, x ≈ 0.09 m: we trust the prediction.

3.3 The family

FilterWhenIdea
Kalman (KF)Linear model, Gaussian noise.Optimal, very cheap. Mean and covariance.
Extended / Unscented Kalman (EKF, UKF)Mildly non-linear (robot position, attitude).Linearise around the estimate (EKF) or propagate sample points (UKF).
Particle filterStrongly non-linear or several hypotheses (“I am in one of two corridors”).Thousands of weighted guesses; resample the good ones. Basis of Monte-Carlo localisation (AMCL).
Complementary filterAttitude from a gyroscope and an accelerometer.θ ← 0.98 (θ + ω Δt) + 0.02 θaccel: gyro for the short term, accelerometer to cancel the drift.
Remember
  • Dead reckoning (odometry, gyro integration) always drifts; only an external measurement bounds the error.
  • The variances Q and R are the tuning knobs: they say how much to trust the model or the sensor.
  • Sensor fusion = a filter fed by several sensors, for example wheel odometry + IMU + GNSS.

Key terms

  • prediction / update
  • variance
  • Kalman gain
  • EKF
  • particle filter
  • complementary filter
  • dead reckoning
Check yourself
  1. x = 2 m with P = 4, measurement z = 3 m with R = 4. What are the new x and P?

    K = 4/8 = 0.5; x = 2 + 0.5 × 1 = 2.5 m; P = 0.5 × 4 = 2.

  2. What happens to the Kalman gain if the sensor is very noisy (R large)?

    K tends to 0: the filter almost ignores the measurement and trusts its prediction.

  3. When would you use a particle filter instead of a Kalman filter?

    When the problem is strongly non-linear or has several possible answers, for example global localisation in a symmetric building.

4

Localisation and mapping: odometry and SLAM

13 min
You will learn

how a mobile robot tracks its position, builds a map, and corrects drift by recognising places.

4.1 Odometry and its drift

A differential-drive robot (see the mobile robot page) integrates the wheel increments to update its pose (x, y, θ). Every small error accumulates and never goes away:

  • A distance error of 1 % means 1 m of error after 100 m.
  • A heading error of 1° gives a sideways error of 50 m × tan 1° ≈ 0.87 m after 50 m. Heading errors are the worst, because they rotate the whole future path.
  • Wheel slip, uneven floors and wheel-diameter errors cause these errors. See the wheels page.

4.2 Maps

MapWhat it storesUse
Occupancy gridA 2D (or 3D) grid, each cell free, occupied or unknown, with a probability.Navigation of mobile robots (the usual 2D map).
Landmark / feature mapPositions of a few distinctive points (corners, markers, visual features).EKF-SLAM, visual SLAM.
Point cloud / meshDense 3D geometry.3D navigation, inspection, digital twins.
Topological mapA graph of places and the routes between them.Large-scale route planning, fleets.
Semantic mapObjects and room names (“kitchen”, “door”, “chair”).Service robots, language commands.

Occupancy grid update: each laser beam says “free” for the cells it crosses and “occupied” for the cell where it stops. The probabilities are combined in the log-odds form, where an observation is simply added: l ← l + lobs. Repeated observations make a cell confidently free or occupied, and noise averages out.

4.3 SLAM: both at once

To localise, the robot needs a map; to build a map, it needs to know where it is. SLAM (Simultaneous Localisation And Mapping) solves both together:

  1. Move and predict the new pose with the odometry (which drifts).
  2. Scan matching: align the new lidar scan on the map (ICP or correlation) to correct the pose.
  3. Add the scan to the map.
  4. Loop closure: when the robot recognises a place seen before, add a constraint between the two poses and optimise the whole trajectory (pose-graph optimisation): the map snaps into shape and the drift disappears.
FamilyExamplesSensor
Filter-basedEKF-SLAM, FastSLAM (particles), GMapping2D lidar, landmarks
Graph-basedCartographer, SLAM Toolbox, g2o, GTSAM2D / 3D lidar
Visual / visual-inertialORB-SLAM, VINS, RTAB-MapCameras (+ IMU)
Localisation on a known map

Once a map exists, the robot only needs to localise: Monte-Carlo localisation (AMCL, a particle filter) compares each scan with the map. If the robot is “kidnapped” (moved without knowing), the particles spread and re-converge: global localisation. Industrial AMRs often combine a lidar map with floor markers or reflectors for centimetre repeatability.

Frames in practice

In ROS the chain of frames is map → odom → base_link → sensor. odom → base_link is smooth but drifts (odometry); map → odom is the correction given by the localisation, which can jump. A controller follows the smooth one, the planner uses the map one.

Key terms

  • odometry
  • occupancy grid
  • SLAM
  • scan matching
  • loop closure
  • pose graph
  • AMCL
  • kidnapped robot
Check yourself
  1. A robot heading is off by 2°. How far sideways is it after 30 m?

    30 × tan 2° ≈ 1.05 m.

  2. What does a loop closure do for the map?

    It adds a constraint between two poses at the same place and the optimisation removes the accumulated drift.

  3. Why are heading errors worse than distance errors?

    They rotate the whole future trajectory, so the position error grows with the distance travelled.

Odometry on the mobile robot page →

5

Path planning: Dijkstra, A* and following the path

13 min
You will learn

how a robot finds the shortest path on a map, and how it follows it while avoiding new obstacles.

5.1 Planning as graph search

Cut the map into cells: each free cell is a node, each move to a neighbour is an edge with a cost (1 for a straight move, 1.41 for a diagonal one). Finding a path becomes finding the cheapest route in a graph.

  • Dijkstra: expands the nodes in order of their cost from the start g. It always finds the shortest path, but explores in all directions, like a circle of water spreading.
  • A*: expands the nodes in order of f = g + h, where h is a heuristic estimate of the remaining cost to the goal (for example the straight-line distance). If h never over-estimates (it is admissible), A* still finds the shortest path, but explores far fewer nodes: it is drawn towards the goal.
  • Greedy best-first (f = h only): very fast, but not optimal.
Worked example

Start S at (0, 0), goal G at (4, 3), 8-connected grid, no obstacle. The Euclidean heuristic at S is h = √(4² + 3²) = 5. The best path goes 3 diagonal moves and 1 straight move: cost 3 × 1.41 + 1 = 5.24. A* with this h expands almost only the cells along this line; Dijkstra would expand every cell within distance 5.24 of S (about 80 cells).

5.2 Costmaps and real maps

  • Costmap: instead of free/occupied, each cell has a cost that rises close to obstacles (an “inflation” layer of one robot radius plus a margin). The planner then keeps a safe distance without special code.
  • Replanning: D* Lite and similar algorithms repair the path when a new obstacle is seen, without starting over.
  • Smoothing: a grid path has staircase corners; it is smoothed (splines, shortcuts) and the kinematics of the robot are respected (a car cannot turn on the spot: lattice planners, Hybrid A*, Dubins curves).
  • Road maps: for fleets, the map is a graph of lanes and intersections; A* runs on this much smaller graph.

5.3 Global and local planners

Global plannerLocal planner / controller
Question“What route from A to B on the whole map?”“What speed command now, to follow the route and dodge people?”
RateOnce, or about 1 Hz10 – 50 Hz
MethodsA*, Dijkstra, lattice, RRT*Pure pursuit, DWA (dynamic window), TEB, MPC, potential fields

Pure pursuit: aim at a point of the path at a “look-ahead” distance l in front of the robot; with the angle α to this point, drive on a circle of curvature κ = 2 sin α / l. DWA tries many pairs (speed, turn rate) reachable within the next fraction of a second, simulates each, and chooses the best one that avoids obstacles and progresses to the goal.

Key terms

  • graph search
  • Dijkstra
  • A*
  • heuristic
  • admissible
  • costmap
  • pure pursuit
  • DWA
Check yourself
  1. What happens to A* if the heuristic is h = 0 everywhere?

    It becomes Dijkstra: correct, but it explores in all directions.

  2. Why must the heuristic never over-estimate the remaining cost?

    Otherwise A* may skip a node that is on the best path and return a longer path.

  3. Why have both a global and a local planner?

    The global one finds the route on the whole (slow-changing) map; the local one reacts quickly to moving obstacles and respects the robot dynamics.

6

Motion planning for arms: configuration space, RRT, optimisation

14 min
You will learn

how to plan a collision-free motion for a robot with many joints, where a grid is hopeless.

6.1 Configuration space

A mobile robot is a point on a 2D map. An arm is a point in a space with one axis per joint: the configuration space (C-space, see the joint space of the modelling course). In C-space the arm is a single point q, and every obstacle of the workspace becomes a forbidden region that is hard to draw: the set of all q where the arm touches something. Planning a motion = finding a continuous curve of free points from qstart to qgoal.

The curse of dimension

A grid with 100 values per joint has 100² = 10⁴ cells for 2 joints but 100⁶ = 10¹² cells for 6 joints: impossible to store or search. That is why arms use sampling methods instead of grids.

6.2 Checking a collision

A planner needs thousands of collision checks per second. The robot and the scene are approximated by simple shapes (spheres, capsules, boxes, convex hulls) and arranged in trees so that most pairs are rejected quickly (libraries: FCL, Bullet, Coal). Distances (signed distance fields) are also used by optimisation methods. A motion between two free configurations is checked by testing several points in between; the margin must cover the gaps.

6.3 Sampling-based planners

PlannerHow it worksGood for
PRM (probabilistic roadmap)Sample many random free configurations, connect close ones with free straight segments to form a graph, then run A* on it.Many queries in the same static scene (build once, use often).
RRT (rapidly-exploring random tree)Grow a tree from the start: pick a random configuration, find the nearest tree node, move a small step towards it if free, add the new node. Stop when the goal is reached.One query in a changing scene: the default of many planners.
RRT-ConnectGrow two trees (from start and goal) until they meet.Very fast for arms: often the first choice.
RRT*, PRM*Same, but rewire the tree to improve the path as time passes: converge towards the optimal path.When the path quality matters and you can wait.

These planners are probabilistically complete: if a path exists, the probability of finding it tends to 1 with time. Their weaknesses: narrow passages (a random sample rarely falls in them), jagged paths that need smoothing, and variable time.

6.4 Optimisation and the full pipeline

  • Trajectory optimisation (CHOMP, TrajOpt, STOMP, MPC): start from a rough path and minimise a cost (length, smoothness, distance to obstacles, torque) by gradient steps. Gives smooth, short paths, but may get stuck in a local minimum: it is often initialised with an RRT solution.
  • Potential fields: the goal attracts, obstacles repel. Simple and reactive, but local minima trap the robot (a U-shaped obstacle).
  • Inverse kinematics for the goal: the goal is usually a tool pose, so the planner first needs the joint solutions (the several aspects of lesson 6 of the modelling course) and may try several.
  • Time parameterisation: the geometric path then receives a speed profile that respects the joint limits (see the trajectory lesson of the control course).
In practice: MoveIt

MoveIt (ROS) puts the whole pipeline in one tool: a planning scene (the robot model + obstacles, from a depth camera), the planners of the OMPL library (RRT-Connect by default), inverse kinematics solvers, trajectory smoothing and execution. You ask “go to this pose”, it returns a collision-free, time-parameterised trajectory.

Key terms

  • configuration space
  • collision checking
  • PRM
  • RRT
  • probabilistically complete
  • narrow passage
  • trajectory optimisation
  • potential field
Check yourself
  1. How many cells has a grid with 50 values per joint for a 7-joint arm?

    50⁷ ≈ 7.8 × 10¹¹, too many to store: use sampling.

  2. What does RRT do at each iteration?

    It samples a random configuration, finds the nearest node of the tree, takes a small step towards it, and adds the new node if the step is collision-free.

  3. Why is the path of an RRT usually smoothed afterwards?

    Random sampling gives a jagged path with unnecessary detours; shortcuts and smoothing make it short and gentle for the motors.

7

Behaviours and task planning: state machines and behaviour trees

12 min
You will learn

how to organise what a robot does over time, handle failures, and combine the skills of the previous lessons.

A robot has skills (navigate, detect, grasp, place…). Something must decide which skill when, and what to do when one fails. That layer is called task planning, behaviour control or the “mission” level.

7.1 Finite state machines

A finite state machine (FSM) has states (“Search”, “Approach”, “Grasp”, “Carry”) and transitions triggered by events (“object found”, “grasp failed”, “battery low”). It is simple, visual and easy to certify. Its weakness: with many behaviours the number of transitions explodes (every state may need a link to “battery low” and “stop”), and the diagram becomes spaghetti.

7.2 Behaviour trees

A behaviour tree (BT) is a tree that is “ticked” from the root several times per second. Each node returns Success, Failure or Running. The main nodes:

NodeBehaviourReads as
Sequence (→)Runs the children in order; stops at the first Failure.“do A and then B and then C”
Fallback / Selector (?)Tries the children in order; stops at the first Success.“try A, otherwise B, otherwise C”
ConditionChecks the world (“battery above 20 %?”).a question
ActionDoes something (“move to”, “grasp”). May return Running.a skill
DecoratorModifies one child: Retry 3 times, Invert, Timeout, Repeat.“retry up to 3 times”
Example: pick and place with recovery

Root: Fallback [ Sequence [ Battery OK?, Retry(3) [ Sequence [ Detect object, Plan, Grasp, Check grip ] ], Place ], Sequence [ Go to charger, Charge ] ]. If the battery is low the first branch fails at once and the fallback runs the second branch. If the grasp fails, only the grasp sequence is retried, up to 3 times. Adding a new rule (“if a person is close, stop”) means adding a node at the top, not rewiring a diagram.

7.3 Symbolic task planning

When the sequence of actions is not known in advance (“make the table ready”), a task planner searches for it. The world is described by symbols (“on(cup, shelf)”, “gripper_empty”) and each action by preconditions and effects, in a language such as PDDL. The planner searches (like A*) for a sequence that leads from the current state to the goal state. Variants: hierarchical task networks (HTN), task and motion planning (TAMP) which checks that each symbolic step is geometrically feasible.

7.4 Humans in the loop

  • Teleoperation: a person drives the robot remotely (surgery, bomb disposal, space, inspection), with force feedback (haptics) and delay compensation.
  • Shared autonomy: the human gives the goal, the robot handles the details; or the robot asks for help when it is uncertain.
  • Fleet management: a central system assigns missions to many robots, handles traffic, charging and errors (lesson 9).

Key terms

  • skill
  • state machine
  • behaviour tree
  • sequence / fallback
  • decorator
  • PDDL
  • TAMP
  • teleoperation
Check yourself
  1. In a behaviour tree, which node would you use for “try to open the door, otherwise take the other route”?

    A fallback (selector): it tries the children in order until one succeeds.

  2. What is the main weakness of a big state machine?

    The number of transitions explodes and the diagram becomes hard to read and to change.

  3. What are the two parts that describe an action in PDDL?

    Preconditions (what must be true before) and effects (what changes after).

8

Learning in robotics: from supervised learning to foundation models

14 min
You will learn

where machine learning is used in robots, how reinforcement and imitation learning work, and what their limits are.

8.1 Where learning fits

Part of the robotLearning used?Typical method
PerceptionYes, almost everywhere.Supervised learning on labelled images (detection, segmentation, grasp quality).
Estimation, modelsIncreasinglyLearn friction, residual dynamics, terrain properties.
Skills (locomotion, manipulation)Yes, a very active field.Reinforcement learning, imitation learning.
High-level decisionsNewLanguage models and vision-language-action models.
Safety-critical controlRarely aloneClassical control, with learning inside a certified safety envelope.

8.2 Reinforcement learning (RL)

An agent (the robot) observes a state s, chooses an action a with its policy π(a|s), receives a reward r and a new state. It learns, by trial and error, a policy that maximises the sum of future rewards, the return, discounted by γ (0 < γ < 1, “the future counts a bit less”):

G = r0 + γ r1 + γ² r2 + …

Worked example

With γ = 0.9 and a reward of 1 at each of three steps: G = 1 + 0.9 + 0.81 = 2.71. A reward of 1 obtained only after three steps is worth 0.81 now: the agent prefers quick rewards.

  • Algorithms: Q-learning and DQN (discrete actions), policy gradients, PPO, SAC (continuous actions such as joint torques), model-based RL (learn a model, plan inside it).
  • Reward design is the hard part: a badly defined reward gets exploited (“reward hacking”: the robot finds a cheat that scores high without doing the task).
  • Sample inefficiency: millions of trials are needed, impossible on a real robot. So training runs in simulation (thousands of robots in parallel on a GPU), then the policy is moved to the real robot: sim-to-real.
  • Domain randomisation: randomise masses, friction, delays, lighting in simulation so that the policy is robust to the reality gap. This made legged robots walk and run on rough terrain and drones fly very fast.

8.3 Imitation learning

Instead of a reward, learn from demonstrations (teleoperation, hand guiding, motion capture). Behaviour cloning trains a network to predict the demonstrator's action from the observation (images + joint states). Problem: small errors push the robot into states never seen in the demos, and the errors compound; remedies are DAgger (ask the expert to correct the robot's own runs), more diverse data, and action “chunks” predicted by transformer or diffusion policies. 50 to 200 good demonstrations can be enough to learn a task such as folding a cloth or inserting a plug.

8.4 Foundation models

  • Language models break a spoken order into steps and choose among the robot's skills (“bring me a drink” → go to kitchen, open fridge, grasp can…). The robot's skills and their success estimates keep the plan feasible.
  • Vision-language-action models (VLA) take camera images and an instruction and output robot actions directly, trained on large datasets from many robots. They generalise to new objects and instructions better than task-specific policies, but are slow, data hungry and not yet reliable enough for everything.
Limits and good practice
  • Learned policies have no guarantee: put a classical safety layer around them (limits, collision checks, emergency stop).
  • Measure success on many real trials, not on a few demos. A 90 % success rate means a failure every 10 tries.
  • Use learning where models are hard to write (perception, contact, deformable objects) and classical methods where they are easy (kinematics, control): the best systems combine both.

Key terms

  • supervised learning
  • reinforcement learning
  • policy
  • reward
  • sim-to-real
  • domain randomisation
  • behaviour cloning
  • VLA
Check yourself
  1. γ = 0.5 and rewards 4, 4, 4. What is the return?

    G = 4 + 2 + 1 = 7.

  2. Why is reinforcement learning trained in simulation?

    It needs millions of trials: too slow, costly and dangerous on a real robot. Simulation runs thousands in parallel.

  3. What is the main problem of behaviour cloning?

    Compounding errors: the robot drifts into situations absent from the demonstrations.

9

Many robots: fleets, swarms and teams with humans

11 min
You will learn

how several robots share work, avoid each other and cooperate, and how they work with people.

LevelQuestionTools
Task allocationWhich robot does which job?Auctions, assignment (Hungarian algorithm), scheduling, optimisation.
Multi-agent path finding (MAPF)How do they all move without colliding or blocking?Conflict-based search, priority planning, traffic rules on a road map.
Coordination and consensusHow do they agree on a common value (position, time, formation)?Consensus protocols, formation control, leader-follower.
CommunicationWhat do they tell each other, when the network is poor?Wi-Fi, 5G, mesh radio, shared map, delay tolerance.

9.1 Fleets

In a warehouse hundreds of AMRs or AGVs share lanes. A fleet manager receives orders, assigns each to a robot (nearest, least loaded, enough battery), reserves lanes and intersections to avoid deadlocks (two robots facing each other in a corridor), sends robots to charge, and handles errors. Interoperability standards (VDA 5050, MassRobotics) let robots from different brands share one manager.

9.2 Swarms

A swarm is a group of many simple robots with no leader: each follows local rules and the group behaviour emerges, as with ants or birds. Advantages: robust (losing a robot costs little), scalable, cheap robots. Examples: drone light shows, agricultural micro-robots, warehouse sorting robots, robots that build structures, search and rescue.

Worked example: consensus by averaging

Three robots on a line at positions 0, 6 and 12 m want to meet, with no leader. Each one, at each step, moves halfway towards the average of the positions it can hear. If each robot hears the two others, the average is (0 + 6 + 12)/3 = 6 m: after a few steps they all converge to 6 m. If they only hear their neighbours (a chain), they still converge to the average, but more slowly: the connectivity of the network sets the speed.

9.3 Robots and people

  • Human–robot interaction (HRI): legible motion (the person can guess where the robot goes), speech, gestures, screens, lights. A robot that explains what it will do is trusted more.
  • Collaboration: handing over an object, carrying a load together, one robot per worker assisting with heavy tasks. The robot must predict the human's intent and keep safe distances (course “Robots in the real world”).
  • Social navigation: pass on the right, do not cut through a group, keep a comfortable distance (about 1 m from a standing adult).
  • Ethics and trust: privacy of cameras, responsibility in accidents, bias in learned systems, effects on jobs. They are part of engineering a robot, not an afterthought.

Key terms

  • fleet manager
  • task allocation
  • MAPF
  • deadlock
  • swarm
  • consensus
  • HRI
  • social navigation
Check yourself
  1. Robots at 2, 8 and 14 m run the consensus by averaging. At what position do they meet?

    (2 + 8 + 14) / 3 = 8 m.

  2. What is a deadlock in a robot fleet?

    A situation where robots block each other (for example two facing each other in a corridor) and none can move.

  3. Give one advantage of a swarm over a single big robot.

    Robustness: the loss of one robot hardly changes the result; it also scales up easily.

Glossary

All the words of the course in one place.

TermMeaning
LidarA sensor that measures distances with laser pulses and returns a set of 3D points.
Point cloudA set of 3D points measured by a lidar or a depth camera.
Intrinsic / extrinsic calibrationThe internal parameters of a camera / its pose with respect to the robot.
Hand-eye calibrationFinding the fixed transform between a camera and the robot flange or base.
Visual servoingControlling the motion directly from image measurements.
Kalman filterAn optimal way to combine a prediction and a noisy measurement.
Particle filterRepresents a belief by many weighted samples; handles non-linear and multi-modal cases.
OdometryEstimating the motion from wheel (or visual) increments; it drifts.
SLAMSimultaneous localisation and mapping.
Loop closureRecognising a place already visited, which corrects the drift of the map.
Occupancy gridA map made of cells that are free, occupied or unknown.
A*A graph search that uses a heuristic to find the shortest path faster than Dijkstra.
Configuration spaceThe space of all joint values; an obstacle becomes a forbidden region in it.
RRT / PRMSampling-based planners that build a tree / a roadmap of random free configurations.
Behaviour treeA tree of sequences, fallbacks and conditions that organises what a robot does.
Reinforcement learningLearning a policy by trial and error to maximise a reward.
Imitation learningLearning a policy from demonstrations by a human.
Sim-to-realTransferring what was learned in simulation to the real robot.
SwarmMany simple robots whose group behaviour comes from local rules.

You can now give a robot eyes and a brain!

Last course: the real world, with every robot family, grippers, electronics, software, safety, standards and careers.

Go to robots in the real world → Back to the roadmap