Installing Turtlebot 3 simulator in Ubuntu 14.04

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:

After that, run catkin_make & then source the workspace:

(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:

 

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:

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:

To:

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:

To:

And at line 136, change:

To:

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:

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):

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

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!)

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

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

Keyboard Teleop

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

 

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:

 

‘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 this post:

You may also like...