Installing Turtlebot 3 simulator in Ubuntu 14.04

🕒 4 min read

Installing the Turtlebot 3 simulator in ROS Kinetic is well documented in their website, but is it still possible to try out the simulator on Ubuntu 14.04 with ROS Indigo instead? After tweaking around with the Turtlebot 3 simulator, it was actually possible to run it with ROS Indigo.

Turtlebot 3 – Overview

The Turtlebot Series is designed to be a low-cost, personal robotic kit that operates under open source software (like ROS). The difference with the new Turtlebot compared to its predecessor (Turtlebot & Turtlebot 2) is that it is much more smaller, modular and cheaper. Other than that, it also comes in 2 versions: Burger & Waffle. (Depends on your appetite) The Burger is a smaller version powered with Raspberry Pi 3, whereas the Waffle is a “bigger & flatter” version of Burger that is powered by Intel Joule (instead of the Raspberry Pi) with the addition of Intel’s RealSense 3D Sensor. To summarise, here is a comparison of the 2 versions:

Prerequisites

Before moving on to the tutorial, this guide is written with the assumption that you:

  • Installed a 64-bit version of Ubuntu 14.04 (or variant) with ROS Indigo (ros-indigo-desktop-full version) and Gazebo 2.2, with the ROS environment configured.
  • Understands Basic Linux commands to perform simple terminal-base operations.
  • Went through the ROS Tutorials.
  • Have prior experience of handling/and using ROS. (A bit of Gazebo knowledge will also help)
  • [Optional] Have software debugging experiences. (This would definitely be useful)

If not, here are some links you can visit:

It is possible to jump straight into the tutorial if you are lazy/excited to get things working, but it would be better to master the basics first as it will save you time in the long run.

You have been warned.

When you think you are ready, let’s begin with the tutorial!

Workspace

It is recommended that you create a new workspace for the simulator. Let’s create a new workspace called tb3_ws:

$ mkdir -p tb3_ws/src
$ cd tb3_ws/src
$ catkin_init_workspace

After that, run catkin_make & then source the workspace:

$ cd ..
$ catkin_make
$ source devel/setup.bash

(If you do not want to manually source the workspace everytime, you can choose to add the source portion in ~/.bashrc)

 

ROS Packages

System

The following packages are required to be installed system-wide:

To do so, run the following commands:

$ sudo apt-get install ros-indigo-navigation
$ sudo apt-get install ros-indigo-gmapping
$ sudo apt-get install ros-indigo-hector-mapping

 

Local

We’ll be using the git command to download the repositories hosted in Github into the tb3_ws. (If git command is not found, installed it via: $ sudo apt-get install git) Here are the packages that would be used:

  • turtlebot3
  • turtlebot3_msgs
  • turtlebot3_simulations
  • teleop_twist_keyboard: For keyboard teleoperation

Download the packages/repositories into the workspace:

$ git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$ git clone https://github.com/ros-teleop/teleop_twist_keyboard.git

The following files should be created:

After cloning all the required packages, compile them via catkin_make.

 

Modification

There is only some modification that is require on the gazebo file of the turtlebot. Open up the following files:

  • ~/tb3_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_burger.gazebo.xacro
  • ~/tb3_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_waffle.gazebo.xacro

And search for the <visualize> tag in it. Comment them out, for example, change the tag from:

 <visualize>$(arg imu_visual)</visualize>

To:

 <!--visualize>$(arg imu_visual)</visualize-->

Save the files. After commenting the tags, go back to the waffle model file (turtlebot3_waffle.gazebo.xacro). As ROS Indigo does not know how to process the $(arg var) input, we’ll have to switch it back to ${var} instead. There are 2 changes that needs to be made.

At line 119, change:

<pose>$(arg r200_cam_rgb_px) $(arg r200_cam_rgb_py) $(arg r200_cam_rgb_pz) 0 0 0</pose>

To:

<pose>${r200_cam_rgb_px} ${r200_cam_rgb_py} ${r200_cam_rgb_pz} 0 0 0</pose>

And at line 136, change:

<pose>$(arg r200_cam_depth_offset) 0 0 0 0 0</pose>

To:

<pose>${r200_cam_depth_offset} 0 0 0 0 0</pose>

After modification, save the files. With all the modifications done, we are now ready to move on to Gazebo.

 

Gazebo

Copying the model

To use the Turtlebot model, we’ll first have to copy the models into the ~/.gazebo directory.

Ensure that the /.gazebo/models/ exists before performing the above operation!

To do so, we can run the following command:

$ cp -r  $HOME/tb3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/worlds/turtlebot3 $HOME/.gazebo/models/

Or you can do it graphically via the file browser/explorer.

Exporting the model type

Before running Gazebo, you’ll have to specify which Turtlebot type (burger or waffle) you would like to use. Therefore, we’ll have to export the preferred model to the environment variable (TURTLEBOT3_MODEL):

$ export TURTLEBOT3_MODEL={type}

replacing {type} with your choice: burger or waffle. For example, if you decide to launch burger, your command will look like this:

$ export TURTLEBOT3_MODEL="burger"

After exporting the environment variable, we can now launch Gazebo.

Launching via roslaunch

To launch Gazebo, we’ll launch turtlebot3_world.launch, which will launch Gazebo& spawn Turtlebot . (before that, ensure that the tb3_workspace has been source-d!)

$ roslaunch turtlebot3_gazebo turtlebot3_world.launch

And viola! You now have the Turtlebot 3 running in Gazebo!

To visualize the data from Gazebo, you can start Rviz:

$ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch

Keyboard Teleop

To move the Turtlebot around in the simulator, we’ll use a keyboard teleop program to do so:

$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py

 

Troubleshooting

[turtlebot3_world.launch] is neither a launch file

[turtlebot3_world.launch] is neither a launch file in package [turtlebot3_gazebo] nor is [turtlebot3_gazebo] a launch file name The traceback for the exception was written to the log file

The workspace was not source, you can do so by running the following line:

$ source $HOME/tb3_ws/devel/setup.bash

 

‘TURTLEBOT3_MODEL’ is not set

Invalid <arg> tag: environment variable ‘TURTLEBOT3_MODEL’ is not set. Arg xml is <arg default=”$(env TURTLEBOT3_MODEL)” doc=”model type [burger, waffle]” name=”model”/> The traceback for the exception was written to the log file

You probably forgotten to set the environment variable! Refer to Exporting the model type section to set the environment variable.

 

Sources

Share your love

Leave a Reply

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