Edit on GitHub

Simulation

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.

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 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.

Tip : TB3_MODEL = burger, waffle, waffle_pi

$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ roslaunch turtlebot3_fake turtlebot3_fake.launch
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Gazebo (3D Simulator)

ROS packages for Gazebo

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.

Simulate in Various World

  1. Empty World

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

    Tip : TB3_MODEL = burger, waffle, waffle_pi

     $ export TURTLEBOT3_MODEL=${TB3_MODEL}
    

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

     $ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
    

  2. Turtlebot3 World

    TurtleBot3 world is a map consists of simple objects that makes up the shape of TurtleBot3 symbol.
     

     $ export TURTLEBOT3_MODEL=${TB3_MODEL}
     $ roslaunch turtlebot3_gazebo turtlebot3_world.launch
    

  3. TurtleBot3 House

    TurtleBot3 House is a map made with house drawings.

     $ export TURTLEBOT3_MODEL=${TB3_MODEL}
     $ roslaunch turtlebot3_gazebo turtlebot3_house.launch
    

Drive TurtleBot3

  1. Teleoperation by a keyboard

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

     $ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
    
  2. Collision avoidance

    In order to autonomously drive a TurtleBot3 around the TurtleBot3 World, open a new terminal window and enter below command.

     $ export TURTLEBOT3_MODEL=${TB3_MODEL}
     $ roslaunch turtlebot3_gazebo turtlebot3_world.launch
    

    Open a new terminal window and enter below command.

     $ export TURTLEBOT3_MODEL=${TB3_MODEL}
     $ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
    

Open Rviz

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

$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch

SLAM by TurtleBot3

In gazebo simulation, we can use SLAM package that we used for the actual TurtleBot3

Instruction to SLAM

In gazebo simulation, we can use navigation package that we used for the actual TurtleBot3

Instruction to navigation

SLAM by Multiple TurtleBot3s

  1. Call three TurtleBot3s in TurtleBot3 House

     $ roslaunch turtlebot3_gazebo multi_turtlebot3.launch
    
  2. Excute SLAM

     $ roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_0
     $ roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_1
     $ roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_2
    
  3. Merge Map data from each TurtleBot3’s map data

     $ sudo apt-get install ros-kinetic-multirobot-map-merge
     $ roslaunch turtlebot3_gazebo multi_map_merge.launch 
    
  4. Open Rviz

     $ rosrun rviz rviz -d `rospack find turtlebot3_gazebo`/rviz/multi_turtlebot3_slam.rviz
    
  5. Teleoperation by keyboard

     $ rosrun turtlebot3_teleop turtlebot3_teleop_key cmd_vel:=tb3_0/cmd_vel
    
  6. Save a map

     $ rosrun map_server map_saver -f ~/map
    

Standalone Gazebo Plugin

NOTE : This tutorial is developed only for user who want to simulate TurtleBot3 without ROS. However we highly recommend to simulate robots along ROS.

  1. Install library for Gazebo7

     $ sudo apt-get install libgazebo7-dev
    
  2. Download source code from github

     $ git clone https://github.com/ROBOTIS-GIT/turtlebot3_gazebo_plugin
    
  3. Add gazebo plugin path in .bashrc file

     $ nano ~/.bashrc
    

    add two lines

    Tip : turtlebot3_gazebo_plugin path = ~/turtlebot3_gazebo_plugin

     export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:${turtlebot3_gazebo_plugin path}/build
     export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${turtlebot3_gazebo_plugin path}/models
    
  4. Make and Build

     $ cd ${turtlebot3_gazebo_plugin path}
     $ mkdir build
     $ cd build
     $ cmake ..
     $ make
    
  5. Excute plugin

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

    Tip : TB3_MODEL = burger, waffle, waffle_pi

     $ cd ${turtlebot3_gazebo_plugin}
     $ gazebo worlds/turtlebot3_${TB3_MODEL}.world
    

  6. Teleoperation by keyboard

     w - set linear velocity up 
     x - set linear velocity down
     d - set angular velocity up
     a - set angular velocity down
     s - set all velocity to zero
    
  7. Topic subscribe command

    • Show all topic

      $ gz topic -l 
      
    • Subscribe scan data

      $ gz topic -e /gazebo/default/user/turtlebot3_${TB3_MODEL}/lidar/hls_lfcd_lds/scan
      
    • Subscribe image data

      Waffle

      $ gz topic -e /gazebo/default/user/turtlebot3_waffle/image/intel_realsense_r200/image
      

      Waffle Pi

      $ gz topic -e /gazebo/default/user/turtlebot3_waffle_pi/image/raspberry_pi_cam/image
      
  8. Excute listener

     $ cd ${turtlebot3_gazebo_plugin}/build
     $ ./lidar_listener ${TB3_MODEL}
    

    Open a new terminal window and enter below command.

     $ cd ${turtlebot3_gazebo_plugin}/build
     $ ./image_listener ${TB3_MODEL}