Bird
Raised Fist0
ROSframework~15 mins

Local planner (DWA, TEB) in ROS - Deep Dive

Choose your learning style10 modes available
Overview - Local planner (DWA, TEB)
What is it?
A local planner in robotics is a software component that helps a robot decide how to move safely and efficiently in its immediate surroundings. It takes the robot's current position and a goal nearby, then calculates the best path and velocity commands to reach that goal while avoiding obstacles. Two popular local planners in ROS are DWA (Dynamic Window Approach) and TEB (Timed Elastic Band), each using different methods to plan movements.
Why it matters
Without a local planner, a robot would struggle to navigate around obstacles or adjust its path in real time, making it unsafe or ineffective in dynamic environments like homes or warehouses. Local planners enable robots to react quickly to changes, avoid collisions, and reach goals smoothly, which is essential for practical robot use in the real world.
Where it fits
Before learning about local planners, you should understand basic robot navigation concepts like global planning and robot kinematics. After mastering local planners, you can explore advanced topics like multi-robot coordination, sensor fusion for better obstacle detection, and optimization of navigation parameters for specific environments.
Mental Model
Core Idea
A local planner is like a smart driver who constantly adjusts the robot’s steering and speed to safely and smoothly reach a nearby target while avoiding obstacles.
Think of it like...
Imagine you are walking through a crowded room to reach a friend. You don’t plan your entire route from the door to your friend at once; instead, you look a few steps ahead, adjust your path to avoid bumping into people, and keep moving forward. The local planner does the same for a robot.
┌───────────────┐
│ Global Planner│
│ (long route)  │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Local Planner │
│ (short steps) │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Robot Motion  │
│ Commands      │
└───────────────┘
Build-Up - 7 Steps
1
FoundationUnderstanding Robot Navigation Basics
🤔
Concept: Learn what navigation means for robots and the difference between global and local planning.
Robots need to move from one place to another. Global planning finds a rough path from start to goal using a map. Local planning focuses on the immediate area around the robot to avoid obstacles and adjust the path in real time.
Result
You understand that local planners work on short-term decisions to keep the robot safe and moving smoothly.
Knowing the split between global and local planning helps you see why local planners are essential for real-time obstacle avoidance.
2
FoundationRobot Motion and Constraints
🤔
Concept: Robots have limits on how fast they can move and turn, which local planners must respect.
Robots can’t instantly change speed or direction. They have maximum speeds, acceleration limits, and turning radii. Local planners must generate commands that the robot can physically follow.
Result
You realize local planners must consider the robot’s physical abilities to create feasible movement commands.
Understanding robot constraints prevents unrealistic plans that the robot cannot execute.
3
IntermediateDynamic Window Approach (DWA) Basics
🤔Before reading on: do you think DWA plans paths by looking far ahead or by focusing on immediate velocity options? Commit to your answer.
Concept: DWA generates possible velocity commands within the robot’s limits and picks the best one based on safety and progress.
DWA samples velocities the robot can achieve in a short time window (dynamic window). It simulates the robot’s path for each velocity, scores them by distance to obstacles and goal progress, then chooses the best velocity to execute next.
Result
You see how DWA quickly picks safe and efficient movements by testing options in a small velocity space.
Understanding DWA’s velocity sampling explains how it balances safety and speed in real time.
4
IntermediateTimed Elastic Band (TEB) Planner Concepts
🤔Before reading on: do you think TEB treats the robot’s path as fixed or flexible? Commit to your answer.
Concept: TEB models the robot’s path as a flexible band that can stretch and bend to avoid obstacles and optimize travel time.
TEB represents the path as a sequence of poses connected by elastic bands. It optimizes this path by adjusting poses and timing to minimize travel time while avoiding collisions and respecting robot constraints.
Result
You understand how TEB creates smooth, time-optimized paths that adapt to obstacles dynamically.
Knowing TEB’s elastic band model reveals why it produces smooth and efficient trajectories.
5
IntermediateComparing DWA and TEB Approaches
🤔Before reading on: which planner do you think handles complex environments better, DWA or TEB? Commit to your answer.
Concept: DWA focuses on velocity sampling, while TEB optimizes the entire path and timing, leading to different strengths.
DWA is simpler and faster but may produce less smooth paths. TEB is more complex, optimizing the whole trajectory for smoothness and timing, which helps in tight or dynamic spaces.
Result
You can choose the right planner based on environment complexity and robot needs.
Understanding the trade-offs helps you pick or tune planners for specific tasks.
6
AdvancedTuning Local Planner Parameters
🤔Before reading on: do you think increasing obstacle cost weight makes the robot more or less cautious? Commit to your answer.
Concept: Local planners have many parameters controlling behavior like obstacle avoidance strength, speed, and path smoothness.
Adjusting parameters like obstacle cost, acceleration limits, and goal tolerance changes how the planner behaves. For example, higher obstacle cost makes the robot keep more distance from obstacles but may slow it down.
Result
You learn how to customize planners to balance safety, speed, and smoothness for your robot and environment.
Knowing parameter effects prevents common navigation failures and improves robot performance.
7
ExpertHandling Dynamic Obstacles and Real-Time Updates
🤔Before reading on: do you think local planners replan paths continuously or only once at start? Commit to your answer.
Concept: Local planners must update plans frequently to react to moving obstacles and changes in the environment.
Both DWA and TEB run in a loop, receiving sensor data and replanning paths or velocities many times per second. This allows the robot to adapt quickly to new obstacles or changes in goals.
Result
You understand how local planners enable safe navigation in unpredictable, dynamic environments.
Recognizing continuous replanning is key to grasping how robots stay safe and responsive in real life.
Under the Hood
Local planners operate by continuously receiving the robot's current state and sensor data, then generating candidate motions within the robot's dynamic constraints. DWA samples velocity commands in a short time window and simulates their outcomes to score safety and goal progress. TEB formulates the path as an optimization problem, adjusting poses and timing to minimize a cost function that includes obstacle proximity, path smoothness, and velocity limits. Both planners run in real time, updating commands at high frequency to react to environment changes.
Why designed this way?
Robots operate in unpredictable, dynamic environments where pre-planned paths can quickly become unsafe. Early planners lacked real-time responsiveness or ignored robot dynamics, causing collisions or jerky motions. DWA was designed to quickly evaluate feasible velocities, balancing safety and progress with low computation. TEB was created to produce smoother, time-optimized trajectories by formulating planning as an optimization problem. These approaches reflect trade-offs between speed, smoothness, and computational cost.
┌───────────────┐
│ Sensor Input  │
└──────┬────────┘
       │
       ▼
┌───────────────┐       ┌───────────────┐
│ Robot State   │──────▶│ Local Planner │
│ (position,    │       │ (DWA or TEB)  │
│ velocity)     │       └──────┬────────┘
└───────────────┘              │
                               ▼
                      ┌───────────────┐
                      │ Velocity Cmds │
                      └───────────────┘
                               │
                               ▼
                      ┌───────────────┐
                      │ Robot Motion  │
                      └───────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does the local planner replace the global planner? Commit yes or no.
Common Belief:Many think the local planner plans the entire route from start to goal.
Tap to reveal reality
Reality:The local planner only plans short-term movements near the robot, while the global planner finds the overall path.
Why it matters:Confusing these leads to poor navigation setups where the robot cannot reach distant goals or gets stuck.
Quick: Do you think local planners guarantee collision-free paths always? Commit yes or no.
Common Belief:Some believe local planners always prevent collisions perfectly.
Tap to reveal reality
Reality:Local planners work with sensor data and predictions but cannot guarantee absolute safety, especially with fast-moving obstacles or sensor errors.
Why it matters:Overreliance can cause accidents; safety requires combining planners with good sensors and fallback strategies.
Quick: Is a smoother path always better for robot navigation? Commit yes or no.
Common Belief:Many assume the smoothest path is always the best.
Tap to reveal reality
Reality:Sometimes a less smooth but faster or safer path is preferable depending on the task and environment.
Why it matters:Misunderstanding this can lead to inefficient or unsafe robot behavior.
Quick: Does increasing the frequency of replanning always improve navigation? Commit yes or no.
Common Belief:Some think replanning as fast as possible is always better.
Tap to reveal reality
Reality:Too frequent replanning can overload the system and cause unstable commands; balance is needed.
Why it matters:Ignoring this can cause robot jitter or slow response due to computational bottlenecks.
Expert Zone
1
TEB’s optimization can incorporate robot footprint and kinematic constraints precisely, improving real-world feasibility beyond simple velocity sampling.
2
DWA’s performance depends heavily on the velocity sampling resolution and scoring weights, which must be tuned carefully for different robots and environments.
3
Both planners can be extended with custom cost functions to handle special cases like social navigation or energy efficiency.
When NOT to use
Local planners like DWA and TEB are not suitable for very high-speed robots or those operating in extremely cluttered or unpredictable environments without additional sensor fusion or prediction layers. In such cases, model predictive control (MPC) or learning-based planners may be better alternatives.
Production Patterns
In real-world ROS deployments, DWA is often used for simple indoor robots due to its speed and simplicity, while TEB is preferred for robots needing smooth, time-optimized trajectories like delivery robots or autonomous wheelchairs. Both planners are integrated with sensor data streams and global planners, and tuned continuously based on environment feedback.
Connections
Model Predictive Control (MPC)
Both MPC and TEB optimize trajectories considering constraints and future states.
Understanding TEB’s optimization helps grasp MPC’s predictive control approach used in advanced robotics and autonomous vehicles.
Human Motor Control
Local planners mimic how humans adjust movements continuously based on immediate surroundings.
Studying local planners deepens understanding of biological movement control and vice versa.
Real-Time Systems
Local planners must operate within strict time constraints to be effective.
Knowledge of real-time computing principles is essential to implement and tune local planners for responsive robot behavior.
Common Pitfalls
#1Ignoring robot velocity and acceleration limits in planner configuration.
Wrong approach:max_vel_x: 5.0 max_acc_x: 10.0 # Values far beyond robot capabilities
Correct approach:max_vel_x: 0.5 max_acc_x: 1.0 # Realistic limits matching robot specs
Root cause:Misunderstanding that planners must respect physical robot constraints to produce executable commands.
#2Setting obstacle cost weights too low, causing the robot to get too close to obstacles.
Wrong approach:obstacle_cost_scale: 0.1 # Too low, robot ignores obstacles
Correct approach:obstacle_cost_scale: 3.0 # Higher value to keep safe distance
Root cause:Underestimating the importance of cost function weights in balancing safety and efficiency.
#3Running local planner update rate too slow, causing delayed reactions.
Wrong approach:controller_frequency: 1.0 # Updates once per second
Correct approach:controller_frequency: 20.0 # Updates 20 times per second for responsiveness
Root cause:Not realizing that slow update rates reduce the planner’s ability to react to dynamic obstacles.
Key Takeaways
Local planners like DWA and TEB enable robots to navigate safely and smoothly by making short-term movement decisions based on current surroundings.
DWA samples possible velocities to pick safe and efficient commands quickly, while TEB optimizes the entire path and timing for smooth trajectories.
Understanding robot constraints and tuning planner parameters is essential to achieve reliable and effective navigation.
Local planners continuously replan in real time to adapt to dynamic environments, but they do not replace global planners or guarantee perfect safety alone.
Expert use involves balancing speed, smoothness, and safety while knowing when to choose or extend planners for specific robot needs.

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