Bird
Raised Fist0
ROSframework~10 mins

Local planner (DWA, TEB) in ROS - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Local planner (DWA, TEB)
Start: Receive robot pose & goal
↓
Generate candidate trajectories
↓
Evaluate trajectories with cost functions
↓
Select best trajectory
↓
Send velocity commands to robot
↓
Repeat until goal reached or stopped
The local planner receives the robot's current position and goal, creates possible paths, scores them, picks the best, and sends commands to move the robot.
Execution Sample
ROS
while not goal_reached:
  trajectories = generate_candidates(current_pose)
  costs = evaluate_trajectories(trajectories)
  best = select_best(costs)
  send_velocity(best)
  update_pose()
This loop generates and evaluates paths, then commands the robot to follow the best one until the goal is reached.
Execution Table
StepCurrent PoseGenerated TrajectoriesCost EvaluationSelected TrajectoryCommand SentGoal Reached
1(x=0, y=0, theta=0)5 paths around current poseCosts calculated for each pathPath #3 with lowest costVelocity command for Path #3No
2(x=0.1, y=0, theta=0.05)5 new paths from updated poseCosts recalculatedPath #3 selectedVelocity command for Path #3No
3(x=0.2, y=0.05, theta=0.1)5 paths generatedCosts evaluatedPath #2 chosenVelocity command for Path #2No
4(x=0.3, y=0.1, theta=0.15)5 paths generatedCosts evaluatedPath #4 chosenVelocity command for Path #4No
5(x=0.4, y=0.15, theta=0.2)5 paths generatedCosts evaluatedPath #1 chosenVelocity command for Path #1Yes
💡 Goal reached at step 5, loop ends
Variable Tracker
VariableStartAfter 1After 2After 3After 4Final
current_pose(0,0,0)(0.1,0,0.05)(0.2,0.05,0.1)(0.3,0.1,0.15)(0.4,0.15,0.2)(0.4,0.15,0.2)
selected_trajectoryNonePath #3Path #3Path #2Path #4Path #1
goal_reachedFalseFalseFalseFalseFalseTrue
Key Moments - 3 Insights
Why does the planner generate multiple trajectories each step instead of just one?
The planner creates many possible paths to compare and pick the safest and most efficient one, as shown in the 'Generated Trajectories' column in the execution_table.
How does the planner decide which trajectory to pick?
It calculates costs for each path based on safety, distance, and smoothness, then selects the one with the lowest cost, as seen in the 'Cost Evaluation' and 'Selected Trajectory' columns.
When does the loop stop running?
The loop stops when the 'Goal Reached' variable becomes True, meaning the robot has arrived at its destination, as shown in the last row of the execution_table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the current_pose at step 3?
A(0.1, 0, 0.05)
B(0.2, 0.05, 0.1)
C(0.3, 0.1, 0.15)
D(0.4, 0.15, 0.2)
💡 Hint
Check the 'Current Pose' column at step 3 in the execution_table.
At which step does the planner send the velocity command for Path #1?
AStep 2
BStep 4
CStep 5
DStep 3
💡 Hint
Look at the 'Command Sent' column in the execution_table for Path #1.
If the goal was not reached at step 5, what would happen next?
AThe planner would generate new trajectories again
BThe robot would stop moving
CThe loop would stop
DThe selected trajectory would be ignored
💡 Hint
Refer to the 'Goal Reached' column and the loop logic in the variable_tracker.
Concept Snapshot
Local planners like DWA and TEB:
- Take current robot pose and goal
- Generate many possible paths
- Score each path by cost functions
- Pick the best path to follow
- Send velocity commands to robot
- Repeat until goal is reached
Full Transcript
The local planner in ROS works by continuously receiving the robot's current position and the target goal. It then generates multiple possible paths the robot could take. Each path is scored using cost functions that consider safety, distance, and smoothness. The planner selects the path with the lowest cost and sends velocity commands to the robot to follow it. This process repeats, updating the robot's pose and generating new paths until the robot reaches its goal. This approach helps the robot navigate safely and efficiently in dynamic environments.

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

  1. Step 1: Understand the role of local planners

    Local planners focus on immediate surroundings to avoid obstacles and plan short paths.
  2. Step 2: Compare options

    Mapping the environment is done by global planners or mapping nodes, not local planners.
  3. Final Answer:

    To help the robot navigate safely around obstacles nearby -> Option C
  4. 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

  1. Step 1: Identify the correct parameter name for local planner

    The parameter to specify the local planner plugin is usually 'base_local_planner'.
  2. 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.
  3. Final Answer:

    base_local_planner: "dwa_local_planner/DWAPlannerROS" -> Option A
  4. 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:
teb_local_planner:
  max_vel_x: 0.5
  max_vel_theta: 1.0
  min_turning_radius: 0.2
What will happen if the robot tries to turn with an angular velocity of 1.5 rad/s?
medium
A. The planner will allow the turn at 1.5 rad/s
B. The planner will limit the angular velocity to 1.0 rad/s
C. The planner will stop the robot immediately
D. The planner will ignore the max_vel_theta parameter

Solution

  1. Step 1: Understand max_vel_theta parameter

    This parameter sets the maximum allowed angular velocity for the robot.
  2. Step 2: Compare requested angular velocity with max_vel_theta

    The requested 1.5 rad/s exceeds the max of 1.0 rad/s, so the planner limits it to 1.0 rad/s.
  3. Final Answer:

    The planner will limit the angular velocity to 1.0 rad/s -> Option B
  4. Quick Check:

    Angular velocity capped by max_vel_theta = The planner will limit the angular velocity to 1.0 rad/s [OK]
Hint: Planner caps velocities at max limits set in parameters [OK]
Common Mistakes:
  • Assuming planner allows velocities above max
  • Thinking planner stops robot on limit breach
  • Ignoring max_vel_theta parameter
4. You configured the DWA local planner but the robot keeps colliding with obstacles. Which of the following is the most likely cause?
medium
A. The obstacle distance parameter is set too low, causing late avoidance
B. The global planner is disabled
C. The robot's battery is low
D. The robot's wheels are not calibrated

Solution

  1. Step 1: Identify parameters affecting obstacle avoidance

    DWA uses parameters like obstacle distance to decide when to start avoiding obstacles.
  2. Step 2: Analyze effect of low obstacle distance

    If set too low, the planner reacts too late, causing collisions.
  3. Final Answer:

    The obstacle distance parameter is set too low, causing late avoidance -> Option A
  4. 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

  1. Step 1: Understand min_turning_radius effect

    Decreasing min_turning_radius allows tighter turns, useful in narrow corridors.
  2. Step 2: Understand obstacle_avoidance_force effect

    Increasing obstacle_avoidance_force makes the planner keep safer distance from obstacles, improving clearance.
  3. Step 3: Combine effects for smooth navigation

    Tight turns plus stronger obstacle avoidance helps smooth, safe navigation in tight spaces.
  4. Final Answer:

    Decrease min_turning_radius and increase obstacle_avoidance_force -> Option D
  5. Quick Check:

    Tight turns + strong avoidance = Decrease min_turning_radius and increase obstacle_avoidance_force [OK]
Hint: Tighten turning radius and boost avoidance force for narrow spaces [OK]
Common Mistakes:
  • Increasing turning radius makes turns wider, not tighter
  • Disabling obstacle avoidance causes collisions
  • Confusing velocity limits with turning parameters
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard