📖 Scenario: You are building a robot navigation system using ROS. Your robot needs to move safely and efficiently in a room. To do this, you will set up two popular local planners: DWA (Dynamic Window Approach) and TEB (Timed Elastic Band). These planners help the robot decide how to move step-by-step.
🎯 Goal: Set up the ROS configuration files to use the DWA and TEB local planners. You will create the initial YAML configuration for the planners, add a parameter to select which planner to use, implement the ROS launch file to load the planner, and finally complete the setup to run the local planner node.
📋 What You'll Learn
Create a YAML file with DWA and TEB planner configurations
Add a ROS parameter to select the active local planner
Write a ROS launch file that loads the selected planner configuration
Complete the launch file to start the local planner node with the chosen planner
💡 Why This Matters
🌍 Real World
Robots use local planners like DWA and TEB to safely navigate around obstacles and reach goals in real environments such as warehouses or homes.
💼 Career
Understanding how to configure and launch local planners in ROS is essential for robotics engineers working on autonomous navigation systems.
Progress0 / 4 steps
1
Create the YAML configuration for DWA and TEB planners
Create a YAML file named local_planner.yaml with two sections: dwa_local_planner and teb_local_planner. For dwa_local_planner, set max_vel_x to 0.5 and min_vel_x to 0.1. For teb_local_planner, set max_vel_x to 0.6 and min_vel_x to 0.1.
ROS
Hint
Use YAML syntax with indentation. Define two top-level keys: dwa_local_planner and teb_local_planner. Under each, add max_vel_x and min_vel_x with the exact values.
2
Add a ROS parameter to select the active local planner
In a new ROS launch file named local_planner.launch, add a parameter called local_planner_type and set its default value to "dwa".
ROS
Hint
Use the <arg> tag inside the <launch> tag to define the parameter.
3
Load the selected planner configuration based on the parameter
In local_planner.launch, add a group tag that uses if condition to load local_planner.yaml with the dwa_local_planner parameters if local_planner_type is "dwa", or teb_local_planner parameters if it is "teb".
ROS
Hint
Use <group if=...> to conditionally load parameters. Use <rosparam> with file, command="load", and param attributes.
4
Start the local planner node with the chosen planner
In local_planner.launch, add a node tag to start the move_base node. Use the parameter local_planner_type to set the base_local_planner parameter to "dwa_local_planner/DWAPlannerROS" if local_planner_type is "dwa", or "teb_local_planner/TEBLocalPlanner" if it is "teb".
ROS
Hint
Use a <node> tag with pkg="move_base" and type="move_base". Inside, add a <param> tag with name="base_local_planner" and use $(eval ...) to select the planner string based on local_planner_type.
Practice
(1/5)
1. What is the main purpose of a local planner like DWA or TEB in ROS?
easy
A. To control the robot's battery usage
B. To map the entire environment for the robot
C. To help the robot navigate safely around obstacles nearby
D. To communicate with other robots
Solution
Step 1: Understand the role of local planners
Local planners focus on immediate surroundings to avoid obstacles and plan short paths.
Step 2: Compare options
Mapping the environment is done by global planners or mapping nodes, not local planners.
Final Answer:
To help the robot navigate safely around obstacles nearby -> Option C
Quick Check:
Local planner = safe nearby navigation [OK]
Hint: Local planners handle nearby obstacles, not mapping or communication [OK]
Common Mistakes:
Confusing local planner with global planner
Thinking local planner maps environment
Assuming local planner manages robot hardware
2. Which of the following is the correct way to enable the DWA local planner in a ROS navigation stack configuration file?
easy
A. base_local_planner: "dwa_local_planner/DWAPlannerROS"
B. base_local_planner: "teb_local_planner/TEBPlanner"
C. planner: "global_planner/GlobalPlanner"
D. planner: "dwa_local_planner/DWAPlannerROS"
Solution
Step 1: Identify the correct parameter name for local planner
The parameter to specify the local planner plugin is usually 'base_local_planner'.
Step 2: Match the correct plugin name for DWA
DWA local planner plugin is 'dwa_local_planner/DWAPlannerROS'. base_local_planner: "dwa_local_planner/DWAPlannerROS" matches this exactly.
Final Answer:
base_local_planner: "dwa_local_planner/DWAPlannerROS" -> Option A
Quick Check:
Correct plugin name and parameter = base_local_planner: "dwa_local_planner/DWAPlannerROS" [OK]
Hint: Look for 'base_local_planner' key with DWA plugin name [OK]
Common Mistakes:
Using 'planner' instead of 'base_local_planner'
Confusing DWA and TEB plugin names
Using global planner plugin name for local planner
3. Given the following ROS parameter snippet for TEB local planner:
DWA uses parameters like obstacle distance to decide when to start avoiding obstacles.
Step 2: Analyze effect of low obstacle distance
If set too low, the planner reacts too late, causing collisions.
Final Answer:
The obstacle distance parameter is set too low, causing late avoidance -> Option A
Quick Check:
Late avoidance due to low obstacle distance = The obstacle distance parameter is set too low, causing late avoidance [OK]
Hint: Check obstacle distance parameter if collisions occur [OK]
Common Mistakes:
Blaming global planner for local planner issues
Ignoring parameter tuning for obstacle avoidance
Assuming hardware issues cause collisions without evidence
5. You want your robot to navigate a narrow corridor smoothly using the TEB local planner. Which combination of parameters should you adjust to improve smooth turning and obstacle clearance?
hard
A. Increase min_turning_radius and decrease obstacle_avoidance_force
B. Increase max_vel_x and decrease max_vel_theta
C. Decrease max_vel_x and disable obstacle avoidance
D. Decrease min_turning_radius and increase obstacle_avoidance_force
Solution
Step 1: Understand min_turning_radius effect
Decreasing min_turning_radius allows tighter turns, useful in narrow corridors.