Skip to content
OpenVibes.

⚙Free interactive course · Learning· 16 interactives

Robotics engineering, the interactive free course

Learn robotics by playing with it. 16 chapters in order, from rotation matrices to humanoids. Each has the math in plain English, a worked example, a live simulation you can drag around, tested Python or ROS 2 code and a quick quiz. Then 39 free courses from MIT, Stanford, ETH Zurich, Penn and Berkeley to go deeper. $0, no signup; your progress saves in this browser.

Checked 27 Nov 202616 chapters48 quiz questions≈ 7 h$0, no signup
Share on X
chapters
16chapters
live simulations
16live simulations
quiz questions
48quiz questions
free courses
39free courses

Your progress · saved in this browser

0/16 chapters·0/48 quiz answers right

The roadmap

16 steps, in order

Each step: a plain-English lesson, the key equations, a live simulation you can poke, a worked example, runnable code, a quiz, and the best free course to go deeper.

0/16 chapters · quiz 0/48
Contents · 16 chapters⌄

Chapter 01 · 1 · Geometry · 20 min

Coordinate frames and rotations

Every robot is a stack of coordinate frames. Rotation matrices tell you how one frame is turned relative to another, and most robotics bugs are frame bugs.

A robot is a pile of coordinate frames: one for the world, one for the robot's base, one for every link, one for every camera and lidar. A frame is just an origin plus three perpendicular unit axes . Before a robot can grab a cup, it has to answer "where is the cup in my gripper's frame?", and that question is pure geometry.

To describe how frame is turned relative to frame we use a rotation matrix , a matrix whose columns are 's axes written in 's coordinates. Multiply a vector expressed in by it and you get the same arrow expressed in : .

Rotation matrices are special. Their columns are unit length and mutually perpendicular, so , the inverse is simply the transpose, and (a determinant of would be a mirror, not a rotation). Chaining frames is matrix multiplication where the inner labels cancel: .

Roll, pitch, yaw

Humans like three angles. ROS uses roll about , pitch about and yaw about , composed as . Matrix multiplication does not commute, so the order is part of the definition: the same three numbers in another order give a different orientation. Try both orders in the explorer below.

At pitch roll and yaw spin about the same physical axis and you lose a degree of freedom: gimbal lock. That is why software (ROS messages, Isaac, MuJoCo) stores orientation as a unit quaternion and only converts to angles for humans.

Conventions to memorise (ROS REP 103): forward, left, up, angles counter-clockwise positive, right-handed frames.

Key equations

1.1Rotation about z by ψ

Turns vectors counter-clockwise by around the axis. and have the same pattern on the other axes.

1.2Roll-pitch-yaw (Z-Y-X)

The ROS convention: roll about , then pitch about , then yaw about , read right to left.

1.3What makes R a rotation

Orthonormal columns and no mirroring. Inverting a rotation is free: just transpose it.

1.4Unit quaternion

A rotation by angle about unit axis , with no gimbal lock. This is what geometry_msgs/Quaternion stores.

Try itRotation matrix explorer

Loading interactive…
Drag the roll, pitch and yaw sliders and watch the coloured columns of follow the body axes. Hit Gimbal lock, then move roll and yaw: they now do the same thing.

Worked example · Where is the camera looking?

A robot is yawed (facing world ) and its camera is pitched nose-down. The camera looks along its own axis, . In the world:

So the camera looks along world and down at , exactly as intended. Positive pitch points the nose down in a -up world; getting that sign wrong is a classic first-week bug.

Try it in code

python
import numpy as np

def Rx(a): c, s = np.cos(a), np.sin(a); return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
def Ry(a): c, s = np.cos(a), np.sin(a); return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
def Rz(a): c, s = np.cos(a), np.sin(a); return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])

def rpy(roll, pitch, yaw):
    """ROS convention (REP 103): R = Rz(yaw) @ Ry(pitch) @ Rx(roll)."""
    return Rz(yaw) @ Ry(pitch) @ Rx(roll)

R = rpy(0, np.radians(30), np.radians(90))   # yawed 90°, nose pitched down 30°
print(np.round(R @ [1, 0, 0], 3))            # body x-axis in world: [ 0.     0.866 -0.5  ]
print(np.allclose(R.T @ R, np.eye(3)), round(np.linalg.det(R), 6))  # True 1.0

# Order matters: rotations do not commute
print(np.allclose(Rz(1) @ Rx(1), Rx(1) @ Rz(1)))  # False

Check yourself

0/3 answered

  1. Q1The columns of the rotation matrix are…
  2. Q2What is the inverse of a rotation matrix?
  3. Q3With Z-Y-X roll-pitch-yaw, what happens at pitch ?

Chapter 02 · 1 · Geometry · 20 min

Homogeneous transforms

Position and orientation together form a pose. A 4×4 matrix packs both so chaining frames, like world ← robot ← lidar, is a single multiplication.

Rotation alone is not enough: the lidar is not at the robot's centre, and the robot is not at the world origin. A pose is a rotation and a translation. To move a point from frame to frame :

Rotate first, then add the offset. Chaining two of these by hand gets messy fast, so we use a trick: append a 1 to every point, , and pack and into one homogeneous transform . Now "rotate then translate" is one matrix product, and a whole chain of frames is just a product of matrices:

Read it like fractions: the inner labels () must match and cancel. is "the pose of the robot base in the world"; it maps base coordinates into world coordinates.

The inverse is not just "negate everything": undoing a rotation then translation means un-translating in the rotated frame, so the translation part becomes .

In real robots

ROS 2 keeps a tree of these transforms in tf2: map → odom → base_link → laser_link, base_link → camera_link, and so on. Every time you ask "where is this lidar hit on the map?", tf2 multiplies exactly these matrices, using the right timestamp for each. In the plane (mobile robots) the same idea uses matrices in , which is what the interactive shows.

Key equations

2.1Homogeneous transform

Rotation (3×3) and translation (3×1) in one 4×4 matrix. In 2-D it is 3×3 with a 2×2 rotation.

2.2Moving a point between frames

Append a 1 to the point and multiply: rotation and translation happen together.

2.3Chaining frames

Inner labels cancel. A whole kinematic chain or tf tree is one long product.

2.4Inverse transform

Undo the rotation with and the translation in the rotated frame, . Cheaper and more accurate than a general matrix inverse.

Try itWorld ← robot ← lidar

Loading interactive…
Move and turn the robot, change where the lidar is mounted, and drag the lidar hit. The three matrices update live and is always exactly .

Worked example · A lidar hit on the map

The robot is at facing (). Its lidar is mounted m ahead of the base, and it sees an obstacle m straight ahead: .

  1. Lidar → base: .
  2. Base → world: rotate by , giving , then add , giving .

So the obstacle goes on the map at . Get the mount offset or the order wrong and your map gets a ghost wall 20 cm off.

Try it in code

python
import numpy as np

def se2(theta, x, y):
    """Planar homogeneous transform: rotate by theta, then translate by (x, y)."""
    c, s = np.cos(theta), np.sin(theta)
    return np.array([[c, -s, x], [s, c, y], [0, 0, 1.0]])

def inv(T):
    R, t = T[:2, :2], T[:2, 2]
    Ti = np.eye(3)
    Ti[:2, :2], Ti[:2, 2] = R.T, -R.T @ t
    return Ti

T_WB = se2(np.pi / 2, 2.0, 1.0)  # robot at (2, 1), facing +y
T_BS = se2(0.0, 0.2, 0.0)        # lidar mounted 20 cm ahead of the base
p_S = np.array([1.5, 0.0, 1.0])  # obstacle 1.5 m straight ahead of the lidar

p_W = T_WB @ T_BS @ p_S
print(np.round(p_W[:2], 3))                      # [2.  2.7]
print(np.allclose(inv(T_WB) @ T_WB, np.eye(3)))  # True

Check yourself

0/3 answered

  1. Q1Why do robotics libraries use 4×4 matrices for 3-D poses?
  2. Q2When is the product meaningful?
  3. Q3What is the translation part of ?
Next: Forward kinematics →

Chapter 03 · 1 · Geometry · 20 min

Forward kinematics

Given the joint angles, where is the hand? Forward kinematics multiplies one transform per joint and link, and it always has exactly one answer.

A robot arm is a chain: base, joint, link, joint, link, …, tool. Each joint adds one degree of freedom (a rotation for revolute joints, a slide for prismatic ones). Forward kinematics (FK) answers: given all joint values , what is the pose of the end-effector?

The recipe is the one from the previous chapter. Each joint contributes a transform that depends on its angle, each link a fixed offset, and you multiply them in order from the base outward:

For a planar arm with two links of length and , the product simplifies to two lines of trigonometry. Note that the second link's direction is : joint angles are relative to the previous link.

The set of all reachable points is the workspace. For the 2-link arm it is a ring: you can't reach further than (fully stretched) or closer than (fully folded).

Describing real arms

For a 6- or 7-joint arm nobody multiplies matrices by hand. Two standard bookkeeping systems exist: Denavit–Hartenberg (DH) parameters, four numbers per joint, and the product of exponentials used in Modern Robotics, one screw axis per joint. In ROS the robot's geometry lives in a URDF file, and libraries such as KDL, Pinocchio and MoveIt compute FK from it thousands of times per second.

FK is the easy direction: one input, one answer, no failure cases. The next chapter does the hard one.

Key equations

3.1FK as a chain of transforms

Multiply each joint's transform from the base out to the tool.

3.3Denavit–Hartenberg link transform

Four numbers per joint () describe any serial arm. Datasheets for industrial arms list them.

3.4Product of exponentials

*Modern Robotics* form: is the tool pose at and each is a joint's screw axis in the base frame.

Try itDrive a 2-link arm

Loading interactive…
Move the joint sliders and trace the end-effector. Change the link lengths and watch the reachable ring shrink or grow.

Worked example · Where is the hand?

m, m, , (so the second link points at ):

The code below gets the same numbers by multiplying four transforms, which is how it generalises to any arm.

Try it in code

python
import numpy as np

def se2(theta, x=0.0, y=0.0):
    c, s = np.cos(theta), np.sin(theta)
    return np.array([[c, -s, x], [s, c, y], [0, 0, 1.0]])

def fk(thetas, lengths):
    """Chain of 'rotate joint, then move along link' transforms."""
    T = np.eye(3)
    for th, L in zip(thetas, lengths):
        T = T @ se2(th) @ se2(0, L, 0)
    return T[:2, 2]

l1, l2 = 1.0, 0.7
t1, t2 = np.radians(30), np.radians(45)
print(np.round(fk([t1, t2], [l1, l2]), 4))          # [1.0472 1.1761]
closed = [l1 * np.cos(t1) + l2 * np.cos(t1 + t2), l1 * np.sin(t1) + l2 * np.sin(t1 + t2)]
print(np.allclose(fk([t1, t2], [l1, l2]), closed))  # True

Check yourself

0/3 answered

  1. Q1For a serial arm, how many end-effector poses does one set of joint angles give?
  2. Q2A 2-link arm has m and m. Which distances from the base can the hand reach?
  3. Q3How many Denavit–Hartenberg parameters describe one joint?
Next: IK & Jacobians →

Chapter 04 · 1 · Geometry · 30 min

Inverse kinematics and Jacobians

Given where the hand should go, which joint angles get it there? Inverse kinematics can have zero, two or infinitely many answers, and the Jacobian tells you how the hand moves when the joints do.

Inverse kinematics (IK) runs FK backwards: given a target, find joint angles that reach it. Unlike FK it can have no solution (out of reach), several (elbow up or elbow down), or infinitely many (a 7-joint arm can move its elbow while the hand stays still).

Closed form for 2 links

The triangle base–elbow–hand gives by the law of cosines. If the cosine comes out larger than 1 in magnitude, the target is out of reach. The sign of picks the elbow-up or elbow-down branch, and follows from two atan2s.

The Jacobian

Differentiate FK with respect to time and you get the Jacobian: a matrix that maps joint velocities to hand velocity, . Each column is "how the hand moves if only this joint moves". It changes as the arm moves.

When the arm is at a singularity: some hand direction cannot be produced at all, however fast the joints spin. For two links , zero when the arm is fully stretched or folded. Near a singularity, asking for a small hand motion demands huge joint speeds. The ellipse in the interactive visualises this: it collapses to a line.

Numerical IK

Real 6-7 joint arms rarely have a tidy closed form, so most solvers iterate: measure the error , step , repeat. The plain pseudo-inverse explodes near singularities, so practical solvers use damped least squares (Levenberg–Marquardt): a small trades a little accuracy for stability. MoveIt's default IK plugins (KDL, TRAC-IK, pick_ik) are numerical.

The same matrix also does statics: to push with force at the hand, the joints need torques .

Key equations

4.1Elbow angle (law of cosines)

Two signs, two solutions (elbow up / down). If the target is out of reach.

4.2Shoulder angle

Aim at the target, then correct for the bend at the elbow. Always use atan2, never atan.

4.4Damped least-squares IK step

Move the joints to shrink the hand error . keeps the step finite near singularities.

4.5Forces through the Jacobian

Joint torques needed to apply force at the hand. The same matrix, transposed.

Try itDrag the target: IK, Jacobian and singularities

Loading interactive…
Drag the ring. The dashed arm is the other IK solution. Push the target to full stretch and watch and the ellipse flatten. Switch to Numerical (DLS) to watch the iterations converge.

Worked example · Reach (1.2, 0.8) with l₁ = 1 m, l₂ = 0.75 m

Elbow up (): .

Elbow down (): . Both reach exactly; plug them into FK to check. Here : comfortably far from a singularity.

Try it in code

python
import numpy as np

l1, l2 = 1.0, 0.75

def fk(q):
    t1, t2 = q
    return np.array([l1 * np.cos(t1) + l2 * np.cos(t1 + t2), l1 * np.sin(t1) + l2 * np.sin(t1 + t2)])

def jacobian(q):
    t1, t2 = q
    s1, c1, s12, c12 = np.sin(t1), np.cos(t1), np.sin(t1 + t2), np.cos(t1 + t2)
    return np.array([[-l1 * s1 - l2 * s12, -l2 * s12], [l1 * c1 + l2 * c12, l2 * c12]])

def ik_closed_form(x, y, elbow_up=True):
    c2 = (x * x + y * y - l1**2 - l2**2) / (2 * l1 * l2)
    if abs(c2) > 1:
        raise ValueError("target out of reach")
    t2 = (-1 if elbow_up else 1) * np.arccos(c2)
    t1 = np.arctan2(y, x) - np.arctan2(l2 * np.sin(t2), l1 + l2 * np.cos(t2))
    return np.array([t1, t2])

def ik_dls(target, q=np.array([0.2, 0.4]), lam=0.05, iters=200):
    """Damped least squares: dq = J^T (J J^T + lam^2 I)^-1 e."""
    for _ in range(iters):
        e = target - fk(q)
        J = jacobian(q)
        q = q + J.T @ np.linalg.solve(J @ J.T + lam**2 * np.eye(2), e)
    return q

target = np.array([1.2, 0.8])
q = ik_closed_form(*target)
print(np.round(np.degrees(q), 2), np.round(fk(q), 6))   # [ 62.91 -69.82] [1.2 0.8]
q2 = ik_dls(target)
print(np.round(fk(q2), 6), "det J =", round(np.linalg.det(jacobian(q2)), 3))

Check yourself

0/3 answered

  1. Q1How many IK solutions does a 2-link planar arm usually have for a reachable target inside its workspace?
  2. Q2What does mean physically?
  3. Q3Why add the damping term λ in numerical IK?
Next: Dynamics basics →

Chapter 05 · 2 · Physics & control · 25 min

Dynamics: forces, torques and motion

Kinematics says where things are; dynamics says why they move. Newton, the pendulum, and the one equation behind every robot arm and simulator.

Kinematics ignores mass. Dynamics connects forces and torques to motion. For a point mass it is Newton's ; for something rotating about a joint it is : torque equals inertia times angular acceleration.

The pendulum, the hydrogen atom of robotics

A mass on a rod of length feels gravity . Only the component perpendicular to the rod, , turns it, at lever arm . With inertia :

The mass cancels: a heavy and a light pendulum swing identically. For small angles , the motion is a pure sine and the period is . For big swings the real (nonlinear) period is longer: released from it is 18 % longer. That gap between the linear approximation and reality is a theme you will meet again in control.

With no friction, total energy is constant; it just sloshes between kinetic and potential.

Robot arms

Every rigid robot obeys the same structure, the manipulator equation:

is the mass matrix (inertia, which changes as the arm reconfigures), holds Coriolis and centrifugal effects, is gravity, and is what the motors supply. Run it forward ("given torques, how does it move?") and you have a simulator. Run it backward ("which torques produce this motion?"), called inverse dynamics, and you have the feedforward term used by good controllers. The usual way to derive it is the Lagrangian: kinetic minus potential energy.

Key equations

5.1Pendulum with damping

Nonlinear because of . The mass cancels out.

5.2Small-angle period

Valid when . A 1 m pendulum takes about 2.006 s per swing cycle.

5.3Manipulator equation

Inertia, velocity coupling, gravity, motor torques. Simulators integrate it forward; controllers invert it.

5.4Euler–Lagrange equation

Write kinetic energy and potential energy , differentiate, and the equations of motion fall out.

Try itA real (nonlinear) pendulum

Loading interactive…
Release it from a small angle and from and compare the measured period with . Set damping to 0 and watch the total-energy bar stay flat.

Worked example · How long is one swing?

For m: s.

Released from the small-angle assumption is badly wrong (, not ). Integrating the full equation gives s, a factor of . The code below reproduces both numbers with SciPy's ODE solver, and the interactive shows the same ratio live.

Try it in code

python
import numpy as np
from scipy.integrate import solve_ivp

g, L, c = 9.81, 1.0, 0.0   # gravity, length (m), damping (1/s)

def pendulum(t, s):
    theta, omega = s
    return [omega, -(g / L) * np.sin(theta) - c * omega]

def period(theta0):
    sol = solve_ivp(pendulum, (0, 10), [theta0, 0.0], rtol=1e-10, atol=1e-12, dense_output=True)
    t = np.linspace(0, 10, 200_001)
    th = sol.sol(t)[0]
    up = np.where((th[:-1] < 0) & (th[1:] >= 0))[0]   # upward zero crossings
    return t[up[1]] - t[up[0]]

T0 = 2 * np.pi * np.sqrt(L / g)
print(f"small-angle formula: {T0:.4f} s")              # 2.0061 s
print(f"simulated, 5 deg:    {period(np.radians(5)):.4f} s")
print(f"simulated, 90 deg:   {period(np.radians(90)):.4f} s  ({period(np.radians(90)) / T0:.3f}x)")

Check yourself

0/3 answered

  1. Q1Which of these changes a pendulum's small-angle period?
  2. Q2An arm holds still, . Which term of do the motors still have to supply?
  3. Q3Release a pendulum from instead of . Its period is…
Next: PID control →

Chapter 06 · 2 · Physics & control · 30 min

PID control

The controller inside nearly every motor, drone and thermostat. Measure the error, push proportionally, damp with the derivative, and remove the leftover with the integral.

A controller closes the loop: measure where you are, compare with where you want to be, push. The error is (setpoint minus measurement), and the PID controller computes the push from three terms:

  • P, proportional, : a spring pulling towards the target. More means faster, but more overshoot and oscillation.
  • D, derivative, : a damper that resists motion. It brakes before you overshoot. It also amplifies sensor noise, so it is usually filtered.
  • I, integral, : memory. A constant disturbance (gravity on an arm, a headwind on a drone) leaves a steady error that P alone can't remove; the integral keeps growing until it does.

Why it overshoots: the second-order picture

Put a P controller on a mass with friction (). The closed loop becomes a mass-spring-damper with natural frequency and damping ratio . The percentage overshoot depends only on . With (critical damping) you get the fastest response with no overshoot, which tells you exactly how much to add.

Making it work on hardware

  • Take the derivative of the measurement, not the error, so a setpoint jump doesn't cause a huge "derivative kick".
  • Motors saturate. If the integral keeps accumulating while the motor is maxed out, it winds up and causes a huge overshoot later. Stop integrating while saturated (anti-windup).
  • Run the loop at a fixed rate (often 100 Hz to 10 kHz) and low-pass filter the D term.

A practical tuning order: raise until it is quick with some overshoot, add until the overshoot is gone, then add a little to remove the steady error.

Key equations

6.1PID control law

Proportional, integral and derivative (on the measurement) terms add up to the motor command .

6.2P-D loop on a mass with friction

The controller turns the cart into a virtual spring () and damper ().

6.3Overshoot of a second-order system

Only depends on the damping ratio: gives about 60 %; gives none.

6.4Derivative gain for critical damping

The smallest that removes overshoot for a given .

Try itPID tuner: a 1 kg cart with friction

Loading interactive…
Start with P only (60 % overshoot), then press PD (critically damped). Turn on the push at 7 s: with a steady error remains. Add sensor noise and see why big hurts.

Worked example · Predict the overshoot before you simulate

Cart: kg, N·s/m. P control with :

The simulation in the interactive measures 60.45 %. To remove the overshoot, add for : that is the PD preset, and it reaches the target with 0 % overshoot.

Try it in code

python
import numpy as np

class PID:
    def __init__(self, kp, ki, kd, dt, u_max=np.inf):
        self.kp, self.ki, self.kd, self.dt, self.u_max = kp, ki, kd, dt, u_max
        self.integral, self.prev_y = 0.0, None

    def __call__(self, setpoint, y):
        e = setpoint - y
        dy = 0.0 if self.prev_y is None else (y - self.prev_y) / self.dt   # derivative on measurement
        self.prev_y = y
        u = self.kp * e + self.ki * self.integral - self.kd * dy
        u_sat = np.clip(u, -self.u_max, self.u_max)
        if u == u_sat:                      # anti-windup: only integrate when not saturated
            self.integral += e * self.dt
        return u_sat

def step_response(kp, ki, kd, m=1.0, b=1.0, dt=0.001, t_end=10.0):
    pid, x, v, ys = PID(kp, ki, kd, dt), 0.0, 0.0, []
    for _ in range(int(t_end / dt)):
        u = pid(1.0, x)
        v += (u - b * v) / m * dt          # m x'' = u - b x'
        x += v * dt
        ys.append(x)
    return np.array(ys)

for name, gains in {"P": (10, 0, 0), "PD (critically damped)": (10, 0, 2 * np.sqrt(10) - 1), "PID": (12, 4, 5)}.items():
    y = step_response(*gains)
    print(f"{name:24s} overshoot {100 * max(0, y.max() - 1):5.1f} %   final {y[-1]:.3f}")
# P: ~60.5 % overshoot, as predicted by exp(-zeta*pi/sqrt(1-zeta^2)) with zeta = 0.158

Check yourself

0/3 answered

  1. Q1A drone holds altitude but sits 10 cm too low because of its weight. Which term removes that steady error?
  2. Q2Increasing mostly…
  3. Q3What is integral windup?

Build

Hold a DC motor's position (or a ball on a tilting beam) with a fixed-rate PID loop on an Arduino. Log the step response and measure the overshoot you predicted.

Next: State space & LQR →

Chapter 07 · 2 · Physics & control · 30 min

State space and LQR

When several states interact, like a pole balanced on a moving cart, you control them all at once. LQR finds the best gains by trading error against effort.

PID handles one input and one output. Many robots are coupled systems: balancing a pole on a cart means controlling the cart position, its speed, the pole angle and its rate, all with one motor. State space writes the whole system as a vector equation:

For the cart-pole the state is . The real dynamics are nonlinear, so we linearise around the upright equilibrium (, ). The open-loop has an eigenvalue at for our parameters: a positive eigenvalue means the pole falls exponentially.

Full-state feedback

Feed back every state, , and the closed loop becomes . It is stable when every eigenvalue of has a negative real part. If the system is controllable you can place those eigenvalues anywhere, but where should they go?

LQR: the best K for a cost you choose

The linear quadratic regulator picks to minimise

says which errors you care about (large weight on means "keep the pole upright above all"); says how expensive force is. The optimal comes from the Riccati equation, one line in SciPy or python-control. Raise and the controller becomes gentle and lazy; raise and it becomes aggressive.

A quirk you'll see in the interactive: to move the cart right, LQR first nudges it left so the pole tilts the right way. That's not a bug; it is the optimal answer for this non-minimum-phase system.

MPC (model predictive control) extends the idea: solve a finite-horizon version of this optimisation online, every few milliseconds, with constraints such as motor limits. It runs on quadrupeds, drones and self-driving cars.

Key equations

7.1Linear state-space model

Everything about the system's memory lives in the state vector .

7.2Cart-pole, linearised upright

Cart mass , point mass at the tip of a massless pole of length , measured from upright.

7.3LQR cost

penalises state error, penalises effort. You tune the trade-off, not the gains.

7.4Algebraic Riccati equation and optimal gain

Solve for (SciPy: solve_continuous_are), then is optimal.

7.5Closed-loop stability

All eigenvalues in the left half-plane. In discrete time: inside the unit circle.

Try itBalance a cart-pole with LQR

Loading interactive…
Push the pole, move the cart target, then turn the controller off and watch it fall. Lower for aggressive control; raise it and the cart gets lazy. The gain is re-solved from the Riccati equation every time you move a slider.

Worked example · The numbers behind the interactive

With kg, kg, m, the open-loop eigenvalues are . The is the pole falling: its tilt grows like , doubling every 0.14 s.

Choosing and , the Riccati equation gives

and closed-loop eigenvalues and : all in the left half-plane, so the pole is balanced. The code below also runs the full nonlinear model from and ends upright.

Try it in code

python
import numpy as np
from scipy.linalg import solve_continuous_are
from scipy.integrate import solve_ivp

M, m, l, g = 1.0, 0.2, 0.5, 9.81   # cart, pole tip mass, pole length, gravity

# Linearised about the upright pole; state x = [cart pos, cart vel, pole angle, pole rate]
A = np.array([[0, 1, 0, 0],
              [0, 0, -m * g / M, 0],
              [0, 0, 0, 1],
              [0, 0, (M + m) * g / (M * l), 0]])
B = np.array([[0], [1 / M], [0], [-1 / (M * l)]])

Q = np.diag([10, 1, 100, 1])   # care most about the pole angle
R = np.array([[0.1]])          # force is cheap-ish
P = solve_continuous_are(A, B, Q, R)
K = np.linalg.solve(R, B.T @ P)
print("K =", K.round(2))                                   # [[-10.  -11.66 -73.54 -14.83]]
print("open-loop poles:  ", np.linalg.eigvals(A).round(2))  # one at +4.85 -> falls
print("closed-loop poles:", np.linalg.eigvals(A - B @ K).round(2))

def nonlinear(t, s):
    x, xd, th, thd = s
    u = float((-K @ s)[0])
    xdd = (u + m * np.sin(th) * (l * thd**2 - g * np.cos(th))) / (M + m * np.sin(th) ** 2)
    return [xd, xdd, thd, (g * np.sin(th) - xdd * np.cos(th)) / l]

sol = solve_ivp(nonlinear, (0, 6), [0, 0, np.radians(15), 0], max_step=0.01)
print("pole angle after 6 s: %.5f rad" % sol.y[2, -1])     # ~0: balanced

Check yourself

0/3 answered

  1. Q1You increase (the cost of force) in LQR. The controller becomes…
  2. Q2The closed loop is stable when…
  3. Q3Why linearise the cart-pole before designing LQR?

Chapter 08 · 2 · Physics & control · 30 min

Sensors and the Kalman filter

Every sensor lies a little. The Kalman filter blends a motion model with noisy measurements, weighting each by how much it can be trusted.

Robots sense the world through imperfect instruments:

Sensor Measures Typical problem
Wheel / joint encoders rotation slip, calibration error, drift over distance
IMU (gyro + accelerometer) angular rate, acceleration gyro bias: integrated heading drifts
GPS position metre-level noise, dropouts indoors
Lidar ranges glass, rain, few-cm noise
Camera images lighting, motion blur, no direct depth

No single sensor is good enough, so we fuse them. The Kalman filter keeps two things: a best guess and its uncertainty, the covariance . Each step has two halves:

  1. Predict. Push the estimate through the motion model. Uncertainty grows: , where is how much you distrust the model.
  2. Update. A measurement arrives with noise covariance . Compute the Kalman gain and move the estimate toward the measurement by a fraction of the surprise . Uncertainty shrinks.

In one dimension the gain is just : if you are unsure ( large) and the sensor is good ( small), trust the sensor; otherwise trust your prediction. Fusing two Gaussian guesses always gives an answer more certain than either.

Tuning is mostly choosing and . too small and the filter trusts its model, so it lags behind real manoeuvres; too big and it just follows the noisy sensor. Try both in the interactive.

Robots are nonlinear, so in practice you'll use the extended Kalman filter (linearise with Jacobians each step) or the unscented one. In ROS 2 the robot_localization package fuses wheel odometry, IMU and GPS with an EKF or UKF out of the box.

Key equations

8.1Predict

Move the estimate with the model; add process noise to the uncertainty.

8.2Kalman gain

How much to trust this measurement, given current uncertainty and sensor noise .

8.3Update

Correct by a fraction of the innovation ; the uncertainty shrinks.

8.4Fusing two noisy estimates

A weighted average that leans toward the more precise source. The fused is smaller than both.

Try itKalman filter on a noisy range sensor

Loading interactive…
Crank the sensor noise and the filter still tracks the truth, with an honest band. Then mis-tune to (laggy) or (jittery) and watch the error grow.

Worked example · GPS + odometry

GPS says you are at m ( m). Wheel odometry predicts m ( m).

As a Kalman update: , so m. The fused estimate is more certain (0.95 m) than even the better sensor alone (1 m).

Try it in code

python
import numpy as np

rng = np.random.default_rng(0)
dt, n, q, sigma = 0.1, 300, 1.0, 2.0      # step, steps, process noise, sensor noise (m)

F = np.array([[1, dt], [0, 1]])           # constant-velocity model
H = np.array([[1.0, 0.0]])                # we only measure position
Q = q * np.array([[dt**3 / 3, dt**2 / 2], [dt**2 / 2, dt]])
R = np.array([[sigma**2]])

x_true = np.array([0.0, 1.0])
x, P = np.zeros(2), np.eye(2) * 10.0
err_meas, err_kf = [], []
for _ in range(n):
    x_true = F @ x_true + rng.multivariate_normal([0, 0], Q)
    z = H @ x_true + rng.normal(0, sigma, 1)
    # predict
    x, P = F @ x, F @ P @ F.T + Q
    # update
    S = H @ P @ H.T + R
    K = P @ H.T @ np.linalg.inv(S)
    x = x + K @ (z - H @ x)
    P = (np.eye(2) - K @ H) @ P
    err_meas.append(z[0] - x_true[0]); err_kf.append(x[0] - x_true[0])

rms = lambda e: np.sqrt(np.mean(np.square(e)))
print(f"sensor RMSE {rms(err_meas):.2f} m  ->  Kalman RMSE {rms(err_kf):.2f} m, gain K = {K[0, 0]:.3f}")

Check yourself

0/3 answered

  1. Q1The sensor noise goes up. The Kalman gain …
  2. Q2You fuse two independent estimates with m and m. The fused is about…
  3. Q3Why does heading from integrating a gyro alone go wrong over time?
Next: Localization & SLAM →

Chapter 09 · 3 · Autonomy · 30 min

Localization and SLAM

Wheel odometry drifts without limit. Particle filters lock the robot onto a known map, and SLAM builds the map while localizing in it.

Differential drive and odometry

Most mobile robots steer by spinning two wheels at different speeds. With wheel speeds and wheel base , the robot moves forward at and turns at . Integrate those over time and you get odometry: dead reckoning from wheel encoders.

Odometry drifts, and the error has no upper bound. A wheel that is 1 % larger than the other turns the robot slowly in a circle it doesn't know about. Slip on carpet, bumps and quantisation add more. After a few metres the robot is confidently wrong.

Localization: Monte Carlo

If you have a map, compare what the sensors see with what the map predicts. Monte Carlo localization (a particle filter) represents the belief as hundreds of guesses, the particles:

  1. Move every particle with the odometry, plus noise (we're not sure of the wheels).
  2. Weight every particle by how well the actual measurements match what that particle would see.
  3. Resample: clone the likely particles, drop the unlikely ones.

Unlike a Kalman filter it can hold several hypotheses at once ("I'm in corridor A or B") and can recover from being picked up and moved. Nav2 in ROS 2 uses a version of it called AMCL.

SLAM

Without a map, the robot must build one while localizing in it: simultaneous localization and mapping. Modern SLAM has a front end that matches scans or tracks image features between frames, and a back end that solves a pose graph: nodes are robot poses, edges are measured relative motions, and an optimiser finds the poses that best agree with every edge. The key moment is loop closure: recognising a place you've been before adds an edge that pulls the whole accumulated drift back into shape.

Tools you'll actually use: slam_toolbox (2-D lidar, ROS 2 default), Cartographer, RTAB-Map (RGB-D), ORB-SLAM3 (visual-inertial).

Key equations

9.1Differential-drive kinematics

Two wheel speeds become forward speed and turn rate. is the distance between the wheels.

9.2Odometry pose update

Dead reckoning: every small error is integrated forever.

9.3Particle weight from landmark ranges

Particle predicts range to landmark ; the closer to the real , the higher its weight.

9.4Pose-graph SLAM

Find the trajectory that best agrees with all measured relative motions , each weighted by its confidence .

Try itOdometry drift vs a particle filter

Loading interactive…
Let it wander, or drive it yourself. Odometry (grey) slowly curves away from the truth (amber); the particle filter (accent) stays locked on by ranging to the diamonds. Untick the landmarks and watch the particles spread out.

Worked example · How far does a 1 % wheel error take you?

Wheel base m, right wheel 1 % faster than it should be (). The robot thinks it drives straight, but it actually follows a curve of curvature

After 10 m the heading is off by rad , and the robot is m to the side of where odometry says. A 1 % calibration error became a 1.4 m position error in 10 m.

Try it in code

python
import numpy as np

rng = np.random.default_rng(1)
W, dt, N = 0.35, 0.05, 500                       # wheel base (m), step (s), particles
landmarks = np.array([[0, 0], [6, 0], [6, 4], [0, 4]], float)

def drive(p, vl, vr):
    """Differential drive: v = (vr+vl)/2, w = (vr-vl)/W (works on one pose or an array)."""
    v, w = (vr + vl) / 2, (vr - vl) / W
    th = p[..., 2]
    return np.stack([p[..., 0] + v * np.cos(th) * dt, p[..., 1] + v * np.sin(th) * dt, th + w * dt], -1)

truth = odom = np.array([1.0, 1.0, 0.0])
parts = truth + rng.normal(0, [0.1, 0.1, 0.05], (N, 3))
for k in range(400):
    vl, vr = 0.50, 0.58                           # gentle left curve
    truth = drive(truth, vl, vr)
    ml, mr = vl * 1.02 + rng.normal(0, 0.01), vr + rng.normal(0, 0.01)   # left encoder reads 2 % high
    odom = drive(odom, ml, mr)
    # particle filter: predict with noisy odometry, weight by landmark ranges, resample
    parts = drive(parts, ml * (1 + rng.normal(0, 0.05, N)), mr * (1 + rng.normal(0, 0.05, N)))
    z = np.linalg.norm(landmarks - truth[:2], axis=1) + rng.normal(0, 0.1, 4)
    d = np.linalg.norm(parts[:, None, :2] - landmarks[None], axis=2)
    w = np.exp(-0.5 * np.sum((d - z) ** 2, axis=1) / 0.2**2) + 1e-300
    w /= w.sum()
    parts = parts[rng.choice(N, N, p=w)]

est = parts[:, :2].mean(axis=0)
print(f"odometry error {np.linalg.norm(odom[:2] - truth[:2]):.2f} m, particle filter error {np.linalg.norm(est - truth[:2]):.2f} m")

Check yourself

0/3 answered

  1. Q1Why can't a robot rely on wheel odometry alone for a long trip?
  2. Q2What does resampling do in a particle filter?
  3. Q3In SLAM, a loop closure is…
Next: Path planning (A*) →

Chapter 10 · 3 · Autonomy · 25 min

Path planning: A*, Dijkstra and friends

Turn the map into a graph and search it. Dijkstra finds the cheapest path, A* finds the same path much faster with a good heuristic, and greedy search is fast but can be fooled.

Once a robot knows where it is on a map, it needs a route. The classic approach turns the map into a graph: each free cell of an occupancy grid is a node, moves to neighbours are edges with a cost (1 straight, diagonal).

  • Breadth-first search explores in rings and finds the path with the fewest steps, ignoring that diagonals are longer.
  • Dijkstra always expands the cheapest unexplored node first, using its cost-so-far . It finds the cheapest path but explores in every direction equally.
  • A* ranks nodes by , where is a heuristic estimate of the remaining cost. If never overestimates (it's admissible), A* still returns the optimal path but explores far fewer nodes, because it leans toward the goal. Dijkstra is just A* with .
  • Greedy best-first uses only . It's often fast, but a wall in the wrong place sends it down a long detour.

The heuristic must match the moves: Manhattan distance for 4-connected grids, octile distance for 8-connected, Euclidean for any-angle.

What real planners add

A robot isn't a point, so planners search a costmap where obstacles are inflated by the robot's radius (Nav2's inflation layer). Grids get huge in 3-D or for arms, so sampling-based planners (PRM, RRT, next chapter) take over there. And a global path isn't enough: a local controller (DWB, MPPI or Regulated Pure Pursuit in Nav2) follows it at 20 Hz while dodging people.

Key equations

10.1A* priority

Cost so far plus estimated cost to go. Expand the node with the smallest .

10.2Admissibility

Never overestimate the true remaining cost , and A* is guaranteed to return an optimal path.

10.3Octile distance (8-connected grid)

Exact cost on an empty 8-connected grid: go diagonally as far as possible, then straight.

10.4Edge relaxation

The core step shared by Dijkstra and A*: found a cheaper way to through ? Keep it.

Try itWatch the search

Loading interactive…
Paint walls, drag S and G, and replay each algorithm. The table compares all four on your map: A* and Dijkstra always tie on path length, but A* expands far fewer cells. Greedy is fastest and sometimes wrong; BFS ignores that diagonals cost .

Worked example · Is the octile heuristic exact on an empty grid?

From to on an empty 8-connected grid: go 3 diagonal steps to , then 2 straight.

Identical, so on open ground A* walks straight to the goal and expands almost nothing else. Obstacles make the true cost larger than , never smaller, so stays admissible and the path stays optimal.

Try it in code

python
import heapq, math

GRID = """
S....#....
.##..#.##.
.#...#..#.
.#.###..#.
.#......#G
""".split()

def astar(grid):
    H, W = len(grid), len(grid[0])
    find = lambda ch: next((r, c) for r in range(H) for c in range(W) if grid[r][c] == ch)
    start, goal = find("S"), find("G")
    def h(p):  # octile distance: admissible for 8-connected moves
        dx, dy = abs(p[0] - goal[0]), abs(p[1] - goal[1])
        return dx + dy + (math.sqrt(2) - 2) * min(dx, dy)
    g, parent, closed = {start: 0.0}, {start: None}, set()
    frontier = [(h(start), start)]
    while frontier:
        _, cur = heapq.heappop(frontier)
        if cur in closed:
            continue
        if cur == goal:
            path = []
            while cur:
                path.append(cur); cur = parent[cur]
            return path[::-1], g[goal], len(closed)
        closed.add(cur)
        for dr in (-1, 0, 1):
            for dc in (-1, 0, 1):
                nr, nc = cur[0] + dr, cur[1] + dc
                if (dr or dc) and 0 <= nr < H and 0 <= nc < W and grid[nr][nc] != "#":
                    if dr and dc and "#" in (grid[cur[0]][nc], grid[nr][cur[1]]):
                        continue  # no cutting corners
                    ng = g[cur] + (math.sqrt(2) if dr and dc else 1)
                    if ng < g.get((nr, nc), math.inf):
                        g[(nr, nc)], parent[(nr, nc)] = ng, cur
                        heapq.heappush(frontier, (ng + h((nr, nc)), (nr, nc)))
    return None, math.inf, len(closed)

path, cost, expanded = astar(GRID)
print(f"cost {cost:.3f}, {len(path)} cells, expanded {expanded}")
print(path)

Check yourself

0/3 answered

  1. Q1A* is guaranteed to find a shortest path when its heuristic…
  2. Q2Dijkstra's algorithm is the same as A* with…
  3. Q3Greedy best-first search (only h) is…

Build

Run your own A* on the occupancy grid slam_toolbox built in chapter 9, inflate obstacles by the robot radius, and compare your path with Nav2's planner.

Next: Arm motion planning →

Chapter 11 · 3 · Autonomy · 30 min

Motion planning for arms: C-space and RRT

An arm plans in configuration space, where it becomes a single point and obstacles become strange blobs. Random trees find paths where grids are hopeless.

Planning for an arm is harder than for a mobile robot: the whole arm must avoid obstacles, not just a point. The trick is to change space. In configuration space (C-space) each axis is one joint angle, so a 2-joint arm lives in a 2-D square (really a torus, because angles wrap around) and the entire arm becomes a single point. Every configuration where the arm touches an obstacle is painted as forbidden, . A collision-free motion is now just a curve through the free part, .

Obstacles in C-space look nothing like the obstacles in the room: one small ball becomes a long curved band, because many different combinations of joint angles hit it. Free space can even split into disconnected islands: start and goal in different islands means no motion connects them, and a correct planner must fail.

Why sampling

A 7-joint arm has a 7-D C-space. At 1° resolution that is cells: no grid search will ever finish. Sampling-based planners never build the grid. They only ask a collision checker "is this configuration free?" and "is this straight segment free?".

RRT (rapidly-exploring random tree) grows a tree from the start: sample a random configuration, find the nearest tree node, step a short distance toward the sample, keep the new node if the step is collision-free. Bias a few samples toward the goal and stop when you reach it. RRT is probabilistically complete (if a path exists, the chance of finding it goes to 1 with more samples) but not optimal, so its paths are shortened afterwards by shortcutting or replaced by RRT*.

In practice

MoveIt 2 uses OMPL (RRTConnect by default) with the FCL collision checker, then time-parameterises the path, adding velocities and accelerations that respect joint limits, so the motors can follow it.

Key equations

11.1Free configuration space

Plan a curve through and the whole arm is collision-free along it.

11.2RRT extend step

Step a fixed distance from the nearest tree node toward a random sample.

11.3Why grids fail in high dimensions

cells per joint, joints: exponential in the number of joints.

11.4Smooth time scaling (rest to rest)

Zero velocity at both ends: the simplest way to turn a path segment into a trajectory.

Try itC-space and RRT for a 2-link arm

Loading interactive…
Drag the red obstacles on the left and watch their C-space shadows change on the right. Tap the C-space to move the start or goal, then Plan with RRT and watch the tree grow and the arm follow the shortcut path. Put start and goal in different islands and the planner correctly gives up.

Worked example · Free space can split

In the interactive's default scene, the C-space map has 3 disconnected free regions. We checked this by flood-filling a grid of the C-space (with wrap-around). Of 12 random start/goal pairs, the 4 inside one region were all solved by RRT with collision-free paths, and none of the 8 pairs spanning different regions were "solved". That is exactly the right behaviour: no motion of the real arm connects them without hitting an obstacle.

Try it in code

python
import numpy as np

rng = np.random.default_rng(3)
obstacles = [((2.0, 2.0), 0.8), ((3.5, 0.8), 0.6), ((1.0, 3.6), 0.5)]   # circles in a 5 x 5 C-space

def free(p, q, res=0.02):
    """Collision-check the straight segment p -> q by sampling it."""
    for s in np.linspace(0, 1, max(2, int(np.linalg.norm(q - p) / res))):
        x = p + s * (q - p)
        if any(np.linalg.norm(x - c) < r for c, r in obstacles):
            return False
    return True

def rrt(start, goal, step=0.3, iters=3000, goal_bias=0.1):
    nodes, parent = [np.array(start, float)], [-1]
    goal = np.array(goal, float)
    for _ in range(iters):
        q_rand = goal if rng.random() < goal_bias else rng.uniform(0, 5, 2)
        i = int(np.argmin([np.linalg.norm(n - q_rand) for n in nodes]))
        d = q_rand - nodes[i]
        q_new = nodes[i] + d * min(1.0, step / (np.linalg.norm(d) + 1e-12))
        if not free(nodes[i], q_new):
            continue
        nodes.append(q_new); parent.append(i)
        if np.linalg.norm(q_new - goal) < step and free(q_new, goal):
            nodes.append(goal); parent.append(len(nodes) - 2)
            path, k = [], len(nodes) - 1
            while k >= 0:
                path.append(nodes[k]); k = parent[k]
            return path[::-1], len(nodes)
    return None, len(nodes)

path, n = rrt((0.3, 0.3), (4.6, 4.6))
length = sum(np.linalg.norm(b - a) for a, b in zip(path, path[1:]))
print(f"tree nodes {n}, path waypoints {len(path)}, length {length:.2f} (straight line {np.hypot(4.3, 4.3):.2f})")

Check yourself

0/3 answered

  1. Q1In configuration space, the robot arm is…
  2. Q2RRT is…
  3. Q3Why don't arm planners discretise C-space into a grid?
Next: Perception basics →

Chapter 12 · 3 · Autonomy · 25 min

Perception: cameras, depth and vision

How a 3-D point becomes a pixel, how two cameras recover depth, and why depth error grows with the square of distance.

The pinhole camera

A camera squashes the 3-D world onto a 2-D sensor. In the camera frame ( right, down, forward), a point lands on pixel

are the focal lengths in pixels and is the image centre. Together they form the intrinsic matrix . Where the camera sits on the robot, its extrinsics , is just a transform from chapter 2. Real lenses also bend straight lines, so you calibrate: wave a checkerboard in front of the camera and let OpenCV (or ROS 2's camera_calibration) estimate and the distortion coefficients.

Dividing by throws depth away: a small near object and a big far one can make the same image.

Getting depth back

  • Stereo: two cameras a baseline apart see the same point at slightly different columns. The shift is the disparity , so . Near things have big disparity; far things have tiny disparity. One pixel of disparity error therefore costs : depth error grows with distance squared.
  • RGB-D cameras project a pattern or time light pulses; lidar measures time of flight directly and returns a point cloud.

From pixels to things

Classic pipelines find features (corners, ORB) to track between frames; that's what visual SLAM uses. Modern pipelines run neural networks for detection (boxes), segmentation (pixels), and 6-DoF pose estimation. Point clouds are cleaned with voxel downsampling, the floor is removed by fitting a plane with RANSAC, and the rest is clustered into objects. Whatever the method, perception's output to the rest of the robot is always a pose in some frame, which takes us straight back to chapter 2.

Key equations

12.1Pinhole projection

Multiply by the intrinsics and divide by depth (). Depth is lost in the division.

12.2Depth from disparity

Wider baseline or longer focal length gives more disparity per metre.

12.3Depth error from disparity error

Twice as far means four times the error. Long-range stereo needs wide baselines.

Try itStereo depth, live

Loading interactive…
Drag the point away from the cameras: the disparity shrinks and the amber error band balloons. Widen the baseline to win accuracy back, and toggle whole-pixel rounding to see quantisation error.

Worked example · How good is stereo at 2.5 m and at 10 m?

px, cm. A point at m has disparity px. One pixel of matching error changes depth by m, about 7 cm.

At m: px and one pixel of error is m. Same camera, 16 times worse. That is why cars use lidar or wide-baseline stereo for long range.

Try it in code

python
import numpy as np

# Pinhole intrinsics: focal lengths and principal point, in pixels
fx = fy = 700.0
cx, cy = 320.0, 240.0
K = np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1]])

def project(P_cam):
    """3-D point in the camera frame (x right, y down, z forward) -> pixel (u, v)."""
    uvw = K @ P_cam
    return uvw[:2] / uvw[2]

B = 0.12                                   # stereo baseline (m)
P = np.array([0.3, 0.1, 2.5])              # point 2.5 m in front of the left camera
uL = project(P)
uR = project(P - np.array([B, 0, 0]))      # right camera is B metres to the right
d = uL[0] - uR[0]
print(f"disparity {d:.2f} px -> depth Z = f*B/d = {fx * B / d:.3f} m")            # 33.60 px -> 2.500 m
for Z in (1, 2.5, 5, 10):
    print(f"Z = {Z:4.1f} m: 1 px of disparity error = {Z**2 / (fx * B) * 100:6.1f} cm")

Check yourself

0/3 answered

  1. Q1With a fixed stereo rig, doubling the distance to an object makes the depth error roughly…
  2. Q2What does the intrinsic matrix contain?
  3. Q3You need better depth accuracy at 20 m. What helps most?
Next: ROS 2 architecture →

Chapter 13 · 4 · Software & learning · 30 min

ROS 2: nodes, topics, services and actions

The software glue of modern robots. Small programs (nodes) pass typed messages over topics, call services, run long actions, and you inspect all of it from the command line.

A real robot runs dozens of programs at once: camera driver, lidar driver, detector, localizer, planner, motor driver, logger. ROS 2 (Robot Operating System) is the open-source middleware and tool set that connects them. It is not an operating system; it runs on Linux (also macOS and Windows).

The building blocks

  • Node: one process (or part of one) with one job, written in Python (rclpy) or C++ (rclcpp).
  • Topic: a named, typed, many-to-many stream, /scan of type sensor_msgs/msg/LaserScan or /cmd_vel of type geometry_msgs/msg/Twist. Publishers don't know who listens. Use topics for continuous data.
  • Service: request and response, like a function call across processes (/get_map, /reset). Use them for quick queries.
  • Action: a long-running goal with feedback and cancel (navigate_to_pose, follow_joint_trajectory). Use them for tasks that take seconds or minutes.
  • Parameters configure nodes at runtime, launch files (Python) start whole systems, tf2 tracks frames, rosbag2 records and replays topics, and RViz2 visualises everything.

Under the hood

ROS 2 sits on DDS, an industrial publish-subscribe standard, so nodes discover each other automatically on the network: no central master. Each connection has QoS settings: reliable (re-send lost messages, good for commands and maps) vs best effort (drop late data, good for sensor streams where only the newest sample matters), history depth, and durability ("latched" maps that late joiners still receive).

The commands you will type every day

ros2 node list, ros2 topic list, ros2 topic echo /scan, ros2 topic hz /scan, ros2 service call, ros2 launch, ros2 bag record, plus colcon build to build your workspace. Install the current LTS distribution and work through the official tutorials linked below in order.

Key equations

13.1Topic bandwidth

Raw 640×480 RGB at 30 Hz is MB/s. Know this before streaming over Wi-Fi.

Try itA live ROS 2 graph

Loading interactive…
Watch messages flow. Kill /lidar_driver: half a second later the planner sees stale /scan data and stops publishing /cmd_vel, so the robot halts (the Hz readouts are 2-second averages, like ros2 topic hz). Raise packet loss with best-effort QoS, then switch to reliable. Call the /get_map service, then kill /map_server and call it again.

Worked example · Can I stream my camera over Wi-Fi?

Raw 640×480 RGB, 3 bytes per pixel: bytes per image. At 30 Hz that is 27.6 MB/s, or 221 Mbit/s, more than most real-world Wi-Fi delivers and with no room for anything else.

Options: run the detector on the robot and publish only /detections (a few hundred bytes); publish sensor_msgs/CompressedImage via image_transport (JPEG cuts it by roughly 10×); or lower the resolution and rate for remote viewing.

A complete rclpy node

python
import rclpy
from rclpy.node import Node
from rclpy.qos import qos_profile_sensor_data
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist


class SafetyStop(Node):
    """Drive forward; stop when anything is closer than stop_distance in front.
    Assumes a 360-degree scan whose first beam points forward (e.g. TurtleBot3)."""

    def __init__(self):
        super().__init__("safety_stop")
        self.declare_parameter("stop_distance", 0.5)
        self.pub = self.create_publisher(Twist, "cmd_vel", 10)
        # sensor data: best-effort QoS, only the latest scans matter
        self.create_subscription(LaserScan, "scan", self.on_scan, qos_profile_sensor_data)

    def on_scan(self, scan: LaserScan):
        n = len(scan.ranges)
        cone = list(scan.ranges[: n // 12]) + list(scan.ranges[-(n // 12):])   # +-30 degrees
        valid = [r for r in cone if scan.range_min < r < scan.range_max]
        stop = self.get_parameter("stop_distance").value
        cmd = Twist()
        cmd.linear.x = 0.0 if valid and min(valid) < stop else 0.2
        self.pub.publish(cmd)


def main():
    rclpy.init()
    node = SafetyStop()
    try:
        rclpy.spin(node)
    finally:
        node.destroy_node()
        rclpy.shutdown()


if __name__ == "__main__":
    main()

# Run:  python3 safety_stop.py --ros-args -p stop_distance:=0.4
# Watch: ros2 topic hz /cmd_vel    ros2 topic echo /cmd_vel

Check yourself

0/3 answered

  1. Q1You want 'drive to the kitchen', with progress updates and the option to cancel. Which ROS 2 mechanism fits?
  2. Q2A camera stream crosses a lossy Wi-Fi link. Which QoS reliability is usually right?
  3. Q3Which command shows how often messages arrive on /scan?

Build

Write a two-node package: one publishes a fake range sensor at 20 Hz, the other filters it and publishes /cmd_vel. Start both from one Python launch file, record a rosbag2, and replay it.

Next: Simulation →

Chapter 14 · 4 · Software & learning · 25 min

Simulation: physics engines and the sim-to-real gap

Simulators integrate the equations of motion step by step. The integrator and time step decide whether your simulated robot behaves, or quietly gains energy and explodes.

Everything in chapters 5 to 7 assumed we could solve the equations of motion. A physics engine does it numerically: every few milliseconds it computes forces, detects collisions, solves for contact forces, and advances positions and velocities by one time step . Add sensor models (cameras, lidar with noise) and you can develop, test and even train robots without touching hardware.

The time step matters

The simplest integrator, explicit Euler, updates position and velocity both from the old values. On a frictionless spring it adds a little energy every single step, a factor of exactly , so oscillations grow until the simulation explodes. Semi-implicit (symplectic) Euler updates velocity first and uses the new velocity for position. It's just as cheap but keeps energy bounded, which is why most game and robotics engines use it or a close relative. RK4 is very accurate per step but costs four force evaluations. Stiff contacts need small steps; robotics simulators typically run physics at hundreds of Hz to 1 kHz.

Which simulator?

  • Gazebo: the standard for ROS 2; sensors, plugins, worlds.
  • MuJoCo: fast, accurate contact; the go-to for control and RL research; models in MJCF XML.
  • NVIDIA Isaac Sim / Isaac Lab: GPU-accelerated, photorealistic rendering, thousands of robots in parallel for learning; scenes in USD.
  • Webots, PyBullet, Drake: also free and widely used.

Robots are described in URDF (ROS), MJCF (MuJoCo) or USD (Isaac), and converters exist between them.

The sim-to-real gap

Simulated friction, motor torque curves, latency, sensor noise and cable drag are never quite right, so a controller that's perfect in sim can fail on hardware. Two standard remedies: system identification (measure the real parameters and put them in the model) and domain randomisation (train or test across random masses, frictions, delays and lighting so the real world is just one more variation).

Key equations

14.1Explicit Euler

Both updates use old values. Simple, and it injects energy into oscillators.

14.2Semi-implicit (symplectic) Euler

Use the new velocity for the position. Same cost, bounded energy error.

14.3Explicit Euler on a spring

Exact for : energy grows geometrically every step, however small is.

Try itSame spring, three integrators

Loading interactive…
At ms explicit Euler's energy is already climbing; push the step toward 100 ms and it explodes while symplectic Euler and RK4 hold on. Shrink and all three converge to the exact cosine.

Worked example · How fast does explicit Euler blow up?

A 1 Hz spring () simulated at ms (100 Hz). Each step multiplies the energy by . After 10 s, that is 1000 steps:

The "frictionless" spring now has 51 times its starting energy. The interactive's readout shows the same 51.4× at 10 ms, while symplectic Euler stays within a few percent and RK4 within 0.0001 %.

A pendulum in MuJoCo (pip install mujoco)

python
import mujoco
import numpy as np

# A 1 m pendulum in MJCF (MuJoCo's XML format): a point mass on a massless rod
XML = """
<mujoco>
  <option timestep="0.001" integrator="RK4"/>
  <worldbody>
    <body pos="0 0 2">
      <joint name="hinge" type="hinge" axis="0 1 0"/>
      <geom type="capsule" fromto="0 0 0 0 0 -1" size="0.01" mass="0"/>
      <geom type="sphere" pos="0 0 -1" size="0.05" mass="1"/>
    </body>
  </worldbody>
</mujoco>
"""
model = mujoco.MjModel.from_xml_string(XML)
data = mujoco.MjData(model)
data.qpos[0] = np.radians(10)

angles, times = [], []
while data.time < 10:
    mujoco.mj_step(model, data)
    angles.append(data.qpos[0]); times.append(data.time)

a, t = np.array(angles), np.array(times)
up = np.where((a[:-1] < 0) & (a[1:] >= 0))[0]
print(f"MuJoCo period {np.mean(np.diff(t[up])):.3f} s vs 2*pi*sqrt(L/g) = {2 * np.pi * np.sqrt(1 / 9.81):.3f} s")

Check yourself

0/3 answered

  1. Q1Explicit Euler simulating an undamped spring makes the energy…
  2. Q2Domain randomisation means…
  3. Q3Why are GPU simulators like Isaac Lab or MuJoCo Playground popular for robot learning?
Next: Robot learning →

Chapter 15 · 4 · Software & learning · 35 min

Robot learning: RL, imitation and VLA models

When a task is too messy to model, learn it: from reward (reinforcement learning), from demonstrations (imitation learning), or by fine-tuning a vision-language-action foundation model.

Folding laundry, opening unfamiliar doors, walking on gravel: some tasks are too messy to write equations for. Robot learning replaces hand-written models with data.

Reinforcement learning

An MDP has states , actions , rewards and a discount . The goal is a policy that maximises the expected return . The action value is the return you expect after doing in and acting well afterwards. Q-learning learns it from experience with one update per step: nudge toward . Explore with probability , otherwise act greedily.

Real robots have continuous states and actions, so deep RL (PPO, SAC) uses neural networks and needs millions of steps. In practice that means training in parallel GPU simulation and transferring to hardware with domain randomisation. Designing the reward is half the work: a policy will exploit any loophole you leave (reward hacking).

Imitation learning

Often it is easier to show than to reward. Teleoperate the robot (for example a leader arm puppeteering a follower, as in Hugging Face's LeRobot with the SO-101), record observation–action pairs, and train a network to copy them: behaviour cloning. Its classic failure is compounding error: a small mistake leads to states the demonstrations never covered, where the policy makes bigger mistakes. Remedies: more diverse demos, DAgger-style corrections, and architectures that predict whole action chunks (ACT) or sample them with diffusion (Diffusion Policy).

Vision-language-action models

A VLA starts from a vision-language model and trains it to output robot actions: images plus an instruction ("put the red cup in the sink") in, motor commands out. They are pretrained on pooled data from many robots; the Open X-Embodiment dataset has 1M+ real trajectories from 22 robot types. OpenVLA is a 7B-parameter open model trained on 970k of those episodes. Physical Intelligence's π0 family (openpi), Octo and NVIDIA's GR00T for humanoids are open too. The workflow: collect a few dozen demos of your task, fine-tune, evaluate on many trials.

Key equations

15.1Discounted return

Rewards now count more than rewards later. With , a reward 10 steps away is worth .

15.2Bellman optimality

The value of an action is its reward plus the discounted value of acting optimally afterwards.

15.3Q-learning update

Move the estimate a fraction toward the one-step target. Converges to with enough exploration.

15.4Behaviour cloning

Plain supervised learning on demonstration pairs (observation , action ).

Try itQ-learning, live

Loading interactive…
Press Train live. Values spread backward from the +1 like ink, and the arrows become a policy. Compare with Show optimal values (value iteration): on the deterministic floor Q-learning converges to the same numbers. Then make the floor slippery and watch the policy keep away from the pit.

Worked example · One Q-learning update by hand

The robot is in a cell with , moves right, pays the step cost , and lands in a cell whose best action is worth . With and :

Repeat that millions of times and value propagates from the goal back to the start. In our checks on the interactive's grid world (no slip, ), Q-learning's values along its greedy path match value iteration to within , and its path length equals the optimal one.

Tabular Q-learning from scratch

python
import numpy as np

rng = np.random.default_rng(0)
# 4 x 4 grid world: start bottom-left (12), goal top-right (3, +1), pit (7, -1), wall (5)
W, H, START, GOAL, PIT, WALLS = 4, 4, 12, 3, 7, {5}
ACTIONS = [(0, -1), (1, 0), (0, 1), (-1, 0)]   # up, right, down, left

def step(s, a):
    x, y = s % W + ACTIONS[a][0], s // W + ACTIONS[a][1]
    s2 = s if not (0 <= x < W and 0 <= y < H) or y * W + x in WALLS else y * W + x
    r = 1.0 if s2 == GOAL else -1.0 if s2 == PIT else -0.04
    return s2, r, s2 in (GOAL, PIT)

Q = np.zeros((W * H, 4))
alpha, gamma, eps = 0.5, 0.95, 0.2
for episode in range(2000):
    s, done = START, False
    while not done:
        a = rng.integers(4) if rng.random() < eps else int(np.argmax(Q[s]))
        s2, r, done = step(s, a)
        target = r + (0 if done else gamma * Q[s2].max())
        Q[s, a] += alpha * (target - Q[s, a])     # the Q-learning update
        s = s2

arrows = "^>v<"
for y in range(H):
    print(" ".join("G" if (c := y * W + x) == GOAL else "P" if c == PIT else "#" if c in WALLS else arrows[int(np.argmax(Q[c]))] for x in range(W)))
print("V(start) =", round(Q[START].max(), 3))

Check yourself

0/3 answered

  1. Q1In -greedy, controls…
  2. Q2Behaviour cloning's classic failure mode is…
  3. Q3A vision-language-action (VLA) model maps…
Next: Humanoids & legged →

Chapter 16 · 4 · Software & learning · 30 min

Humanoids and legged locomotion

A walking robot is always falling and catching itself. The linear inverted pendulum and its capture point explain where to step, and RL in simulation now learns the rest.

Wheels never leave the ground; legs do. Legged robots are underactuated (nothing bolts the body to the floor) and hybrid (contacts switch on and off), which is why they look so different from the arms in earlier chapters.

Balance

A standing robot is balanced while the point where the ground pushes back, the centre of pressure (or ZMP, zero-moment point), stays inside the support polygon under its feet. Walking slowly enough to always keep the centre of mass over the feet is static walking. Humans and fast robots walk dynamically: they deliberately fall forward and catch themselves with the next step.

The linear inverted pendulum

Model the robot as a point mass at constant height balanced on a massless leg at foot position . Then

It is unstable: the mass accelerates away from the foot, exponentially. But it is linear, so it has a closed-form solution, and one quantity tells you everything: the capture point . Put the foot exactly on and the robot comes to rest over it. Step short and it keeps falling forward; step long and it falls back. Walking is choosing each footstep relative to the capture point; modern controllers regulate it directly (divergent component of motion control).

How today's humanoids are built

  • Model-based: MPC plans contact forces and footsteps over the next second on a simplified model (LIPM, centroidal dynamics); a whole-body controller solves a quadratic program at about 1 kHz for joint torques that realise them.
  • Learned: a neural policy maps joint states and IMU readings to joint targets, trained with RL across thousands of parallel simulated robots (legged_gym, Isaac Lab, MuJoCo Playground) with heavy domain randomisation, then deployed zero-shot. Most recent quadruped and humanoid demos use this, often combined with the model-based ideas above.
  • Foundation models such as NVIDIA's GR00T aim to give humanoids general manipulation skills on top.

Key equations

16.1Linear inverted pendulum

Centre of mass at constant height , foot at . Taller robots fall more slowly.

16.2Closed-form motion

Exponential divergence from the foot unless the initial conditions are just right.

16.3Capture point

Step here and the robot comes to rest over its foot. It moves as , away from the foot.

16.4Zero-moment point (LIPM)

Where the ground reaction must act to produce acceleration . It must stay inside the support polygon.

Try itPush it, then choose where to step

Loading interactive…
Push the robot to 0.6 m/s and step at the wrong place: it falls. Press Step on the capture point and it stops dead. Switch to Walk and set the step offset : stops after one step, and larger gives a steady gait.

Worked example · How big a step after a shove?

Centre of mass at m: s⁻¹. A shove gives it m/s while it stands over its foot at :

An 18 cm step catches it. Step 5 cm short and one second later the centre of mass is 0.67 m past the foot and still accelerating: it falls. The code below checks all three cases with the closed-form solution.

Try it in code

python
import numpy as np

g, z0 = 9.81, 0.9                 # gravity, centre-of-mass height (m)
w = np.sqrt(g / z0)               # LIPM natural frequency, 1/s

def lipm(x0, v0, p, t):
    """Closed-form LIPM: x'' = w^2 (x - p) with the foot (pivot) at p."""
    x = p + (x0 - p) * np.cosh(w * t) + v0 / w * np.sinh(w * t)
    v = (x0 - p) * w * np.sinh(w * t) + v0 * np.cosh(w * t)
    return x, v

v_push = 0.6                      # someone shoves the robot to 0.6 m/s
xi = 0.0 + v_push / w             # capture point
print(f"omega = {w:.2f} 1/s, capture point = {xi:.3f} m ahead")   # 3.30 1/s, 0.182 m

for foot in (xi - 0.05, xi, xi + 0.05):
    x, v = lipm(0.0, v_push, foot, t=1.0)
    verdict = "falls forward" if v > 0.05 else "falls backward" if v < -0.05 else "stops over the foot"
    print(f"step at {foot:.3f} m -> after 1 s COM is {x - foot:+.2f} m from the foot, v = {v:+.2f} m/s: {verdict}")

Check yourself

0/3 answered

  1. Q1A taller robot (larger ) receives the same shove. Its capture point is…
  2. Q2If the foot is placed exactly on the capture point, the LIPM…
  3. Q3Why do learned locomotion policies rely on domain randomisation?

$0 · go deeper

92 free courses, books & docs

39 full free courses (MIT, Stanford, ETH Zurich, Penn, Berkeley, Hugging Face, NVIDIA…) plus free textbooks and official docs, grouped by chapter. Every link checked 27 Nov 2026. “Free to audit” means the lectures are free; only certificates cost money.

tags

Showing 92 of 92

free course · MIT OCW

Strang's full lecture course: matrices, eigenvalues, least squares. The math under every robot transform.

MathcoursevideoMIT
Open verified 27 Nov 2026

free course · MIT OCW

Vectors, partial derivatives and gradients, used in Jacobians and optimization.

MathcoursevideoMIT
Open verified 27 Nov 2026
10

LearnCpp.com

learncpp.com

free tutorial

Complete free C++ tutorial, the language of ROS 2 drivers and controllers.

ProgrammingC++
Open verified 27 Nov 2026
11

The Missing Semester (MIT)

missing.csail.mit.edu

free course · MIT

Shell, editors, Git, debugging and build tools.

ProgrammingcourseLinux
Open verified 27 Nov 2026

free to audit · Coursera

Kevin Lynch's 6-course specialization: configuration space, rigid-body motion, kinematics, dynamics, planning, control.

Kinematics & dynamicscoursevideoaudit
Open verified 27 Nov 2026
13

Modern Robotics book and videos

hades.mech.northwestern.edu

free book · Northwestern

Free PDF of Lynch & Park's textbook plus all lecture videos and software.

Kinematics & dynamicsbookvideo
Open verified 27 Nov 2026

free course · Stanford

Oussama Khatib's classic course: kinematics, Jacobians, dynamics and control.

Kinematics & dynamicscoursevideoStanford
Open verified 27 Nov 2026

YouTube · Stanford

Stanford's full Introduction to Robotics lecture collection on YouTube.

Kinematics & dynamicsvideoStanford
Open verified 27 Nov 2026
16

QUT Robot Academy

robotacademy.net.au

free lessons · QUT

Peter Corke's short video lessons and masterclasses on robot arms, mobile robots and vision.

Kinematics & dynamicscoursevideo
Open verified 27 Nov 2026

course page · ETH Zurich

ETH's master's course on kinematics and dynamics of arms, legged robots and drones, with slides and exercises.

Kinematics & dynamicscourseETH
Open verified 27 Nov 2026

free course · MIT OCW

Newtonian and Lagrangian dynamics with lecture videos.

Kinematics & dynamicscoursevideoMIT
Open verified 27 Nov 2026

YouTube · U. Washington

Short lectures on state space, controllability, LQR and Kalman filters, with code.

Controlvideo
Open verified 27 Nov 2026

free course · MIT OCW

Classical feedback control: stability, compensation, frequency methods.

ControlcourseMIT
Open verified 27 Nov 2026

official tutorials

Arduino's own tutorials on electronics, sensors, motors and communication.

Electronics & embeddeddocsArduino
Open verified 27 Nov 2026
29

Raspberry Pi projects

projects.raspberrypi.org

free projects

Step-by-step electronics and coding projects from the Raspberry Pi Foundation.

Electronics & embeddedprojects
Open verified 27 Nov 2026
30

All About Circuits textbook

allaboutcircuits.com

free book

Free online electronics textbook: DC, AC, semiconductors, digital.

Electronics & embeddedbook
Open verified 27 Nov 2026

official docs

From CLI basics to writing nodes in Python and C++, TF2 and URDF.

ROS 2docsROS 2
Open verified 27 Nov 2026
32

official docs

Concepts, how-to guides and the full API reference.

ROS 2docsROS 2
Open verified 27 Nov 2026
34

Articulated Robotics

articulatedrobotics.xyz

free tutorials

Build a real ROS 2 mobile robot step by step, with matching videos.

ROS 2ROS 2projects
Open verified 27 Nov 2026
37

MoveIt 2 tutorials

moveit.picknik.ai

official docs

Motion planning for robot arms in ROS 2, from first plan to pick-and-place.

ROS 2docsROS 2
Open verified 27 Nov 2026
38

Gazebo tutorials

gazebosim.org

official docs

The standard open-source simulator for ROS 2 robots.

Simulationdocssim
Open verified 27 Nov 2026
39

NVIDIA Isaac Sim docs

docs.isaacsim.omniverse.nvidia.com

official docs

Photorealistic, GPU-accelerated simulation with ROS 2 support and tutorials.

SimulationdocssimNVIDIA
Open verified 27 Nov 2026
40

Isaac Lab

isaac-sim.github.io

official docs

NVIDIA's open framework for robot learning on Isaac Sim: RL, imitation, sim-to-real.

SimulationdocssimNVIDIA
Open verified 27 Nov 2026
41

MuJoCo documentation

mujoco.readthedocs.io

official docs

Google DeepMind's fast physics engine for robotics and RL.

Simulationdocssim
Open verified 27 Nov 2026
42

GitHub · DeepMind

Ready-to-use, high-quality models of real robots for MuJoCo.

SimulationGitHubsim
Open verified 27 Nov 2026
43

Webots tutorials

cyberbotics.com

official docs

Open-source simulator with beginner tutorials for wheeled and legged robots.

Simulationdocssim
Open verified 27 Nov 2026
44

PyBullet

pybullet.org

official site

Python physics simulation used in many robotics and RL papers.

SimulationsimPython
Open verified 27 Nov 2026

free learning path · NVIDIA

NVIDIA's free robotics learning content: Isaac Sim, Isaac ROS, Isaac Lab, GR00T and sim-to-real with SO-101.

SimulationcourseNVIDIA
Open verified 27 Nov 2026
47

Stanford CS231n

cs231n.stanford.edu

course · Stanford

Deep learning for computer vision: CNNs, detection, segmentation. Notes and lectures online.

Perception & visioncourseStanford
Open verified 27 Nov 2026
49

OpenCV tutorials

docs.opencv.org

official docs

Camera calibration, features, stereo and object detection with OpenCV.

Perception & visiondocs
Open verified 27 Nov 2026

free course · Uni Bonn

Full SLAM course: EKF, particle filters, graph-based SLAM, with slides and videos.

SLAM & state estimationcoursevideo
Open verified 27 Nov 2026

YouTube

Hundreds of lectures on SLAM, photogrammetry and robot perception.

SLAM & state estimationvideo
Open verified 27 Nov 2026
56

ORB-SLAM3

github.com

GitHub

Reference open-source visual-inertial SLAM system to study and run.

SLAM & state estimationGitHub
Open verified 27 Nov 2026
58

PythonRobotics

github.com

GitHub

Readable Python implementations of planning, localization, SLAM and control algorithms.

Motion planningGitHubPython
Open verified 27 Nov 2026
59

OMPL

ompl.kavrakilab.org

official docs

The Open Motion Planning Library behind MoveIt, with tutorials.

Motion planningdocs
Open verified 27 Nov 2026

course page · ETH Zurich

Locomotion, perception, localization and planning for mobile robots.

Mobile robots, drones & AVscourseETH
Open verified 27 Nov 2026
62

Duckietown docs

docs.duckietown.com

official docs

Learning materials and hands-on guides for the Duckietown platform.

Mobile robots, drones & AVsdocsprojects
Open verified 27 Nov 2026

free to audit · Coursera

Four courses: state estimation, perception and motion planning for self-driving cars.

Mobile robots, drones & AVscourseaudit
Open verified 27 Nov 2026
66

official docs

Open-source drone flight stack: setup, simulation and ROS 2 integration.

Mobile robots, drones & AVsdocsdrones
Open verified 27 Nov 2026
67

Autoware docs

docs.autoware.org

official docs

Open-source self-driving software stack built on ROS 2.

Mobile robots, drones & AVsdocsself-driving
Open verified 27 Nov 2026
68

free course + book · MIT

MIT 6.421 notes, lectures and runnable notebooks on perception, planning and control for manipulation.

ManipulationcoursebookMIT
Open verified 27 Nov 2026
69

Drake

drake.mit.edu

official docs

Model-based design and verification for robotics, used in Tedrake's courses.

Manipulationdocssim
Open verified 27 Nov 2026

free course · Hugging Face

Hugging Face's robot-learning course built around LeRobot.

Robot learningcourseHugging Face
Open verified 27 Nov 2026
72

LeRobot

github.com

GitHub · Hugging Face

Datasets, pretrained policies and training code for real-world robot learning in PyTorch.

Robot learningGitHubHugging Face
Open verified 27 Nov 2026

free course · Hugging Face

Hands-on deep reinforcement learning from Q-learning to PPO, with certificate.

Robot learningcourseHugging Face
Open verified 27 Nov 2026
76

OpenAI Spinning Up

spinningup.openai.com

free guide

Educational deep RL resource with clear algorithm write-ups and code.

Robot learningguide
Open verified 27 Nov 2026
77

David Silver's RL course

davidstarsilver.wordpress.com

free lectures

The classic UCL/DeepMind reinforcement learning lectures and slides.

Robot learningcoursevideo
Open verified 27 Nov 2026

free course + book · MIT

Nonlinear dynamics, optimal control, trajectory optimization and RL for walking and flying robots.

Robot learningcoursebookMIT
Open verified 27 Nov 2026
79

OpenVLA

openvla.github.io

open model

7B open-source vision-language-action model trained on Open X-Embodiment.

Robot foundation modelsmodelGitHub
Open verified 27 Nov 2026

GitHub · Physical Intelligence

Open weights and code for Physical Intelligence's π0 family of VLA models.

Robot foundation modelsmodelGitHub
Open verified 27 Nov 2026
81

Open X-Embodiment

robotics-transformer-x.github.io

dataset

Large open dataset pooled from many labs and robot types, plus RT-X models.

Robot foundation modelsdataset
Open verified 27 Nov 2026
82

Octo

octo-models.github.io

open model

Open generalist transformer policy, easy to fine-tune.

Robot foundation modelsmodel
Open verified 27 Nov 2026
83

Diffusion Policy

diffusion-policy.cs.columbia.edu

paper + code

Visuomotor policies trained as diffusion models, a common imitation-learning baseline.

Robot foundation modelspaperGitHub
Open verified 27 Nov 2026
84

GitHub · NVIDIA

Open foundation model for humanoid robots, with fine-tuning code.

Robot foundation modelsmodelGitHubNVIDIA
Open verified 27 Nov 2026
86

legged_gym

github.com

GitHub · ETH Zurich

ETH's environments for training legged robots to walk with massively parallel RL.

Humanoids & leggedGitHubETH
Open verified 27 Nov 2026
87

GitHub · DeepMind

GPU-accelerated environments for locomotion and manipulation, including humanoids, with sim-to-real examples.

Humanoids & leggedGitHubsim
Open verified 27 Nov 2026
88

HumanoidBench

humanoid-bench.github.io

benchmark

Simulated humanoid benchmark for whole-body locomotion and manipulation.

Humanoids & leggedbenchmark
Open verified 27 Nov 2026
89

GitHub · open hardware

Open-source low-cost robot arm used with LeRobot, with print files and build guides.

ProjectsprojectsGitHubhardware
Open verified 27 Nov 2026
90

TurtleBot3 e-Manual

emanual.robotis.com

official docs

Setup, SLAM, navigation and manipulation tutorials for the TurtleBot3 ROS robot.

ProjectsprojectsROS 2
Open verified 27 Nov 2026
91

F1TENTH course kit

f1tenth-coursekit.readthedocs.io

free course kit

Lectures, labs and assignments for building and racing a 1/10-scale autonomous car.

Projectsprojectscourse
Open verified 27 Nov 2026

How to use this course

Go in order: every chapter uses the ones before it. Read the explanation, play with the simulation until the equations feel obvious, run the code, then take the quiz. Mark a chapter done and the page remembers where you were, in this browser only, with no account. When a chapter clicks, follow its "go deeper" links: those are full free university courses, textbooks and official docs.

FAQ

Can I learn robotics engineering for free?

Yes. Every course, textbook and tool linked here is free to use or audit: MIT OpenCourseWare, Stanford, ETH Zurich, QUT Robot Academy, the Modern Robotics book and videos, and the official ROS 2, Gazebo, MuJoCo and Isaac docs. ROS 2, Gazebo, MuJoCo and Python are free software. The only real cost is hardware, and you can do most of this course in simulation.

What math do I need for robotics?

Linear algebra (vectors, matrices, rotations), calculus and ordinary differential equations (motion), and probability (noisy sensors). Chapters 1–4 teach the geometry you need as you go, and 3Blue1Brown's Essence of linear algebra is the best free refresher.

Should I learn ROS 2?

Yes, if you want to build real robots or work in industry: it is the standard way to connect drivers, perception, planning and control. Learn the core ideas first (chapters 1–12 here), then do the official ROS 2 tutorials; chapter 13 explains nodes, topics, services, actions and QoS.

Python or C++ for robotics?

Both. Python for prototyping, machine learning and most of this course; C++ for real-time control and performance-critical ROS 2 nodes. Start with Python.

How long does this take?

Reading and playing with all 16 chapters takes about 7 hours. Working through the linked courses properly takes months: treat each chapter's "go deeper" list and build project as the real work.

Are the simulations accurate?

They use the real equations: RK4 integration, discrete-time LQR, a particle filter, A*, RRT and Q-learning, written from scratch and unit-tested against closed-form answers (pendulum periods, overshoot formulas, Riccati solutions, value iteration). They are simplified to 2-D so they run on a phone, not replacements for Gazebo or MuJoCo.

One new goldmine a day

Get the next list before it goes viral.

Free. One email when a new list drops. No spam, unsubscribe in one click.

Or follow @eng_khairallah1 on X.

More goldmines