12. Simulation

_images/remote_pc_and_turtlebot.png

Warning

The contents in this chapter corresponds to the Remote PC (your desktop or laptop PC) which will control TurtleBot3. Do NOT apply this instruction to your TurtleBot3.

Note

This instruction was tested on Ubuntu 16.04 and ROS Kinetic Kame.

12.1. TurtleBot3 Fake Node Implementation

Tip

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

Install dependent packages for TurtleBot3 Simulation.

Note

turtlebot3_simulation package requires TurtleBot3 (http://turtlebot3.robotis.com/en/latest/pc_software.html#install-dependent-packages) package as a prerequisite.

cd ~/catkin_ws/src/
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/catkin_ws && catkin_make

TurtleBot3 fake node is a very simple simulation node that can be run without having an actual robot. You can even control the virtual TurtleBot3 in RViz with a teleop node.

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_fake turtlebot3_fake.launch
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

12.2. Stage (2D)

(TODO)

12.3. Gazebo (3D)


Tip

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

Warning

If you are running Gazebo for the first time on your Remote PC, it takes a bit longer than usual.

You should set Turtlebot3 model parameter. Select either burger or waffle for the model parameter in the below command.

export TURTLEBOT3_MODEL=burger

Below command will load TurtleBot3 on the default Gazebo environment TurtleBot3 empty world.

roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
_images/turtlebot3_empty_world.png

If you wish to load more interesting map, please use below command instead of above command. TurtleBot3 world is a map consists of simple objects that makes up the shape of TurtleBot3 symbol.

roslaunch turtlebot3_gazebo turtlebot3_world.launch
_images/turtlebot3_world_bugger.png _images/turtlebot3_world_waffle.png

In order to control TurtleBot3 with a keyboard, please launch teleoperation feature with below command in a new terminal window.

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

In order to run TurtleBot3 simulation that autonomously navigates around the map, open a new terminal window and enter below command.

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_simulation.launch

RViz visualizes published topics while simulation is running. You can launch RViz in a new terminal window by entering below command.

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
_images/turtlebot3_gazebo_rviz.png