Edit on GitHub

Simulation

NOTE

  • Please run the Simulation on Remote PC.
  • Launching the Simulation for the first time on the Remote PC may take a while to setup the environment.

Read more about TurtleBot3 Simulation

TurtleBot3 supports simulation development environment that can be programmed and developed with a virtual robot in the simulation. There are two development environments to do this, one is using a fake node with 3D visualization tool RViz, and the other is using the 3D robot simulator Gazebo.

  • The fake node is suitable for testing with the robot model and movement, but it does not support sensors.
  • If you need to perform SLAM or Navigation, Gazebo would be a feasible solution as it supports sensors such as IMU, LDS, and camera.

In this instruction, Gazebo will be mainly introduced which is most widely used among ROS developers.

Gazebo Simulation

The contents in e-Manual can be updated without a prior notice and video contents could be outdated.

This Gazebo Simulation uses ROS Gazebo package, therefore, proper Gazebo version for ROS1 Noetic has to be installed before running this instruction.

Install Simulation Package

The TurtleBot3 Simulation Package requires turtlebot3 and turtlebot3_msgs packages as prerequisite. Without these prerequisite packages, the Simulation cannot be launched.
Please follow the PC Setup instructions if you did not install required packages and dependent packages.
[Remote PC]

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

Launch Simulation World

Three simulation environments are prepared for TurtleBot3. Please select one of these environments to launch Gazebo.

Please make sure to completely terminate other Simulation world before launching a new world.

  1. Empty World

    [Remote PC]
    $ export TURTLEBOT3_MODEL=burger
    $ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
    
  2. TurtleBot3 World

    [Remote PC]
    $ export TURTLEBOT3_MODEL=waffle
    $ roslaunch turtlebot3_gazebo turtlebot3_world.launch
    
  3. TurtleBot3 House

    [Remote PC]
    $ export TURTLEBOT3_MODEL=waffle_pi
    $ roslaunch turtlebot3_gazebo turtlebot3_house.launch
    

NOTE: If TurtleBot3 House is launched for the first time, downloading the map may take more than a few minutes depending the network status.

Operate TurtleBot3

In order to teleoperate the TurtleBot3 with the keyboard, launch the teleoperation node with below command in a new terminal window.
[Remote PC]

$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Read more about How to run Autonomous Collision Avoidance

A simple collision avoidance node is prepared which keeps certain distance from obstacles and make turns to avoid collision.
In order to autonomously drive a TurtleBot3 in the TurtleBot3 world, please follow the instruction below.

  1. Terminate the turtlebot3_teleop_key node by entering Ctrl + C to the terminal that runs the teleop node.

  2. Enter the below command to the terminal.
    [Remote PC]

    $ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
    

Read more about How to visualize Simulation data(RViz)

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

$ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch

NOTE

  • Please run the Simulation on Remote PC.
  • Launching the Simulation for the first time on the Remote PC may take a while to setup the environment.

Read more about TurtleBot3 Simulation

TurtleBot3 supports simulation development environment that can be programmed and developed with a virtual robot in the simulation. There are two development environments to do this, one is using a fake node with 3D visualization tool RViz, and the other is using the 3D robot simulator Gazebo.

  • The fake node is suitable for testing with the robot model and movement, but it does not support sensors.
  • If you need to perform SLAM or Navigation, Gazebo would be a feasible solution as it supports sensors such as IMU, LDS, and camera.

In this instruction, Gazebo will be mainly introduced which is most widely used among ROS developers.

Gazebo Simulation

The contents in e-Manual can be updated without a prior notice and video contents could be outdated.

This Gazebo Simulation uses ROS Gazebo package, therefore, proper Gazebo version for ROS2 Humble has to be installed before running this instruction.

Install Simulation Package

The TurtleBot3 Simulation Package requires turtlebot3 and turtlebot3_msgs packages as prerequisite. Without these prerequisite packages, the Simulation cannot be launched.
Please follow the PC Setup instructions if you did not install required packages and dependent packages.

$ cd ~/turtlebot3_ws/src/
$ git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$ cd ~/turtlebot3_ws && colcon build --symlink-install

Launch Simulation World

Three simulation environments are prepared for TurtleBot3. Please select one of these environments to launch Gazebo.

Please make sure to completely terminate other Simulation world before launching a new world.

  1. Empty World
    $ export TURTLEBOT3_MODEL=burger
    $ ros2 launch turtlebot3_gazebo empty_world.launch.py
    
  2. TurtleBot3 World
    $ export TURTLEBOT3_MODEL=waffle
    $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
    
  3. TurtleBot3 House
    $ export TURTLEBOT3_MODEL=waffle_pi
    $ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
    

NOTE: If TurtleBot3 House is launched for the first time, downloading the map may take more than a few minutes depending the network status.

Operate TurtleBot3

In order to teleoperate the TurtleBot3 with the keyboard, launch the teleoperation node with below command in a new terminal window.

$ ros2 run turtlebot3_teleop teleop_keyboard

Read more about How to run Autonomous Collision Avoidance

A simple collision avoidance node is prepared which keeps certain distance from obstacles and make turns to avoid collision.
In order to autonomously drive a TurtleBot3 in the TurtleBot3 world, please follow the instruction below.

  1. Terminate the turtlebot3_teleop_key node by entering Ctrl + C to the terminal that runs the teleop node.

  2. Enter the below command to the terminal.

    $ ros2 run turtlebot3_gazebo turtlebot3_drive
    

Read more about How to visualize Simulation data(RViz2)

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

$ ros2 launch turtlebot3_bringup rviz2.launch.py