Edit on GitHub



  • This instructions were tested on Ubuntu 18.04 and ROS2 Crystal Clemmys.
  • This instructions are supposed to be running on the remote PC. Please run the instructions below on your [Remote PC]. However, the part marked [TurtleBot] is the content that runs on SBC of TurtleBot3.

TIP: The terminal application can be found with the Ubuntu search icon on the top left corner of the screen. The shortcut key for running the terminal is Ctrl-Alt-T.

This chapter shows some demos using TurtleBot3 with ROS2 and Gazebo9. In order to implement these demos, you have to install some packages.


PC setup

NOTE: All demos have been tested in Ubuntu 18.04 and macOS High Sierra installed ROS2 Crystal Clemmys. If you got stuck during installation, please following ROS Answers or ROS2 Issue.

[Install Ubuntu on Remote PC]

[Install ROS2 on Remote PC]

[Install TurtleBot3 ROS2 Packages]

[Remote PC] Download turtlebot3 packages and install some dependencies for ROS2

# Install Cartographer dependencies
$ sudo apt install -y \
    google-mock \
    libceres-dev \
    liblua5.3-dev \
    libboost-dev \
    libboost-iostreams-dev \
    libprotobuf-dev \
    protobuf-compiler \
    libcairo2-dev \
    libpcl-dev \
# Install Gazebo9
$ curl -sSL http://get.gazebosim.org | sh
# Install Navigation2 dependencies
$ sudo apt install -y \
    libsdl-image1.2 \
    libsdl-image1.2-dev \
    libsdl1.2debian \
$ 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

NOTE: If you get any build errors or warnings from dependencies, please refer to below documents.

SBC setup

[TurtleBot] Install Raspbian Stretch

  1. Download Raspbian Stretch with desktop and recommended software
  2. Unzip the download file and burn image to your microSD card(>8GB)
  3. Follow instruction that How to setup for TurtleBot3 with ROS2

OpenCR setup

[TurtleBot] Upload firmware for ROS2.

$ cd ~/turtlebot3
$ rm -rf ./opencr_update.tar.xz
$ wget https://github.com/ROBOTIS-GIT/OpenCR_Binaries/raw/master/turtlebot3/ROS2/latest/opencr_update.tar.xz
$ tar -xf ./opencr_update.tar.xz

$ export OPENCR_PORT=/dev/ttyACM0
$ export OPENCR_MODEL=burger
$ cd ./opencr_update
$ ./update.sh $OPENCR_PORT $OPENCR_MODEL.opencr

If uploading the firmware succeeds, below message will be displayed in the terminal.

OpenCR Update Start..
opencr_ld_shell ver 1.0.0
[  ] file name   	: burger.opencr 
[  ] file size   	: 168 KB
[  ] fw_name     	: burger 
[  ] fw_ver      	: V180903R1 
[OK] Open port   	: /dev/ttyACM0
[  ]
[  ] Board Name  	: OpenCR R1.0
[  ] Board Ver   	: 0x17020800
[  ] Board Rev   	: 0x00000000
[OK] flash_erase 	: 0.96s
[OK] flash_write 	: 1.92s 
[OK] CRC Check   	: 10E28C8 10E28C8 , 0.006000 sec
[OK] Download 
[OK] jump_to_fw 

[TurtleBot] Reset OpenCR using RESET button.


[Bringup TurtleBot3]

[TurtleBot, RemotePC] Sync time between TurtleBot and RemotePC

$ sudo apt-get install ntpdate
$ sudo ntpdate ntp.ubuntu.com

[TurtleBot] Run Micro-XRCE-DDS Agent for OpenCR

$ cd ~/turtlebot3 && MicroXRCEAgent serial /dev/ttyACM0

[TurtleBot] Run Micro-XRCE-DDS Agent for Lidar

$ cd ~/turtlebot3 && MicroXRCEAgent udp 2018

[TurtleBot] Run Lidar application

$ ./turtlebot3/turtlebot3_lidar

[Remote PC] Launch burger

$ ros2 launch turtlebot3_bringup burger.launch.py

If the node is successfully launched, the following instruction will be appeared to the terminal window.

[INFO] [launch]: process[robot_state_publisher-1]: started with pid [21355]
[INFO] [launch]: process[time_sync-2]: started with pid [21356]
[INFO] [launch]: process[odometry_publisher-3]: started with pid [21357]
[INFO] [launch]: process[tf_publisher-4]: started with pid [21358]
[INFO] [launch]: process[joint_states_publisher-5]: started with pid [21359]
[INFO] [launch]: process[scan_publisher-6]: started with pid [21360]
Initialize urdf model from file: /home/darby/ros2_overlay_ws/install/turtlebot3_description/share/turtlebot3_description/urdf/turtlebot3_burger.urdf
Parsing robot urdf xml string.
Link base_link had 5 children
Link caster_back_link had 0 children
Link imu_link had 0 children
Link base_scan had 0 children
Link wheel_left_link had 0 children
Link wheel_right_link had 0 children
got segment base_footprint
got segment base_link
got segment base_scan
got segment caster_back_link
got segment imu_link
got segment wheel_left_link
got segment wheel_right_link
[INFO] [time_sync]: Init System Time publisher
Adding fixed segment from base_footprint to base_link
Adding fixed segment from base_link to caster_back_link
Adding fixed segment from base_link to imu_link
Adding fixed segment from base_link to base_scan
Adding moving segment from base_link to wheel_left_link
Adding moving segment from base_link to wheel_right_link
[INFO] [joint_states_publisher]: Init joint_states publisher
[INFO] [scan_publisher]: Init scan publisher
[INFO] [tf_publisher]: Init tf publisher
[INFO] [odometry_publisher]: Init Odometry publisher

And you can check topic list as shown below

$ ros2 topic list


[Remote PC] Run Rviz2

$ ros2 launch turtlebot3_bringup rviz2.launch.py


[Remote PC] Run teleoperation node

$ ros2 run turtlebot3_teleop teleop_keyboard

If the node is successfully run, the following instruction will be appeared to the terminal window.

Control Your TurtleBot3!
Moving around:
   a    s    d

w/x : increase/decrease linear velocity (Burger : ~ 0.22, Waffle and Waffle Pi : ~ 0.26)
a/d : increase/decrease angular velocity (Burger : ~ 2.84, Waffle and Waffle Pi : ~ 1.82)

space key, s : force stop

CTRL-C to quit


The SLAM (Simultaneous Localization and Mapping) is a technique to draw a map by estimating current location in an arbitrary space. The SLAM is a well-known feature of TurtleBot from its predecessors. The video here shows you how accurately TurtleBot3 can draw a map with its compact and affordable platform.

[TurtleBot, RemotePC] Sync time between TurtleBot and RemotePC

$ sudo apt-get install ntpdate
$ sudo ntpdate ntp.ubuntu.com

[Remote PC]

$ cd ~/turtlebot3_ws && colcon build
$ ros2 launch turtlebot3_cartographer cartographer.launch.py

[Remote PC] Save the map

$ ros2 run nav2_map_server map_saver -f ~/map

Navigation is to move the robot from one location to the specified destination in a given environment. For this purpose, a map that contains geometry information of furniture, objects, and walls of the given environment is required. As described in the previous Cartographer section, the map was created with the distance information obtained by the sensor and the pose information of the robot itself.

The navigation enables a robot to move from the current pose to the designated goal pose on the map by using the map, robot’s encoder, IMU sensor, and distance sensor. The procedure for performing this task is as follows.

[Run Navigation2 Nodes]

$ ros2 launch turtlebot3_navigation2 navigation2.launch.py



  $ echo '# Add gazebo model path' >> ~/.bashrc
  $ echo 'export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models' >> ~/.bashrc
  $ source ~/.bashrc

[Remote PC] Load TurtleBot3 on turtlebot3 world

$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
$ ros2 param set /gazebo use_sim_time True

WARNING: If you got error messages about TF_OLD_DATA, you should retry to set use_sim_time parameter onto /gazebo node.

[Remote PC] Launch Cartographer

$ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True

[Remote PC] Run teleoperation node

$ ros2 run turtlebot3_teleop teleop_keyboard

[Remote PC] Save the map

$ ros2 run nav2_map_server map_saver -f ~/map

[Remote PC] Load Navigation2

$ ros2 launch turtlebot3_navigation2 navigation2.launch.py

You should set some parameters to use simulation time. If you need futher information about it, please following navigation2 repo

$ ros2 param set /world_model use_sim_time True
$ ros2 param set /global_costmap/global_costmap use_sim_time True
$ ros2 param set /local_costmap/local_costmap use_sim_time True