Robotics
← Roadmap/Learning

Reinforcement Learning

Learning control policies from reward.

Progress0/5 questions

Prerequisites

Why it matters in robotics

Reinforcement learning lets a robot learn control policies that are hard to hand-engineer — locomotion, dexterous manipulation, and whole-body control — by trying actions in a state, receiving rewards, and gradually improving its behavior. Sample efficiency, reward design, the exploration/exploitation trade-off, and the choice between different families of learning algorithms shape whether a policy is learnable. The gap between simulation and the real world, addressed with randomized training conditions and careful reward shaping, dominates real-robot deployment.

What to study

  • MDP formulation: states, actions, rewards, returns, discounting, and the Bellman equations / value functions
  • Core algorithm families: value-based (Q-learning, DQN) vs policy-gradient / actor-critic (REINFORCE, PPO, SAC) and their tradeoffs
  • Exploration vs exploitation, on-policy vs off-policy learning, and sample efficiency
  • Robotics specifics: reward shaping, continuous control, and the sim-to-real gap (domain randomization, system identification)

Where to study

Cheatsheet

Symbols used below

s,a,rs, a, rstate, action, reward
π\pipolicy (mapping from state to action or action distribution)
γ\gammadiscount factor, 0γ<10 \le \gamma < 1
GtG_treturn: total discounted reward from time tt onward
Vπ(s)V^\pi(s)state-value function under policy π\pi
Qπ(s,a)Q^\pi(s,a)action-value function under policy π\pi
α\alphalearning rate (step size for the value update)
ϵ\epsilonexploration probability in ϵ\epsilon-greedy action selection

MDP and return

An MDP is the tuple (s,a,r,s)(s, a, r, s') with transition dynamics and reward, satisfying the Markov property: the next state depends only on the current state and action.

The return is Gt=k=0γkrt+k+1G_t = \sum_{k=0}^{\infty} \gamma^k r_{t+k+1}. Discounting (γ<1\gamma < 1) keeps infinite sums finite and weights near-term reward more heavily.

Bellman equation

Vπ(s)=Eaπ[r+γVπ(s)]V^\pi(s) = \mathbb{E}_{a\sim\pi}\big[r + \gamma V^\pi(s')\big]

Qπ(s,a)=E[r+γEaπQπ(s,a)]Q^\pi(s,a) = \mathbb{E}\big[r + \gamma \mathbb{E}_{a'\sim\pi} Q^\pi(s',a')\big]

This recursive relationship — value now equals immediate reward plus discounted value of what follows — is what every value-based method exploits.

Value-based: Q-learning / DQN

Q-learning updates toward the best next action regardless of what was actually taken (off-policy): Q(s,a)Q(s,a)+α[r+γmaxaQ(s,a)Q(s,a)]Q(s,a) \leftarrow Q(s,a) + \alpha\big[r + \gamma \max_{a'} Q(s',a') - Q(s,a)\big].

DQN replaces the table with a neural network and adds experience replay and a target network to stabilize training with correlated, non-stationary data.

Policy-gradient & actor-critic

REINFORCE directly increases the probability of actions that led to high return: it moves π\pi's parameters along logπ(as)Gt\nabla \log \pi(a|s) \cdot G_t.

Actor-critic methods (PPO, SAC) add a learned value function (the critic) to reduce the variance of that gradient estimate, and constrain or regularize the policy update for stability — PPO clips the policy change per step, SAC adds an entropy bonus to keep exploring.

Exploration vs exploitation, on- vs off-policy

An agent must trade exploiting the best-known action against exploring to discover better ones — common tactics are ϵ\epsilon-greedy, entropy bonuses, or optimism under uncertainty.

On-policy methods (REINFORCE, PPO) learn only from data generated by the current policy; off-policy methods (Q-learning, SAC) can reuse past experience from any policy, which is usually more sample-efficient but less stable.

Sim-to-real gap

Policies trained in simulation often fail on the real robot because dynamics, sensor noise, and visuals differ from the sim model.

Domain randomization varies simulated physics/appearance during training so the policy generalizes across that uncertainty; system identification instead tunes the simulator's parameters to better match the real robot. Reward shaping — adding intermediate signals — helps sparse-reward tasks learn faster but risks encouraging unintended shortcuts if misdesigned.

 Value-based (Q-learning, DQN)Policy-gradient / actor-critic (REINFORCE, PPO, SAC)
LearnsAction-value function Q(s,a)Q(s,a)Policy π(as)\pi(a|s) directly (plus a critic in actor-critic)
Action spaceBest suited to discrete actionsHandles continuous action spaces naturally
On/off-policyTypically off-policy, sample-efficientREINFORCE/PPO on-policy; SAC off-policy
StabilityCan be unstable without replay + target netsGenerally smoother but needs variance reduction

Application focus

Select an application above.

Practice questions (5)