Install Turtlebot3 on ROS 2 Foxy

(Your system must already have Ubuntu 20.04 LTS and ROS 2 Foxy Fitzroy installed.)

As of July 2020, a pre-built binary of the Turtlebot3 package is still not available for ROS 2 Foxy so I had to install it from source. I followed the Robotis ROS 2 setup as a guide, but updated some commands for Foxy.

Install ROS 2 Dependency Packages

Install Colcon

sudo apt update
sudo apt upgrade
sudo apt install python3-colcon-common-extensions

sudo apt install ros-foxy-navigation2
sudo apt install ros-foxy-nav2-bringup

Install Gazebo 11

These steps are from the Gazebo tutorial but updated for Foxy.

sudo apt install gazebo11 libgazebo11-dev

Try launching it from the console by typing:

gazebo

You should see the GUI like below. Exit the program.

The Gazebo 11 main window

Install the gazebo_ros package.

sudo apt install ros-foxy-gazebo-ros-pkgs

Make sure you have some core tools installed:

sudo apt install ros-foxy-ros-core ros-foxy-geometry2

Load the differential drive world with Gazebo:

gazebo --verbose /opt/ros/foxy/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world

The Gazebo GUI should appear with a simple vehicle:

Gazebo window open and displaying a two-wheeled box vehicle

On a new terminal (this is the 2nd one), run the following command to send a Twist command:

ros2 topic pub /demo/cmd_demo geometry_msgs/Twist '{linear: {x: 1.0}}' -1

You’ll see the vehicle moving forward.

Install Cartographer

sudo apt install ros-foxy-cartographer
sudo apt install ros-foxy-cartographer-ros

Install Navigation2

sudo apt install ros-dashing-navigation2
sudo apt install ros-dashing-nav2-bringup

Install vcstool

sudo apt install python3-vcstool

Install the Turtlebot3 package

mkdir -p ~/turtlebot3_ws/src
cd ~/turtlebot3_ws
wget https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/ros2/turtlebot3.repos
vcs import src < turtlebot3.repos
colcon build --symlink-install

Leave a Reply

Your email address will not be published. Required fields are marked *