Part I · Foundations of Sequential Decision-Making

1.Why Reinforcement Learning for Robotics?

Kober §1Tang §1–3AkinolaRusty
Reinforcement learning offers to robotics a framework and set of tools for the design of sophisticated and hard-to-engineer behaviors.
Jens Kober, J. Andrew Bagnell & Jan Peters · TU Delft · Carnegie Mellon · TU Darmstadt
Reinforcement Learning in Robotics — A Survey, IJRR 2013

Before any theorem, the case for the whole enterprise. Robots that must perceive, decide, and act in unstructured worlds outgrow hand-written controllers — not because engineers are careless, but because the number of situations to specify grows faster than anyone can enumerate them. Reinforcement learning is the discipline of replacing hand-written decision rules with optimized ones. This chapter gives you the vocabulary, the cast of robots, and — most importantly — the felt experience of watching a perfectly good controller fail in your own browser.

Foundation

The perception–decision–actuation loop written as a discrete-time dynamical system, with every informal word flagged for the chapter that makes it precise.

Conceptual

A hand-coded robot controller you can break yourself, and the field’s real-world results arranged on an honesty ladder.

Practical

The unicycle kinematics and controller trait that Rusty runs on, plus the first reproducible experiment: a noise sweep with pinned seeds.

After this chapter you can

  • Trace the see–think–act loop on a concrete robot and name which stage each robotics subfield automates
  • Explain why direct programming stops scaling, using the four axes of structure, perception, contact, and deformation
  • Position learning from demonstration, reinforcement learning, and hybrid pipelines relative to each other, and state each one’s preconditions
  • Describe the four informal ingredients of an RL problem — agent, environment, reward, policy — on three different robots
  • Place any published robot-RL system in Tang’s taxonomy: competency, formulation, solution approach, and level of real-world success
  • Read the rest of this book knowing exactly which promises have been made and which are still IOUs

1.1 See, think, act

Every robot that does anything useful runs the same loop. It senses the world, it decides what to do, and it acts — changing the world, which it then senses again. Cameras, lidar, and joint encoders feed the first stage; planners, controllers, and policies occupy the second; motors and grippers execute the third.

Write it down with a little more care. At discrete time step tt, the robot receives an observation oto_t, chooses an action

at=π(ot),a_t = \pi(o_t),

and the world advances to a new configuration influenced by ata_t together with whatever disturbances the universe supplies. The function π\pi is called a policy, and essentially all of robotics is the search for good policies.

Three words in that paragraph are doing unearned work, and it is worth naming the debt now.

The loop looks innocent because we have all watched robots work. The interesting question is what happens to it when the world stops cooperating.

SEElidar, cameraTHINKpolicy πACTmotorsoₜaₜthe world advances — and it does not always advance the same wayChapters 2 and 4 make every arrow in this diagram a precise mathematical object
Figure 1.1. The see–think–act loop. Perception maps the world to an observation, the policy maps the observation to an action, and actuation changes the world — which changes the next observation. Everything this book does happens inside the middle box.

1.2 Why direct programming breaks

Meet Rusty, a differential-drive mobile robot and the first member of this book's cast. Rusty's job is to reach a goal without hitting anything. His controller is the textbook potential-field method: steer toward the goal, steer away from obstacles, sum the two.

It is a good controller. It is also about to fail in front of you.

Drive Rusty — the case for learning, in thirty seconds

ch01-drive-rusty

A hand-written potential-field controller: steer toward the goal, repel from obstacles.

Room
Driver
goal

Steps taken

0

control cycles elapsed

Distance to goal

425.0px

Outcome

Driving

in progress

The controller is not badly written — it is the textbook potential-field method, and in the empty room it is optimal. Add clutter and it wobbles; build a concave trap and it parks itself in a local minimum and stays there. You can drive out of the trap instantly, because you can see that backing up is progress. Encoding that judgment by hand, for every room, is the job reinforcement learning proposes to automate.

Nothing went wrong with the code. The potential-field method is correct, well understood, and provably convergent under assumptions — assumptions the concave trap violates. And here is the uncomfortable part: you fixed it instantly. You looked at the screen, saw that backing up was progress, and drove out. Encoding that judgment — for every trap, in every room, under every lighting condition — is the job direct programming asks of us.

A controller is a function π:OA\pi : \mathcal{O} \to \mathcal{A} from observations to actions. Programming means specifying π\pi by hand, case by case. The effort required grows not with the size of the code but with the diversity of inputs the robot actually encounters. Four axes generate that diversity, and they explain why some robots shipped decades ago while others remain research projects:

AxisEasy endHard end
Structure & consistencyVacuum robot: flat floor, same room nightlyHome-cleaning robot: novel clutter every time
PerceptionPool cleaner: featureless tiled basinCooking robot: identify ingredients by sight and state
Manipulation contactManufacturing arm: fixtured parts, known posesAssembly under uncertainty: contact decides the outcome
DeformationWarehouse robot: rigid boxesLaundry robot: cloth has effectively infinite configurations

Robots that shipped commercially live at the left of every row. Robots that remain research projects live at the right of at least one.

Here is what Rusty's world actually looks like in code — the unicycle kinematics and the controller trait that the sandbox above runs on.

Rustrl-envs/src/rusty/diff_drive.rs
rust
pub struct Pose { pub x: f64, pub y: f64, pub theta: f64 }
pub struct Twist { pub v: f64, pub omega: f64 }   // forward m/s, yaw rad/s
 
/// Unicycle kinematics, advanced by one control period `dt` (zero-order hold).
pub fn step(p: &Pose, u: &Twist, dt: f64) -> Pose {
    Pose {
        x: p.x + u.v * p.theta.cos() * dt,
        y: p.y + u.v * p.theta.sin() * dt,
        theta: p.theta + u.omega * dt,
    }
}
 
pub trait Controller {
    fn act(&mut self, scan: &LidarScan) -> Twist;
}
 
/// The hand-coded baseline this chapter exists to break.
pub struct WallFollower { pub target_gap: f64, pub k_p: f64 }
 
impl Controller for WallFollower {
    fn act(&mut self, scan: &LidarScan) -> Twist {
        let gap = scan.min_range_deg(-95.0..=-85.0); // right-side beams
        Twist { v: 0.4, omega: self.k_p * (gap - self.target_gap) }
    }
}
Rusty's body and the interface every controller implements. The hand-coded WallFollower is deliberately simple — it exists to be broken.

Notice what the Controller trait does not say: nothing about how act arrives at its answer. A hand-written proportional rule satisfies it. So does a neural network trained for three days on a GPU cluster. That interface is the seam along which this entire book is built.

1.3 Three roads to a policy

If hand-writing π\pi does not scale, what does? There are exactly three families of answers, and they differ in what they demand from you rather than in how clever they are.

Demonstrate. Collect a set D={(s,a)}D = \{(s, a)\} of situations and the actions an expert took in them, then fit a function to it. This is learning from demonstration, and it is supervised learning wearing a robotics hat. Its preconditions are strong and worth stating aloud: a teacher must exist, and demonstration must be physically possible. You can demonstrate driving. Demonstrating a backflip on a quadruped, or the precise force profile of an insertion, is another matter.

Reinforce. Provide no teacher at all — only a scalar judgment of how well things are going. The robot practices, receives reward, and improves. This is reinforcement learning. The precondition is subtler: you must be able to write down what success means as a number. Reward specifies what you want, never how to achieve it, and that gap is simultaneously the method's power and its most reliable source of disaster (Chapter 14 catalogues the disasters).

Hybridize. Use demonstrations to get a competent starting point, then let reinforcement learning refine it beyond what the demonstrator could do. Nearly every real-world success in manipulation takes this road, and Chapters 16 and 17 build it properly.

Teacher requiredSample costReward-design burden
DemonstrationYes — and must be able to perform the taskLow (one-time collection)None
ReinforcementNoHigh — the robot must practiceHigh — and unforgiving
HybridYes, for initialization onlyMediumMedium

1.4 The anatomy of an RL problem

Four ingredients, stated informally here and made precise in Chapter 4.

The agent is the thing that chooses. The environment is everything else — including, importantly, the robot's own motors, since the agent controls them only through commands that may not be obeyed exactly. The reward rt+1Rr_{t+1} \in \mathbb{R} is a scalar arriving after action ata_t; the indexing is deliberate and follows Sutton and Barto, because the reward is a consequence of the action, not a property of the situation that preceded it. The policy π\pi maps what the agent perceives to what it does.

From these, one derived quantity dominates everything: the return, the accumulated reward over an episode. An agent that maximizes immediate reward is myopic; an agent that maximizes return is strategic. Making that distinction rigorous — and finite, since sums of infinitely many rewards need care — occupies Chapter 4.

Sutton and Barto identify four elements of any RL system. Each lands somewhere concrete on Rusty:

  • Policy — Rusty's rule for choosing a heading given what the lidar reports.
  • Reward signal+25+25 for reaching the dock, 1-1 per step elapsed, 10-10 for hitting a shelf.
  • Value function — how promising a corridor is in the long run, accounting for where it leads. Not the same as its immediate reward, and vastly more useful.
  • Model — a floor map, if the robot has one. Chapters 5 and 12 show what becomes possible when it does; Chapters 6 and 7 show what to do when it does not.

1.5 What actually worked

Enthusiasm is cheap. The useful question is what reinforcement learning has genuinely achieved on physical hardware, and the honest answer is: a great deal in a few competencies, and remarkably little in others.

Tang and colleagues surveyed the field with an unusually disciplined instrument — a six-level maturity ladder running from "validated only in simulation" to "deployed in a commercial product". It is worth internalizing, because it converts vague claims into checkable ones, and because this book applies it to its own capstone in Chapter 22.

Levels of real-world success

ch01-success-levels

Tang et al. (2024) §3.4 — a maturity rubric for robot RL results, from 'works in simulation' to 'shipping in a product'.

  1. L0Simulation onlyValidated only in simulation environments.
  2. L1Limited labValidated under limited laboratory conditions.
  3. L2Diverse labValidated under diverse laboratory conditions.
  4. L3Confined real worldValidated under confined real-world operational conditions.
  5. L4Diverse real worldValidated under diverse, representative real-world conditions.
  6. L5CommercializedDeployed on commercialized products.

Peak demonstrated maturity, by competency

  • L4Quadruped locomotion (ANYmal, perceptive)Zero-shot sim-to-real with teacher–student privileged learning; deployed on varied natural terrain.
  • L5Production quadrupeds (ANYbotics, Swiss-Mile, Boston Dynamics)RL locomotion controllers shipping inside commercial robot products.
  • L4Champion-level drone racingKaufmann et al., Nature 2023 — beat human champions on a physical racing track.
  • L3Legged + wheeled navigationRobust local planning in real buildings; global reasoning still largely classical.
  • L2Social / crowd navigationHuman behaviour is the unmodelable part — simulation fidelity caps transfer.
  • L2In-hand cube reorientationMassive domain randomization + recurrent policies; impressive, but lab-bound.
  • L3Contact-rich assembly / insertionDense rewards designable a priori; impedance action spaces do the heavy lifting.
  • L2Open-world pick-and-placeObject and scene diversity keeps general-purpose picking below confined deployment.
  • L2Long-horizon mobile manipulationSkill composition works; the open question is which skills to learn at all.
  • L1Physical human–robot collaborationNeither accurate simulation nor cheap real rollouts — the hardest data regime.
  • L4Multi-robot soccerFull-body control and coordination on physical humanoid/quadruped platforms.
  • L1Urban autonomous drivingDRL-based solutions remain in simulation or strictly confined field tests.
The bar chart shows the HIGHEST level any surveyed system reached per competency — not the typical one. Locomotion reaches L5 because its dynamics simulate well and its rewards shape easily; HRI sits at L1 because humans are the part nobody can simulate. That spread, more than any single algorithm, is the map this book navigates.

Read the pattern rather than the individual entries. Locomotion reached commercial deployment because its dynamics simulate faithfully, its rewards shape naturally, and a stumble costs a fall rather than a lawsuit. Manipulation stalls below the real-world tiers because object diversity defeats simulation and contact is where physics engines are least trustworthy. Human–robot interaction sits near the bottom for a reason no algorithm will fix: humans are the part of the environment nobody can simulate, so neither zero-shot transfer nor cheap practice is available.

That spread — not any particular algorithm — is the map this book navigates. Part IV devotes a chapter to each region of it.

1.6 The method, the cast, and the contract

Three commitments run through every remaining chapter.

Foundation. Derivations are complete. When this book states a theorem, it either proves it or states it precisely and says exactly where the proof lives. "It can be shown" is not an argument, and you should not accept it from a textbook any more than from a colleague.

Conceptual. Every hard concept gets something you can manipulate. This is not decoration. A discount factor you have dragged from 0.5 to 0.99, watching the value function's reach stretch across a warehouse, is a discount factor you understand in a way that reading 1/(1γ)1/(1-\gamma) does not deliver.

Practical. Every algorithm is implemented in Rust, with seeded randomness and real tests. You will finish with working code, not pseudocode with the hard parts elided.

The cast is small and fixed. Rusty you have met. Pendle, a pendulum, arrives in Chapter 2 — simple enough that we can do every calculation exactly, which makes him the perfect vehicle for the mathematics. Reacher, a two-link arm, arrives in Chapter 3 and carries the manipulation thread. Ferris, a quadruped, arrives in Chapter 15 and gets a full chapter of his own plus the capstone.

1.7 Chapter bridge

We have made claims and issued IOUs. Let us be precise about which is which.

Claimed and defended: hand-written controllers fail through input diversity rather than programmer error; there are three roads to a policy with different preconditions; robot RL's real-world successes cluster in competencies that simulate well.

Still owed: the loop is not yet mathematics. "Reward" is not yet a random variable. "The agent eventually finds the best policy" is not yet a limit theorem — and until it is, it is marketing.

Chapter 2 pays these debts. It supplies probability spaces and conditional expectation, contraction mappings and the fixed-point theorem that every convergence proof in this book eventually invokes, the discretization that turns a robot's continuous dynamics into discrete decisions, and the Robbins–Monro theorem — the single result that makes learning from noisy samples work at all. Pendle arrives to carry all of it, because he is simple enough that we can compute everything exactly and check the theory against arithmetic.

  1. 01Foundation●●Name your own hard tasks

    For each of the four diversity axes (structure, perception, contact, deformation), give one easy/hard task pair not used in this chapter, and justify each placement in two sentences.

  2. 02Foundation●●Optimization without time

    Kober’s test says RL applies when a task is an optimization problem AND exhibits temporal structure. Give a robot task that is genuinely an optimization problem but has no temporal structure. Name the problem class it belongs to — you have just previewed Chapter 3.

  3. 03Foundation●●The thermostat

    Write the see–think–act loop for a household thermostat: identify $o_t$, $a_t$, and $r_{t+1}$ explicitly. Is exploration present in a standard thermostat? Should it be? Argue both sides in a paragraph.

  4. 04Conceptual●●Find the failure boundary

    In the Rusty sandbox, work out which room geometry first defeats the hand-coded controller. Then describe, in one sentence, the property of that geometry that the potential-field method cannot represent.

  5. 05Conceptual●●Diagnose a stalled competency

    In the success-levels explorer, find a competency with no entry above L2. Propose one reason grounded in the survey’s own analysis — is the bottleneck simulation fidelity, reward design, sample cost, or safety?

  6. 06Practical●●A second hand-coded controller

    Implement a bang-bang gap keeper alongside the proportional WallFollower and add it to the parameter sweep. Does it dominate the P-controller anywhere in the noise–slip plane, or is it uniformly worse?

  7. 07Practical●●●Tag a recent paper

    Take a robot-RL paper from the last two years and tag it with all four taxonomy axes: competency, problem formulation, solution approach, and level of real-world success. Defend the level assignment in a paragraph, citing only the experimental evidence the paper actually reports — not what it claims in the abstract.

  8. 08Conceptual●●Judge your own driving

    Drive Rusty manually for sixty seconds, then score that same trajectory under three reward configurations: dock-only sparse, step-penalty dense, and collision-heavy. Your ranking will change. Explain why — you have just previewed the curse of goal specification (Chapter 14).

Coding taskrl-envs, rl-core

Reproduce the failure cliff

Build the noise sweep described above using rayon for parallel rollouts and a seeded StdRng per run. The point is not the plot — it is that you now own a reproducible experimental harness, and every later chapter assumes you can run one.

Success is not "the controller fails". Success is knowing at which noise level it fails, and being able to show someone else the same number tomorrow.

Deliverables

  • A seeded sweep over lidar noise σ ∈ [0, 0.5] m across 100 layout seeds
  • A success-rate plot showing the cliff, exported as the page’s static figure
  • Byte-identical results on re-run from the pinned seed — the book’s reproducibility standard

References

Baseline references

  • Sutton, R. S. & Barto, A. G. (2018). Reinforcement Learning: An Introduction. MIT Press, 2nd edition
    Chapter 1, especially §1.1–1.3 (elements of RL) and §1.5 (tic-tac-toe as a first complete example).
  • Kober, J., Bagnell, J. A. & Peters, J. (2013). Reinforcement Learning in Robotics: A Survey. International Journal of Robotics Research 32(11)
    §1.1 RL in the context of machine learning; §1.2 versus optimal control; §1.3 in the context of robotics — dimensionality, partial observability, and the cost of real experience.
  • Tang, C., Abbatematteo, B., Hu, J., Chandra, R., Martín-Martín, R. & Stone, P. (2024). Deep Reinforcement Learning for Robotics: A Survey of Real-World Successes. Annual Review of Control, Robotics, and Autonomous Systems link
    §3.1 competencies, §3.2 problem formulation, §3.3 solution approach, §3.4 the L0–L5 levels of real-world success used throughout this book.
  • Akinola, I. (n.d.). Reinforcement Learning for Robotics. Columbia University lecture notes
    The see–think–act framing, the direct-programming difficulty axes, and the LfD / RL / hybrid taxonomy.

Further reading & modern sources

  • Kaufmann, E., Bauersfeld, L., Loquercio, A., Müller, M., Koltun, V. & Scaramuzza, D. (2023). Champion-level drone racing using deep reinforcement learning. Nature 620 link
    The clearest demonstration that RL can beat expert humans on a physical, dynamic, safety-critical task.
  • Lee, J., Hwangbo, J., Wellhausen, L., Koltun, V. & Hutter, M. (2020). Learning quadrupedal locomotion over challenging terrain. Science Robotics 5(47)
    The teacher–student recipe rebuilt in Chapters 15 and 18.
  • Miki, T., Lee, J., Hwangbo, J., Wellhausen, L., Koltun, V. & Hutter, M. (2022). Learning robust perceptive locomotion for quadrupedal robots in the wild. Science Robotics 7(62)
    Perceptive locomotion at L4 — diverse, representative real-world conditions.
  • Hwangbo, J., Lee, J., Dosovitskiy, A., Bellicoso, D., Tsounis, V., Koltun, V. & Hutter, M. (2019). Learning agile and dynamic motor skills for legged robots. Science Robotics 4(26)
    Where the modern sim-to-real locomotion pipeline begins.
  • Akkaya, I. et al. (OpenAI) (2019). Solving Rubik’s Cube with a Robot Hand. arXiv:1910.07113 link
    The in-hand manipulation line traced in Chapter 20 — and a case study in how much randomization dexterity costs.
  • Sünderhauf, N. et al. (2018). The limits and potentials of deep learning for robotics. International Journal of Robotics Research 37(4–5)
    The pre-success-era assessment that the 2024 survey positions itself against — useful for calibrating how fast this field moves.