TurtleBot 4 Simulator

The turtlebot4_simulator metapackage contains packages used to simulate the TurtleBot 4 in Ignition Gazebo.

Source code is available here.

Installation

The recommended way to install the Turtlebot4 simulator is to install the debian metapackage, which is available on:

  • Ubuntu 24.04 with ROS 2 Jazzy
  • Ubuntu 22.04 with ROS 2 Humble
  • Ubuntu 20.04 with ROS 2 Galactic end-of-life, not recommended

by running

  • Warning

    ROS 2 Galactic is no longer supported. Please consider upgrading to a newer release

    sudo apt install ros-galactic-turtlebot4-simulator ros-galactic-irobot-create-nodes
    
  • sudo apt install ros-humble-turtlebot4-simulator ros-humble-irobot-create-nodes
    
  • sudo apt install ros-jazzy-turtlebot4-simulator ros-jazzy-irobot-create-nodes
    

For installation from source code, see below.

Dev Tools

Install useful development tools:

sudo apt install ros-dev-tools

Gazebo

  • Warning

    ROS 2 Galactic is no longer supported. Please consider upgrading to a newer release

    Ignition Edifice must be installed:

    sudo apt-get update && sudo apt-get install wget
    sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
    wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
    sudo apt-get update && sudo apt-get install ignition-edifice
    
  • Ignition Fortress must be installed:

    sudo apt-get update && sudo apt-get install wget
    sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
    wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
    sudo apt-get update && sudo apt-get install ignition-fortress
    
  • Gazebo Harmonic must be installed:

    sudo apt-get install curl
    sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
    sudo apt-get update
    sudo apt-get install gz-harmonic
    

Source installation

Note

Source installation is an alternative to the debian package and should only be used if the debian package cannot be used or if modifications are being made to the source code.

  • Warning

    ROS 2 Galactic is no longer supported. Please consider upgrading to a newer release

    To manually install this metapackage from source, clone the git repository:

    cd ~/turtlebot4_ws/src
    git clone https://github.com/turtlebot/turtlebot4_simulator.git -b galactic
    

    Install dependencies:

    cd ~/turtlebot4_ws
    vcs import src < src/turtlebot4_simulator/dependencies.repos
    rosdep install --from-path src -yi
    

    Build the packages:

    source /opt/ros/galactic/setup.bash
    colcon build --symlink-install
    

    Next, the workspace must be sourced by running source ~/turtlebot4_ws/install/setup.bash in the terminal or by adding that command in the .bashrc file and sourcing the .bashrc file.

  • To manually install this metapackage from source, clone the git repository:

    cd ~/turtlebot4_ws/src
    git clone https://github.com/turtlebot/turtlebot4_simulator.git -b humble
    

    Install dependencies:

    cd ~/turtlebot4_ws
    rosdep install --from-path src -yi
    

    Build the packages:

    source /opt/ros/humble/setup.bash
    colcon build --symlink-install
    

    Next, the workspace must be sourced by running source ~/turtlebot4_ws/install/setup.bash in the terminal or by adding that command in the .bashrc file and sourcing the .bashrc file.

  • To manually install this metapackage from source, clone the git repository:

    cd ~/turtlebot4_ws/src
    git clone https://github.com/turtlebot/turtlebot4_simulator.git -b jazzy
    

    Install dependencies:

    cd ~/turtlebot4_ws
    rosdep install --from-path src -yi
    

    Build the packages:

    source /opt/ros/jazzy/setup.bash
    colcon build --symlink-install
    

    Next, the workspace must be sourced by running source ~/turtlebot4_ws/install/setup.bash in the terminal or by adding that command in the .bashrc file and sourcing the .bashrc file.

Networking

Any ROS 2 networking settings on the computer apply to all nodes launched including the simulation nodes. It is recommended to configure the computer for simple discovery prior to running any simulations. If the computer is on the same network as other ROS nodes unrelated to the simulation, then the LOCAL_HOST_ONLY environment variable should be set to True.

The simulation can be run in discovery server mode but the discovery server referenced must exist and be accessible for discovery as well as not having any conflicts in the topics launched.

Warning

Simulated robots and physical robots should not be combined in the same system.

Gazebo Bringup

  • Warning

    ROS 2 Galactic is no longer supported. Please consider upgrading to a newer release

    The turtlebot4_ignition_bringup package contains launch files and configurations to launch Ignition Gazebo.

    Launch files:

    • Ignition: Launches Ignition Gazebo and all required nodes to run the simulation.
    • ROS Ignition Bridge: Launches all of the required ros_ign_bridge nodes to bridge Ignition topics with ROS topics.
    • TurtleBot 4 Nodes: Launches the turtlebot4_node and turtlebot4_ignition_hmi_node required to control the HMI plugin and robot behaviour.

    Ignition launch configuration options:

    • model: Which TurtleBot 4 model to use.
      • options: standard, lite
      • default: standard
    • rviz: Whether to launch rviz.
      • options: true, false
      • default: false
    • slam: Whether to launch SLAM.
      • options: off, sync, async
      • default: off
    • nav2: Whether to launch Nav2.
      • options: true, false
      • default: false
    • param_file: Path to parameter file for turtlebot4_node.
      • default: /path/to/turtlebot4_ignition_bringup/config/turtlebot4_node.yaml
    • world: Which world to use for simulation.
      • default: depot
    • robot_name: What to name the spawned robot.
      • default: turtlebot4

    Running the simulator with default settings:

    ros2 launch turtlebot4_ignition_bringup ignition.launch.py
    

    Running synchronous SLAM with Nav2:

    ros2 launch turtlebot4_ignition_bringup ignition.launch.py slam:=sync nav2:=true rviz:=true
    
  • The turtlebot4_ignition_bringup package contains launch files and configurations to launch Ignition Gazebo.

    Launch files:

    • Turtlebot 4 Ignition Launch: Launches Ignition Gazebo and all required nodes to run the simulation.
    • Ignition: Launches Ignition Gazebo only.
    • ROS Ignition Bridge: Launches all of the required ros_ign_bridge nodes to bridge Ignition topics with ROS topics.
    • TurtleBot 4 Nodes: Launches the turtlebot4_node and turtlebot4_ignition_hmi_node required to control the HMI plugin and robot behaviour.

    Turtlebot 4 Ignition launch configuration options:

    • model: Which TurtleBot 4 model to use
      • options: standard, lite
      • default: standard
    • rviz: Whether to launch rviz
      • options: true, false
      • default: false
    • localization: Whether to launch localization
      • options: true, false
      • default: false
    • slam: Whether to launch SLAM
      • options: true, false
      • default: false
    • nav2: Whether to launch Nav2
      • options: true, false
      • default: false
    • world: Which world to use for simulation
      • options: depot, maze, warehouse
      • default: warehouse
    • namespace: Optional robot namespace
      • options: Any valid ROS 2 name as a string
      • default: blank ("")
    • x: x coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • y: y coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • z: z coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • yaw: robot and dock orientation at spawn in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0

    Running the simulator with default settings:

    ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py
    

    Running synchronous SLAM with Nav2:

    ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py slam:=true nav2:=true rviz:=true
    
  • The turtlebot4_gz_bringup package contains launch files and configurations to launch Gazebo.

    Launch files:

    • Turtlebot 4 Gazebo Launch: Launches Gazebo and all required nodes to run the simulation.
    • Gazebo: Launches Gazebo only.
    • ROS Gazebo Bridge: Launches all of the required ros_gz_bridge nodes to bridge Ignition topics with ROS topics.
    • TurtleBot 4 Nodes: Launches the turtlebot4_node and turtlebot4_ignition_hmi_node required to control the HMI plugin and robot behaviour.

    Turtlebot 4 Gazebo launch configuration options:

    • model: Which TurtleBot 4 model to use
      • options: standard, lite
      • default: standard
    • rviz: Whether to launch rviz
      • options: true, false
      • default: false
    • localization: Whether to launch localization
      • options: true, false
      • default: false
    • slam: Whether to launch SLAM
      • options: true, false
      • default: false
    • nav2: Whether to launch Nav2
      • options: true, false
      • default: false
    • world: Which world to use for simulation
      • options: depot, maze, warehouse
      • default: warehouse
    • namespace: Optional robot namespace
      • options: Any valid ROS 2 name as a string
      • default: blank ("")
    • x: x coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • y: y coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • z: z coordinate of the robot and dock spawn location in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0
    • yaw: robot and dock orientation at spawn in the gazebo world
      • options: float representing a valid free location in the map
      • default: 0.0

    Running the simulator with default settings:

    ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py
    

    Running synchronous SLAM with Nav2:

    ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py slam:=true nav2:=true rviz:=true
    

Gazebo GUI Plugins

TurtleBot 4 HMI GUI
TurtleBot 4 HMI GUI plugin

Gazebo Toolbox

  • Warning

    ROS 2 Galactic is no longer supported. Please consider upgrading to a newer release

    The turtlebot4_ignition_toolbox package contains the source code for the TurtleBot 4 HMI node. The TurtleBot 4 HMI node acts as a bridge between the turtlebot4_node and ros_ign_bridge to convert the custom TurtleBot 4 messages into standard messages such as Int32 and String.

  • The turtlebot4_ignition_toolbox package contains the source code for the TurtleBot 4 HMI node. The TurtleBot 4 HMI node acts as a bridge between the turtlebot4_node and ros_ign_bridge to convert the custom TurtleBot 4 messages into standard messages such as Int32 and String.

  • The turtlebot4_gz_toolbox package contains the source code for the TurtleBot 4 HMI node. The TurtleBot 4 HMI node acts as a bridge between the turtlebot4_node and ros_gz_bridge to convert the custom TurtleBot 4 messages into standard messages such as Int32 and String.