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
Jazzy introduced the new Gazebo modern simulator, replacing Gazebo Classic. Thus, for Jazzy and newer, the installation packages and instructions are slightly different to pull in the appropriate packages.
Install the ROS 2 binary packages as described in the official docs
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
Install the demo robot (Turtlebot) for gazebo:
For Jazzy and newer, install the Turtlebot 3 & 4 packages for Gazebo Modern. It should be automatically installed with nav2_bringup
:
sudo apt install ros-<ros2-distro>-nav2-minimal-tb*
For Iron and older, install Turtlebot 3 packages for gazebo classic:
sudo apt install ros-<ros2-distro>-turtlebot3-gazebo
Running the Example
Start a terminal in your GUI
Set key environment variables, some of which are only required for Iron and older:
source /opt/ros/<ros2-distro>/setup.bash export TURTLEBOT3_MODEL=waffle # Iron and older only with Gazebo Classic export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/<ros2-distro>/share/turtlebot3_gazebo/models # Iron and older only with Gazebo Classic
In the same terminal, run:
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
Note
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 simulation 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 (this is Gazebo Classic, but what you see with modern Gazebo is virtually identical):
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.