location-arrowAutonomous Navigation

Full autonomous navigation - maps, planning, and obstacle avoidance


Tutorial Overview

🎯 Learning Objectives

By the end of this tutorial, you will:

  • βœ… Understand Nav2 navigation stack architecture

  • βœ… Launch full autonomous navigation system

  • βœ… Send navigation goals to robot

  • βœ… Monitor navigation status and progress

  • βœ… Understand costmaps (global and local)

  • βœ… Configure path planning and obstacle avoidance

  • βœ… Tune navigation parameters for your environment

  • βœ… Handle navigation failures gracefully

  • βœ… Create autonomous navigation missions

⏱️ Time Required

  • Reading & Architecture: 30 minutes

  • First Navigation: 35 minutes

  • Costmap Understanding: 30 minutes

  • Parameter Tuning: 40 minutes

  • Advanced Navigation: 45 minutes

  • Mission Planning: 30 minutes

  • Total: ~210 minutes (3.5 hours)

πŸ“š Prerequisites

  • βœ… Completed ALL previous tutorials (especially SLAM and Localization)

  • βœ… Have saved maps

  • βœ… Can localize robot on maps

  • βœ… Understanding of coordinate frames

  • βœ… Comfortable with RViz

  • βœ… Can tune parameters

πŸ› οΈ What You'll Need

  • βœ… Beetlebot (fully charged, all sensors working)

  • βœ… Laptop with ROS2 Jazzy

  • βœ… Wireless controller (for emergency stop)

  • βœ… Previously created map

  • βœ… Mapped environment (unchanged)

  • βœ… Large clear space (recommended 5m Γ— 5m+)

  • βœ… Patience and readiness to iterate!


Part 1: Navigation Architecture

Nav2 (Navigation2) = ROS2 navigation framework

Complete autonomous navigation system:


Key Components Explained

1. BT Navigator (Behavior Tree Navigator)

  • Mission control center

  • Coordinates all other servers

  • Handles retries, cancellations, timeouts

  • Implements complex behaviors (navigate, follow path, etc.)

2. Planner Server

  • Global planner: Long-term path from start β†’ goal

  • Algorithms: NavFn (Dijkstra), Smac (State Lattice), Theta* (any-angle)

  • Uses: Global costmap (entire map)

  • Output: Sequence of waypoints (path)

  • Runs: Infrequently (on new goal, or replanning needed)

3. Controller Server

  • Local controller: Follow global path, avoid dynamic obstacles

  • Algorithms: DWB (Dynamic Window), TEB (Timed Elastic Band), MPPI

  • Uses: Local costmap (nearby area only)

  • Output: Velocity commands (/cmd_vel)

  • Runs: High frequency (~10-20 Hz)

4. Smoother Server (Optional)

  • Smooths jagged paths from planner

  • Makes motion more natural

  • Reduces wear on motors

5. Recovery Server

  • What to do when stuck?

  • Behaviors: Spin in place, back up, wait, clear costmap

  • Configurable sequence

6. Costmap 2D

  • Represents obstacles and free space

  • Two instances: Global (entire map) and Local (around robot)

  • Multiple layers: Static map, obstacle, inflation, voxel, etc.


Coordinate Frames in Navigation

Critical frames:

Why two (map and odom)?

  • Odom smooth but drifts

  • Map accurate but can jump (localization corrections)

  • Controllers use odom (need continuity)

  • Planners use map (need global accuracy)


Part 2: Launching Navigation

Prerequisites Check

Before launching navigation:


Launch Nav2 Stack

Your robot likely has navigation pre-configured:

What launches:

  • All Nav2 servers

  • Configured with Beetlebot parameters

  • Ready to receive navigation goals


Configure RViz for Navigation

Full navigation visualization:

[PLACEHOLDER: Screenshot of fully configured RViz for navigation]


Part 3: Your First Autonomous Navigation

Setting a Navigation Goal

Method 1: Nav2 Goal (RViz) - Recommended


Method 2: Action Client (Command Line)


Method 3: Python Script

[!WARNING] TODO: Exercise Script Not Included in Core Repository The send_nav_goal.py script below is an educational exercise. It is not pre-installed. You are encouraged to create it yourself!

Usage:


Exercise 11.1: First Navigation

Task: Navigate to a simple goal

Setup:

Procedure:

Typical time: 30-60 seconds for 3-5m navigation


Monitoring Navigation Status

Check navigation state:


View current cmd_vel:


Part 4: Understanding Costmaps

What are Costmaps?

Costmap = 2D grid representing traversability

Cell values (0-255):

Purpose:

  • Planners: Find paths through low-cost areas

  • Controllers: Avoid high-cost areas

  • Safety: Prevent collisions


Two Costmaps

Global Costmap:

  • Covers entire map

  • Static (from saved map) + dynamic (recent scans)

  • Used by: Global planner

  • Update rate: Slow (~1 Hz)

  • Purpose: Long-term planning

Local Costmap:

  • Rolling window around robot (e.g., 5m Γ— 5m)

  • Dynamic obstacles only (from recent LiDAR)

  • Used by: Local controller

  • Update rate: Fast (~5-10 Hz)

  • Purpose: Short-term obstacle avoidance


Costmap Layers

Typical layer stack:

[PLACEHOLDER: Diagram showing costmap layers combining]


Visualizing Costmaps

In RViz (already configured):


Exercise 11.2: Costmap Observation

Task: Understand how costmaps work

Test 1: Static obstacles

Test 2: Dynamic obstacles

Test 3: Inflation


Part 5: Path Planning

Global Planner

Finds path from current position β†’ goal

Algorithm (NavFn / Dijkstra by default):

Alternative planners:

  • Smac Planner: State lattice, considers robot kinematics

  • Theta:* Any-angle paths (not grid-aligned)

  • Smac Hybrid-A:* Car-like kinematics

Beetlebot default: NavFn (simple, fast, proven)


Path Characteristics

Good path properties:

  • βœ… Smooth curves (not zigzag)

  • βœ… Wide clearance from obstacles

  • βœ… Reasonable length (not excessively long)

  • βœ… Feasible for differential drive

Poor path properties:

  • ❌ Jagged, grid-aligned

  • ❌ Cuts corners too tight

  • ❌ Requires in-place rotations where not needed

  • ❌ Unnecessarily long detours


Replanning

When does global planner replan?


Exercise 11.3: Path Planning Scenarios

Scenario 1: Direct path

Scenario 2: Around obstacle

Scenario 3: Through doorway

Scenario 4: Complex environment


Part 6: Local Control

Controller's Job

Follow global plan while:

  • Avoiding dynamic obstacles

  • Staying on path

  • Respecting velocity limits

  • Smooth motion

Algorithm (DWB - Dynamic Window Approach):


DWB Scoring Components

Typical scoring:


Velocity Limits

Controller respects these limits:

Note: These are controller limits. Robot's Lyra controller also has hardware ramping (8 RPM/cycle)!


Exercise 11.4: Controller Behavior

Task: Observe controller adapting to situations

Test 1: Following straight path

Test 2: Avoiding obstacle

Test 3: Tight passage

Test 4: Final approach


Part 7: Parameter Tuning

When to Tune

Default parameters work reasonably for most cases!

Tune when:

  • Robot too cautious (won't go through doorways)

  • Robot too aggressive (cuts corners)

  • Motion not smooth (jerky, oscillating)

  • Specific environment needs (narrow hallways, open warehouse)


Key Parameters to Tune

Global Costmap:


Local Costmap:


Controller (DWB):


Common Tuning Scenarios

Scenario 1: Robot won't go through doorway

Problem: Too cautious, inflation too large

Solution:


Scenario 2: Robot cuts corners too close

Problem: Not enough safety margin

Solution:


Scenario 3: Motion too jerky

Problem: Controller changing commands too rapidly

Solution:


Scenario 4: Robot too slow

Problem: Conservative velocity limits

Solution:


Exercise 11.5: Parameter Tuning

Task: Optimize for your environment

Baseline test:

Tuning iteration:

Document your findings!


Part 8: Recovery Behaviors

What Happens When Stuck?

Robot gets stuck when:

  • Path blocked by obstacle

  • Can't find feasible trajectory

  • Oscillating in place

  • Taking too long

Nav2 Recovery Behaviors:


Recovery Sequence

Configurable behavior tree:

After 6 retries: Goal aborted


Manual Recovery

If robot stuck, you can trigger manually:


Exercise 11.6: Recovery Testing

Task: Observe recovery behaviors

Test 1: Blocked path

Test 2: Trap robot

Expected: Robot should try ~6 recovery attempts over 1-2 minutes before aborting


Part 9: Advanced Navigation

Waypoint Following

Navigate through sequence of waypoints:

Usage:

Robot will visit each waypoint in sequence!


Dynamic Goal Updates

Change goal mid-navigation:

Use case:

  • Operator changes mind

  • New information received

  • Higher priority task


Pause and Resume

Pause navigation:

Resume:

Robot stops but remembers goal, can continue later


Part 10: Creating Autonomous Missions

Mission Planning

Complex autonomous behavior:

Run mission:


Exercise 11.7: Create Custom Mission

Task: Design and execute multi-step mission

Requirements:

  1. At least 5 waypoints

  2. Include different goal orientations

  3. Pause at each waypoint (simulate task)

  4. Handle navigation failures gracefully

  5. Log progress

Example missions:

  • Security patrol: Visit 4 corners, check each area

  • Delivery: Pick up at point A, deliver to point B, return

  • Inspection: Navigate to specific equipment locations

  • Cleaning: Cover entire floor systematically


Part 11: Troubleshooting Navigation

Problem: Robot Won't Start Navigation

Checklist:


Problem: Robot Stuck Oscillating

Symptoms: Robot wiggles back and forth, makes no progress

Causes:

  1. Conflicting critics

  1. Narrow passage

  1. Local minimum


Problem: Path Goes Through Walls

Cause: Costmap not reflecting actual obstacles

Debug:


Problem: Navigation Very Slow

Causes:

  1. Too conservative parameters

  1. High inflation

  1. Too many trajectory samples


General Debugging

Most navigation issues fixed by:

  1. ⚑ Power cycle robot (clears stuck states)

  2. Clear costmaps (remove stale obstacles)

  3. Re-localize (set 2D Pose Estimate again)

  4. Check RViz alignment (scans should match map)

  5. Verify goal validity (in free space, reachable)


Part 12: Knowledge Check

Concept Quiz

  1. What's the difference between global and local costmaps?

  2. Why does robot need both a planner and controller?

  3. What triggers recovery behaviors?

  4. Why inflate obstacles in costmap?

  5. Can navigation work without localization?


Final Challenge

Task: Complete autonomous navigation system

Mission: Autonomous Office Patrol

Requirements:

  1. Create map of test environment (or use existing)

  2. Configure navigation stack

  3. Create patrol route with 6+ waypoints

  4. Robot must:

    • Localize automatically (global localization)

    • Execute patrol route autonomously

    • Handle dynamic obstacles (person walks through)

    • Complete 3 full patrol loops

    • Return to start position

    • Log all waypoint arrivals with timestamps

  5. Tune parameters for optimal performance

  6. Handle failures gracefully (retry, skip unreachable waypoints)

Deliverable:

  • Complete launch file for autonomous operation

  • Tuned parameter files

  • Mission script with error handling

  • Performance report:

    • Total mission time

    • Success rate per waypoint

    • Number of recovery behaviors triggered

    • Final localization error

  • Video recording of full mission

  • Lessons learned document

Estimated time: 3-4 hours for complete implementation and testing


Part 13: What You've Learned

βœ… CONGRATULATIONS! YOU'VE COMPLETED THE ENTIRE COURSE!

You now have mastered:

Foundation (Tutorials 1-3):

  • βœ… Robot hardware and architecture

  • βœ… ROS2 communication fundamentals

  • βœ… Simulation for safe testing

Perception (Tutorials 4-5):

  • βœ… Sensor data visualization and interpretation

  • βœ… IMU signal processing and filtering

Control (Tutorials 6-7):

  • βœ… Teleoperation techniques

  • βœ… Multi-sensor fusion with EKF

Mapping & Localization (Tutorials 8-10):

  • βœ… SLAM mapping of environments

  • βœ… Camera-based perception

  • βœ… Localization on known maps

Autonomous Navigation (Tutorial 11):

  • βœ… Nav2 stack architecture

  • βœ… Path planning algorithms

  • βœ… Local trajectory control

  • βœ… Costmap configuration

  • βœ… Recovery behaviors

  • βœ… Parameter tuning

  • βœ… Complex mission planning


Beyond This Course

🎯 You're Now Ready For:

Advanced Topics:

  • Multi-robot coordination

  • Outdoor navigation (GPS fusion)

  • 3D navigation (stairs, ramps)

  • Semantic mapping (recognize object types)

  • Machine learning perception (object detection, recognition)

  • Visual SLAM (camera-based)

  • Advanced planners (RRT, RRT*, etc.)

Real Applications:

  • Warehouse automation

  • Security patrol robots

  • Cleaning robots

  • Delivery robots

  • Agricultural robots

  • Inspection robots

Competitions:

  • RoboCup

  • DARPA challenges

  • AutoNav competitions

Research:

  • Human-robot interaction

  • Swarm robotics

  • Learning-based navigation

  • Robust navigation in dynamic environments


Quick Reference

Complete Navigation Launch


Essential Navigation Commands


Configuration File Locations


Typical Navigation Stack Flowchart


Final Words

πŸŽ‰ YOU DID IT!

You've completed all 11 tutorials of the Beetlebot wiki!

What you've accomplished:

  • Built maps of your environment

  • Localized robot on those maps

  • Commanded autonomous navigation

  • Tuned parameters for optimal performance

  • Created complex autonomous missions

This is REAL robotics! πŸ€–

The skills you've learned here are used in:

  • Self-driving cars

  • Warehouse robots

  • Delivery drones

  • Space exploration

  • And countless other applications


Keep Learning!

Resources:

  • ROS2 Documentation: https://docs.ros.org

  • Nav2 Documentation: https://navigation.ros.org

  • VEEROBOT Support: [email protected]

  • Community forums, GitHub, research papers

Practice:

  • Create more complex environments

  • Test in different conditions

  • Experiment with parameters

  • Build custom behaviors

  • Contribute to open source


Share Your Work!

We'd love to see what you build:

  • Post videos of your robot navigating

  • Share parameter configurations

  • Contribute improvements

  • Help other users

You're now part of the robotics community! 🌟


Tutorial Series Complete! πŸ†

β†’ Return to Tutorial Index β†’ Visit Support & Resources β†’ Start your own robotics project β†’ Goto next section for optimization!


Last Updated: January 2026 Tutorial 11 of 11 - Advanced Level Estimated completion time: 210 minutes (3.5 hours) οΏ½οΏ½ COURSE COMPLETE! πŸŽ“

Last updated