FixTheRobot Explore Robotics / Systems Engineering / Design & Selection / Module 13

Design & Selection · Module 13

Selecting a local controller

The controller turns a path into velocity commands. Choose by drive type, compute budget and how it handles obstacles, then check that its horizon outlasts your stopping distance.

  • Intermediate
  • Module 13: Navigation Stack & Autonomous Motion Planning
  • Written for ROS 2 Jazzy where ROS 2 is used
  • Sources checked 2026-11-06

Assumptions: Numbers in the examples are illustrative and the code is executed by the site’s tests. Facts taken from a cited source are marked; other statements are general engineering knowledge and must be confirmed on the datasheet of the part you use.

1. Engineering problem

The local controller tracks the global path while avoiding what the local costmap shows. Different controllers suit different robots and behave differently near obstacles and at speed.

2. When is this needed?

  • Setting up Nav2.
  • When the robot oscillates, cuts corners or stops short of obstacles.
  • When moving to a different drive type.

3. Selection and design decisions

From the Nav2 READMEs (jazzy, read 2026-11-06): DWB has plugin-based critics and trajectory generators that work for omnidirectional and differential drive robots, with critics for circular and non-circular robots. Regulated Pure Pursuit is a pure-pursuit variant with regulation of speed near collisions and adaptive lookahead, suitable for differential, legged and Ackermann robots (omnidirectional platforms work but cannot use the lateral motion). MPPI is a predictive controller with critic plugins that works with differential, omnidirectional and Ackermann robots; its README reports 50+ Hz on a modest Intel processor. The default Nav2 parameters run the controller server at 20 Hz and configure MPPI with 56 time steps of 0.05 s, batch size 2000, vx_max 0.5 and ax_min −3.0.

Overview
ControllerDrive typesCharacter
DWBDifferential, omnidirectionalCritic-based sampling of velocities; highly tunable
Regulated Pure PursuitDifferential, legged, Ackermann (omnidirectional limited)Path tracking with speed regulation; simple and predictable
MPPIDifferential, omnidirectional, AckermannModel-predictive sampling with critics; more compute

4. Advantages and disadvantages

  • Predictive controllers handle dynamic obstacles and cost compute.
  • Pure pursuit tracks well and has less obstacle-avoidance ability in the controller.
  • Tuning effort: DWB and MPPI have many critic weights.

5. Requirements and constraints

  • Control frequency is met on the target computer.
  • The lookahead or horizon is longer than the stopping distance.
  • The costmap resolution and update rate suit the controller.

6. Architecture

path ─▶ controller server (plugin, controller_frequency) ─▶ cmd_vel ─▶ base controller; local costmap feeds obstacle costs

7. Implementation

  1. Use the chooser (below) to shortlist from the drive type.
  2. Check the compute budget and the control frequency.
  3. Compute the horizon and the stopping distance (below).
  4. Tune the speed limits and acceleration limits to the real robot.
  5. Test with obstacles at the highest speed.
def controllers(drive):
    out = {"DWB": {"diff", "omni"}, "RegulatedPurePursuit": {"diff", "omni", "ackermann", "legged"}, "MPPI": {"diff", "omni", "ackermann"}}
    return [name for name, d in out.items() if drive in d]
for d in ("diff", "ackermann", "legged"):
    print(d, "->", controllers(d))
time_steps, model_dt, vx_max, ax_min, freq = 56, 0.05, 0.5, -3.0, 20.0     # values from the Nav2 jazzy default MPPI configuration
horizon_s = time_steps * model_dt
stop = vx_max ** 2 / (2 * abs(ax_min))
print(f"MPPI horizon {horizon_s:.1f} s at {vx_max} m/s looks {horizon_s * vx_max:.2f} m ahead; stopping distance at the configured deceleration {stop:.3f} m")
print(f"controller period at {freq:.0f} Hz: {1000 / freq:.0f} ms")

Printed (checked by the site’s tests):

diff -> ['DWB', 'RegulatedPurePursuit', 'MPPI']
ackermann -> ['RegulatedPurePursuit', 'MPPI']
legged -> ['RegulatedPurePursuit']
MPPI horizon 2.8 s at 0.5 m/s looks 1.40 m ahead; stopping distance at the configured deceleration 0.042 m
controller period at 20 Hz: 50 ms

Reading it: the three controllers cover the drive types as shown; the default MPPI horizon of 2.8 s at 0.5 m/s looks 1.40 m ahead, far beyond the 0.042 m needed to stop at the configured 3 m/s² deceleration, and the 20 Hz control period is 50 ms. These are the default parameter values, and your robot’s real deceleration (limited by traction and the motor driver) is usually much smaller than the configured one: measure it.

8. Real examples

  • Ackermann delivery cart: Regulated Pure Pursuit or MPPI with Ackermann constraints.

9. Failure scenarios

  • A configured deceleration the robot cannot achieve.
  • A controller frequency the CPU cannot sustain.
  • A horizon shorter than the stopping distance.

10. Troubleshooting

  1. If the robot oscillates, see the oscillation page and reduce gains or speed.
  2. If it cuts corners, reduce the lookahead or the speed.
  3. If it stops short, check inflation and critic weights.

11. Validation

  • The chooser prints the lines shown (executed by the site tests).
  • Stopping tests at maximum speed end before the obstacle.

12. Engineering checklist

13. Further references

Related on FixTheRobot