Getting Started

This document will take you through the process of installing the Nav2 binaries and navigating a simulated Turtlebot 3 in the Gazebo simulator.

Note

See the Build and Install for other situations such as building from source or working with other types of robots.

Warning

This is a simplified version of the Turtlebot 3 instructions. We highly recommend you follow the official Turtlebot 3 manual if you intend to continue working with this robot beyond the minimal example provided here.

Installation

  1. Install the ROS 2 binary packages as described in the official docs

  2. Install the Nav2 packages using your operating system’s package manager:

    sudo apt install ros-<ros2-distro>-navigation2
    sudo apt install ros-<ros2-distro>-nav2-bringup
    
  3. Install the Turtlebot 3 packages (Humble and older):

    sudo apt install ros-<ros2-distro>-turtlebot3-gazebo
    

Running the Example

  1. Start a terminal in your GUI

  2. Set key environment variables:

    source /opt/ros/<ros2-distro>/setup.bash
    export TURTLEBOT3_MODEL=waffle
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/<ros2-distro>/share/turtlebot3_gazebo/models
    
  3. In the same terminal, run:

    ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
    

    Note

    For ROS 2 Dashing Diademata or earlier, use nav2_simulation_launch.py. However, it is recommended to use the most recent ROS 2 LTS distribution for improved stability and feature completeness.

    headless defaults to true; if not set to false, gzclient (the 3d view) is not started.

    This launch file will launch Nav2 with the AMCL localizer in the turtlebot3_world world. It will also launch the robot state publisher to provide transforms, a Gazebo instance with the Turtlebot3 URDF, and RVIZ.

    If everything has started correctly, you will see the RViz and Gazebo GUIs like this:

    ../_images/rviz-not-started.png ../_images/gazebo_turtlebot1.png
  4. If not autostarting, click the “Startup” button in the bottom left corner of RViz. This will cause Nav2 to change to the Active state. It should change appearance to show the map.

    Initial appearance of RViz transitioning to the Active state