CodeTheRobot

Ubuntu Linux for Robotics · Lesson 80 of 96

Local planner

The controller server, DWB and Regulated Pure Pursuit, and tuning speeds.

Estimated time · 45–75 min

Learning goals

What you will understand

  • Explain local planner in your own words
  • Use it in a small workstation example
  • Verify the result instead of assuming it worked

Understand the idea first

The mental model

The local planner (controller) follows the global path and avoids obstacles in the local costmap, publishing velocity commands on /cmd_vel. DWB samples velocity commands and scores their trajectories; Regulated Pure Pursuit follows the path smoothly and slows near obstacles and sharp turns.

Speed limits and accelerations must match what the robot can really do. Inspect them with ros2 param get /controller_server FollowPath.max_vel_x and change them live while testing. If the robot oscillates, reduce speed or check localization before changing critics.

Guided lesson

Work through these steps

  1. 1.

    Open a terminal and record the current state before changing anything.

  2. 2.

    Read the local planner commands and predict what each one does.

  3. 3.

    Run the commands one at a time and compare each output with your prediction.

  4. 4.

    Write the commands that worked in a setup note you can repeat later.

Worked example

Read it before you run it

ros2 param get /controller_server controller_plugins
# Which controller plugins are loaded.
ros2 param get /controller_server FollowPath.max_vel_x
# Maximum forward speed.
ros2 param set /controller_server FollowPath.max_vel_x 0.3
# Slow the robot down for a test.
ros2 topic echo /cmd_vel
# Watch the commands the controller sends.
ros2 topic hz /cmd_vel
# Check the controller rate.

What the example is doing

  1. 1.Lines without sudo only inspect or change files you own; sudo authorizes a system-wide change.
  2. 2.Read command output before moving to the next line. Stop if names, versions, disks, or paths differ from the lesson.
  3. 3.Comments beginning with # explain safety checks and are not executed by the shell.

Watch it run · Mobile robot

See what this code does

The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.

goalMOBILE ROBOT

Demo for Local planner. Expected result: Double value is: 0.3

Practice code

Now type it yourself

Open a terminal, run the starter line by line (or save it as practice.sh and run bash practice.sh), and replace every TODO with your own command.

# TODO: set max_vel_x of the FollowPath controller to 0.3 and read it back

Expected output

Double value is: 0.3
Stuck? Show the full solution (try it yourself first)
ros2 param set /controller_server FollowPath.max_vel_x 0.3
ros2 param get /controller_server FollowPath.max_vel_x

Expected result

How you know it worked

  • Each command completes without an unexplained error.
  • Your notes contain the command, the important output, and what it proves.

Practical exercise

Apply the lesson

Send a goal at three different maximum speeds and record the time and any oscillation. Switch to Regulated Pure Pursuit and compare.

Before you continue

  • You recorded the starting state
  • Every command and output is understood
  • The change can be repeated from your notes

If something goes wrong

A command says permission denied.

Check ownership and permissions first. Do not add sudo unless the command changes a documented system location.

A command or package is not found.

Check spelling, Ubuntu version, enabled repositories, and whether the previous installation command succeeded.