Overview
This guide will help you launch your first TurtleBot3 simulation in Gazebo and control the robot using keyboard teleoperation. The entire process takes less than 5 minutes once the container is built.Make sure you’ve completed the installation steps before proceeding.
Verify setup
Before launching the simulation, verify that everything is properly configured:Launch your first simulation
Let’s start with a simple empty world to verify everything works.Open terminal in VS Code
The terminal in VS Code is already connected to the container. If you need a new terminal, press
Ctrl+` or select Terminal → New TerminalLaunch Gazebo with TurtleBot3
Wait for Gazebo to initialize
The first launch takes 30-60 seconds as Gazebo downloads models and initializes. Subsequent launches are much faster.
The noVNC desktop may take 30-90 seconds to fully initialize on first access. If you see a black screen, wait a moment and refresh your browser.
Control the robot
Now that Gazebo is running, let’s control the robot using keyboard teleoperation.Open a second terminal
In VS Code, press
Ctrl+` or click the + icon in the terminal panel to open a new terminalControl the robot
Use these keys to move the robot:
i- Move forward,- Move backwardj- Rotate leftl- Rotate rightk- Stopu- Forward + lefto- Forward + rightm- Backward + left.- Backward + right
Explore different worlds
The container includes three pre-configured simulation environments:Understanding the command aliases
These shortcuts expand to full ROS2 launch commands:Access the desktop environment
The container provides a full Linux desktop accessible through your browser:Alternative VNC access
You can also use a standalone VNC client for better performance:- Windows: TigerVNC, RealVNC
- macOS: Built-in Screen Sharing, TigerVNC
- Linux: Remmina, TigerVNC
Inspect ROS2 topics
While the simulation is running, you can inspect ROS2 topics and nodes:These commands help you understand how ROS2 nodes communicate through topics. This is fundamental to ROS2 development.
Build a map with SLAM
Now let’s create a map of the environment using SLAM (Simultaneous Localization and Mapping).Launch TurtleBot3 world
Terminal 1:This provides a more interesting environment with obstacles to map
Start SLAM
Terminal 2:This launches Cartographer for SLAM. RViz2 will open automatically showing the map being built in real-time
Drive and explore
Terminal 3:Drive the robot slowly around the environment. Watch the map appear in RViz2 as you explore
Move the robot slowly and systematically to build an accurate map. Fast movements can reduce map quality.
Autonomous navigation
Use your saved map for autonomous navigation with Navigation2.Set initial pose
In RViz2 (via VNC at
http://localhost:6080):- Click the “2D Pose Estimate” button in the toolbar
- Click on the map where the robot is currently located
- Drag to set the robot’s orientation
Workspace commands
Here are essential commands for working with the ROS2 workspace:Troubleshooting
Gazebo won’t start
Solution:No robot appears in Gazebo
Solution:VNC shows black screen
Solution:- Wait 30-90 seconds for desktop to initialize
- Refresh your browser
- If still black, restart VNC:
- Wait 30 seconds and refresh browser
Graphics issues or crashes
Solution:ROS2 topics not visible
Solution:Next steps
Now that you’ve successfully launched and controlled TurtleBot3, you can:Learn ROS2 development
Create custom packages and nodes in the development guide
Explore advanced features
Try custom worlds, different robot models, and advanced navigation scenarios
Read ROS2 documentation
Visit docs.ros.org/en/jazzy for comprehensive ROS2 tutorials
Join the community
Ask questions on ROS Discourse and contribute to the project
The workspace at
/workspace/turtlebot3_ws is mounted from your host machine. All your code and files persist even if you delete the container.