Module 4 · Path Following & Kinematics
A good autonomous routine needs two abilities: driving to any pose on the field, and following a smooth path through many poses at speed without stopping to re-aim. This module builds up to both.
This module builds on two earlier pieces:
- Pose Estimation Contract: configure one maintained external localization stack, then verify its frame, units, freshness, and once-per-loop update boundary.
- Control Theory: the PID and feedforward loops that turn an error into a motor command.
When a follower misbehaves, the bug is usually in the pose estimate or the controller underneath, not in the path logic.
Five steps every loop
Every follower in this module, from the simplest go-to-pose to a guided vector field, runs the same five steps every loop. They only differ in how they do steps 2 and 3.
| Step | What happens | Where it lives |
|---|---|---|
| 1. Update pose | update one external pose source once, then read one coherent field pose/velocity sample | Pose Estimation Contract |
| 2. Plan the target | pick where to go next — a target pose, a lookahead point, or a field vector | this module |
| 3. Control | turn the error into a chassis command with PID + feedforward | this module + Module 2 |
| 4. Mix & correct | convert the chassis command to wheel powers, desaturate, re-run next loop | Mecanum kinematics |
| 5. Resolve outcome | stop on REACHED or TIMED_OUT, then advance or recover explicitly | Common Implementation |
A follower that never decides it's done will wander around the target forever, and one that only checks position will say it's done while still coasting through. Check that the robot is close enough and slow enough. A timeout is a separate outcome, a failure to recover from, never a successful arrival.
All the followers share a few building blocks: the Pose2d and Vector2d types, wrap, the
MoveStatus result, kStatic, and drive. They're defined once in
Common Implementation, so each lesson's code only shows what's new.
See it on a real robot
Before the math, here's a competitive team walking through their own movement code on real hardware.
Wolfpack & Lupine (Waring Robotics) walk through their autonomous movement code from start to finish.
Open videoLessons, simplest first
Start with the follower you can debug by watching it, and only add more when you hit a real limit.
- Mecanum kinematics (Easy): turning one drive command into four wheel powers, plus field-centric driving, joystick shaping, and a dead zone. This is step 4, and it comes first so everything later has a drivetrain to command.
- Angle wrapping (Easy): the small fix that stops the robot turning the long way around. Every pose controller needs it.
- Pose Estimation Contract (Easy): set up one localization library and check its frame, units, and timing.
- Common Implementation (Easy): the shared types and helpers every follower uses.
- PID-to-point (Medium): the simplest complete follower. Three PID loops drive to one target pose, with a friction nudge and braking that starts on time. Most autonomous routines are just a list of these.
- Splines (Hard): ways to describe a smooth path, with Bézier curves, quintic Hermite splines, and natural cubic splines.
- Pure pursuit (Hard): chase a point a fixed distance ahead on the path, and plan speed around the curves.
- Guided vector fields (Hard): follow a path as a field of arrows that pulls the robot onto it, instead of chasing a point.
Lessons 1 to 5 get you a working, debuggable autonomous. Lessons 6 to 8 add smooth paths and speed.
Side branch: Inverse Kinematics turns a claw target into arm joint angles. It uses the same geometry but isn't needed for the followers.
Longer derivations, like Jacobian inverse kinematics and how Pedro Pathing works, are in Advanced Topics.