A reproducible environment for simulating TurtleBot4 using Gazebo (Harmonic). This setup supports SLAM (slam_toolbox) for map generation, saving maps, and running Localization + Navigation2 (Nav2).
Note: Tested on Ubuntu 24.04 with NVIDIA GPU (OpenGL 4.6) using
--gpus all.
turtlebot4_jazzy/
├── sim/ # Dockerfile, run scripts and Gazebo world
├── maps/ # Saved maps (yaml/pgm)
├── params/ # Nav2 and waypoint parameters
├── scripts/ # Mission, diagnostics and benchmark helpers
├── factory_integration/ # OPC-UA/factory UI experiments
├── vision/ # Vision datasets/assets
└── README.md # Documentation
- Docker and NVIDIA Container Toolkit (for GPU acceleration)
- X11 Server active (required for RViz2 and Gazebo GUI)
- Internet connection (to download worlds and ROS/Gazebo packages)
Build the Docker image:
cd sim
docker build --no-cache -t turtlebot4:jazzy .Start the container with GPU and X11 forwarding enabled:
./sim/run_docker.shInside the container, source the ROS environment:
source /opt/ros/jazzy/setup.bashTo start the simulation with SLAM and mapping enabled:
ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py \
slam:=true nav2:=true rviz:=trueIn RViz:
- Set
Fixed Frame = map. - Add LaserScan (
/scan) and Map (/map) displays if they are not already present.
Verification:
ros2 topic hz /scan
ros2 topic echo /map --once --qos-durability transient_localYou can now drive the robot using the Teleop panel in the Gazebo GUI or via ros2 run teleop_twist_keyboard teleop_twist_keyboard.
If the container was started with the volume mount -v $PWD/maps:/root/maps (default in run_docker.sh), you can save the generate map to the host machine:
ros2 run nav2_map_server map_saver_cli -f /root/maps/warehouseThis will generate maps/warehouse.yaml and maps/warehouse.pgm.
To run navigation with a pre-existing map (disable SLAM):
# Optional: Launch simulation separately if needed
# ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py
# Launch Localization (AMCL) providing the map path
ros2 launch turtlebot4_navigation localization.launch.py map:=/root/maps/warehouse.yaml
# Launch Nav2
ros2 launch turtlebot4_navigation nav2.launch.pyIn RViz:
- Use 2D Pose Estimate to set the initial robot position.
- Set a destination using 2D Goal Pose or the Navigation2 panel.
-
Known upstream issues and B002 notes: See KNOWN_ISSUES.md for the TurtleBot4/Nav2/network issues that influenced this project.
-
Broken TF (
map -> odom -> base_link): Runview_framesto verify the transform tree is connected.ros2 run tf2_tools view_frames
-
Map not appearing: Ensure the QoS profile is set to
TRANSIENT_LOCAL.ros2 topic echo /map --once --qos-durability transient_local -
GUI Freezing / Crashing: Verify GPU acceleration inside the container:
apt-get update && apt-get install -y mesa-utils glxinfo | grep -E "OpenGL renderer|OpenGL version"