Turtlebot 3 Simulation

This guide is based on this tutorial for Turtlebot 3. If you want to explore more examples with this particular robot, that is the website to go to.

Pre-requisites

Complete the previous guide.

Setup

By now you should have turtlebot3 metapackage and turtlebot3-msgs package installed. In this guide we will install the required simulation packages

  1. Define your turtlebot 3 model:

     echo -e '\nexport TURTLEBOT3_MODEL=waffle_pi' >> ~/.bashrc && source ~/.bashrc
    
  2. Install simulation metapackage:

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

Crude simulation

  1. Run the Turtlebot 3 fake node:

     roslaunch turtlebot3_fake turtlebot3_fake.launch
    

    It should open rviz. Remember that rviz is not simulating the robot, it’s only used for visualization and little interaction. The code that simulates this robot is quite small, you can take a look at it with the following command, but you don’t need to understand it.

     rosed turtlebot3_fake turtlebot3_fake.cpp
    
  2. Control the robot with:

     roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
    

Physics-based simulation

For this part we will need to install Gazebo.

  1. Install Gazebo 7:

     sudo apt install libgazebo7-dev
    
  2. Run the simulation:

     roslaunch turtlebot3_gazebo turtlebot3_world.launch
    
  3. Run collision avoidance:

     roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
    
  4. Run rviz for visualization

     roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
    

    Play around! Disable the Camera if your computer gets too slow. It is normal due to Gazebo.

  5. You can now explore applications following this guide

  6. Use rosbash tools (rostopic, rosnode, etc.) to check that everything is indeed using ROS topics.