This demo runs the TurtleBot3 Navigation2 stack in simulation using Docker and tmux automation scripts.
The workflow is designed to run entirely within one container session — you enter the container once, perform SLAM to create a map, then run Navigation2 using that saved map. You can then run Nav2 with a custom python script for and automated survey demo.
Install Docker and Docker Compose on your host system:
https://www.docker.com/get-started/
Verify installation:
docker --version
docker compose version- Host: X11 display enabled (default on most desktops)
- GPU acceleration is optional; CPU simulation is sufficient for this demo.
Allow Docker containers to display graphical windows (Gazebo and RViz):
xhost +local:rootFrom the project root directory (where your Dockerfile and docker-compose.yml are located):
docker compose up --build -dThis builds the container image and installs:
- ROS 2 Humble
- TurtleBot3 Simulation Packages
- Navigation2 (Nav2)
- Cartographer SLAM
- tmux + automation scripts
Once the container is running:
docker exec -it nav2-demo bashYou should now see something like:
root@<container_id>:/workspace/src#
You are now inside the container’s shell environment, starting in the workspace/src directory.
All subsequent steps take place inside this container.
To leave the container at any time, simply type:
exitThis will return you to your host machine’s terminal.
Inside the container:
bash /root/scripts/slam_tmux.shThis starts a tmux session that automatically launches:
- Gazebo simulation
- Cartographer (SLAM) + RViz
- Teleop control
- Map saver utility
| Tab | Name | Description |
|---|---|---|
| [0] | guide | Instructions + quit control (q) |
| [1] | gazebo | Gazebo launch |
| [2] | slam | Cartographer (SLAM) + RViz launch |
| [3] | teleop | Keyboard control (must be active tab to drive) |
| [4] | map_saver | Press Enter anytime to save map |
Click the tab name at bottom of the terminal OR use the Alt + # shortcuts:
- Alt + 0 → guide
- Alt + 1 → gazebo
- Alt + 2 → slam
- Alt + 3 → teleop
- Alt + 4 → map_saver
- Start in [0] guide to review instructions.
- Wait for Gazebo and RViz to pop-up.
- Switch to [3] teleop.
- Before driving:
- How to drive:
- Be selected into [3] teleop terminal.
- Use W/A/S/D/X keys to control the robots linear and angular velocities.
- *Controlling velocities to navigate can feel weird at first, remember you can always stop with S.
- As you move the robot:
- Gazebo shows the simulated robot moving in the environment.
- RViz Displays the occupancy grid map updating in real time
- Walls and obstacles appear as black lines.
- Unexplored regions are gray.
- Free space is white.
- When the occupancy map appears complete:
- Once finished, return to [0] guide and enter
qto quit the session.
This stops all processes and returns you to the container shell.
After completing SLAM and saving the map, you can launch the Navigation2 stack.
Inside the same container session:
bash /root/scripts/nav_tmux.shThis starts a tmux session that launches:
- Gazebo simulation
- Nav2 + RViz
| Tab | Name | Description |
|---|---|---|
| [0] | guide | Instructions + quit control (q) |
| [1] | gazebo | Gazebo launch |
| [2] | nav2 | Nav2 + RViz launch |
Use the Alt + number shortcuts:
- Alt + 0 → guide
- Alt + 1 → gazebo
- Alt + 2 → nav2
- Start in [0] guide to review instructions.
- Wait for Gazebo and RViz to pop-up.
- In RViz use the 2D Pose Estimate tool to set the robot's initial pose:
- Click the 2D Pose Estimate tool in the top tool bar.
- Click and drag on the map to indicate the robot’s approximate position and heading (can reference Gazebo for rough initial pose).
- Once localization is stable, use the Nav2 Goal tool to send navigation goals:
- Click the Nav2 Goal button in the top toolbar.
- Click and drag on the desired destination on the map to define the goal position and orientation.
- The robot will plan a path (displayed as a colored line) and begin moving toward that goal.
- This can be repeated to send additional goals.
- You can monitor progress with Gazebo and RViz.
- Gazebo shows the robot "physically" moving around the simulated world.
- RVIZ shows the planned path, current postion, local costmap, and goal status updates in real time.
- When finished, return to [0] guide terminal and enter
qto quit the session.
This stops all processes and returns you to the container shell.
After manually tasking your in Nav2, you can now see how you can automate that process with Python!
Inside the same container session:
bash /root/scripts/survey_tmux.shThis starts a tmux session that launches:
- Gazebo simulation
- Nav2 + RViz
- Python survey script
| Tab | Name | Description |
|---|---|---|
| [0] | guide | Instructions + quit control (q) |
| [1] | gazebo | Gazebo launch |
| [2] | nav2 | Nav2 + RViz launch |
| [3] | survey | Run survey script |
Use the Alt + number shortcuts:
- Alt + 0 → guide
- Alt + 1 → gazebo
- Alt + 2 → nav2
- Alt + 3 → survey
- Start in [0] guide to review instructions.
- Wait for Gazebo and RViz to pop-up.
- RViz should now display the saved map from the SLAM stage.
- View RViz and Gazebo side by side (like in Stage 2)
- If Gazebo is hung up, just wait, since we are now using a larger map, can take longer to boot up.
- You can monitor [3] survey terminal for tasking updates, however the survey should start automatically for you to watch!
- Gazebo shows the robot "physically" moving around the simulated world.
- RVIZ shows the planned path, current postion, local costmap, and goal status updates in real time.
- When finished, return to [0] guide terminal and enter
qto quit the session.
This stops all processes and returns you to the container shell. - To exit the container:
exit
| File | Purpose |
|---|---|
Dockerfile |
Builds ROS 2 Humble + TurtleBot3 + Nav2 + Cartographer + tmux |
docker-compose.yml |
Defines container runtime and GUI configuration |
.tmux.conf |
Defines Alt + number keybindings and status bar layout |
slam_tmux.sh |
Automated SLAM (Gazebo + Cartographer + Teleop + Map Saver) |
nav_tmux.sh |
Automated Navigation2 (Gazebo + Nav2) |
survey_tmux.sh |
Automated Survey (Gazebo + Nav2 + python script) |
nav2_test.py |
Python script that sends initial and goal poses |
This workflow keeps all operations within a single container session.
You build once, enter once, and use tmux automation to transition seamlessly between SLAM and Navigation without managing multiple terminals.
Mapping, saving, localization, navigation, and a automatic survey demo are all handled through structured tmux windows with simple keyboard shortcuts.


