Skip to content

TurtleBot3

GitHub code build GitHub last commit

DockerHub image Docker image arch Docker image version Docker image size

Please note that this workspace is only tested in simulation.

Last tested (Isaac Sim only) on commit bdbb82d by @j3soon.
Last tested on commit e8f1c8d by @j3soon.

đŸŗ Start Container

Make sure your system meets the system requirements and have followed the setup instructions before using this workspace.

Run the following commands in a Ubuntu desktop environment. If you are using a remote server, make sure you're using a terminal within a remote desktop session (e.g., VNC) instead of SSH (i.e., don't use ssh -X or ssh -Y).

cd ~/ros2-essentials/turtlebot3_ws/docker
docker compose build
xhost +local:docker
docker compose up -d
# The initial build will take a while, please wait patiently.

If your user's UID is 1000, you may replace the docker compose build command with docker compose pull.

The commands in the following sections assume that you are inside the Docker container:

# in a new terminal
docker exec -it ros2-turtlebot3-ws bash

TurtleBot3 burger is used by default, you can change it by the following (such as waffle or waffle_pi):

export TURTLEBOT3_MODEL=waffle_pi

If the initial build somehow failed, run:

rm -r build install
colcon build --symlink-install

Once you have finished testing, you can stop and remove the container with:

docker compose down

🔍 Inspect Robot Model

Skip this section if you are not interested in inspecting the URDF/USD model.

(TODO)

đŸĒ Launch Simulator

Launch one of the following simulators (1) RViz Fake Node (2) Gazebo (3) Isaac Sim.

RViz Fake Node

Note that RViz fake node doesn't simulate sensors such as LiDAR.

ros2 launch turtlebot3_fake_node turtlebot3_fake_node.launch.py

Gazebo

Launch one of the following worlds:

ros2 launch turtlebot3_gazebo empty_world.launch.py
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py

Isaac Sim

Convert URDF file to USD file and generate OmniGraph:

cd /home/ros2-essentials/turtlebot3_ws/isaacsim/scripts
./create_urdf_from_xacro.sh
~/isaacsim/python.sh create_turtlebot3_burger_from_urdf.py
~/isaacsim/python.sh create_turtlebot3_burger_with_omnigraph.py
# and close the window when you see the `Done` message (or seeing segmentation fault)

Note that it is entirely unnecessary to convert URDF to USD with scripts, this is just for demonstration purposes. You can directly use the GUI to import the URDF file, and track it in Git easily with USDA. See stretch3-ws for more details.

It is also unnecessary to generate OmniGraph with scripts, you can directly use the GUI to create it, and track it in Git easily with USDA. See stretch3-ws commit history for more details.

Start Isaac Sim in GUI mode:

~/isaacsim/isaac-sim.sh

Alternatively, start Isaac Sim in headless WebRTC mode:

isaac-sim.streaming.sh

and use the WebRTC Streaming Client.

Open the file with OmniGraph we just generated in the bottom panel:

/home/ros2-essentials/turtlebot3_ws/isaacsim/assets/turtlebot3_burger_og.usd

or use File > Open Recent to re-open it, and click Play (SPACE) to start simulation.

There is currently a known issue on the 2D Lidar sensor and are waiting for an upstream fix.

[Error] [isaacsim.sensors.rtx.plugin] IsaacComputeRTXLidarFlatScan: Lidar prim is not a 2D Lidar, and node will not execute. Stop the simulation, correct the issue, and restart.

(TODO: Fix turtlebot3_burger_isaacsim.urdf.xacro and remove this block after the upstream fix is released.)

To view the OmniGraph, right click the ActionGraph on the right panel and select Open Graph.

🧩 Features

Skip this section if you are not interested in enabling features.

Note that Cartographer and Nav2 features are only supported in Gazebo simulation for now.

Cartographer

Basic LiDAR SLAM.

ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True

Requires a running SLAM or a pre-generated map.

ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=true map:=$ROS2_WS/map.yaml

đŸ•šī¸ Control Robot

Raw Message

Move forward:

ros2 topic pub /cmd_vel geometry_msgs/Twist "{'linear': {'x': 0.2, 'y': 0.0, 'z': 0.0}, 'angular': {'x': 0.0, 'y': 0.0, 'z': 0.0}}"

Stop:

ros2 topic pub /cmd_vel geometry_msgs/Twist "{'linear': {'x': 0.0, 'y': 0.0, 'z': 0.0}, 'angular': {'x': 0.0, 'y': 0.0, 'z': 0.0}}"

Teleoperate

Teleoperate through keyboard:

ros2 run turtlebot3_teleop teleop_keyboard

Simple Auto Drive

Simple collision avoidance:

ros2 run turtlebot3_gazebo turtlebot3_drive

Visualize with RViz

Open a new terminal and visualize published topics in RViz:

ros2 launch turtlebot3_bringup rviz2.launch.py

Set RViz GUI:

  • Fixed Frame: world.
  • Add Camera with topic /rgb.
  • (TODO: Add LaserScan, PointCloud, and Depth after the upstream fix is released.)

💾 Save Output

Skip this section if you are not interested in saving maps.

Occupancy Grid Map

ros2 run nav2_map_server map_saver_cli -f $ROS2_WS/map

📌 References