ROS2 Development Setup
New to ROS2? Start by connecting directly to the robot via SSH — no installation needed.
Want simulations or advanced tools? Jump to setting up a Docker dev environment.
Choose Your Approach
| Option 1: SSH into Robot | Option 2: Develop on Your PC | |
|---|---|---|
| Best for | Beginners, quick testing | Custom packages, simulations |
| Setup required | None | Docker + BonicBot image |
| Tools available | ROS2 CLI, real hardware | RViz, Gazebo, Nav2, SLAM |
| Risk to robot | Direct (use carefully) | Safe — test before deploying |
Option 1: Connect to the Real Robot via SSH
The fastest way to start. No installation needed — just SSH in and run ROS2 commands directly on the robot.
Connect
ssh username@ROBOT_IPReplace ROBOT_IP with your robot’s actual IP address:
# Example
ssh username@192.168.1.50Enter the robot’s password when prompted. You’re now in the robot’s terminal.
Try These ROS2 Commands
# See all active topics
ros2 topic list
# Stream live laser scan data
ros2 topic echo /scan
# List all running nodes
ros2 node list
# Send a velocity command to move the robot
ros2 topic pub /cmd_vel geometry_msgs/msg/TwistOption 2: Development Environment (Docker Setup)
Use this approach when you need:
- RViz — 3D visualization
- Gazebo — robot simulation
- Navigation2 — autonomous navigation
- SLAM — mapping and localization
Docker gives you a ready-to-use ROS2 environment without manually managing dependencies. Your workspace is stored in a Docker-managed volume (bonicbot-data) that persists across container recreations — no data loss if you accidentally recreate the container.
Step 1 — Install Docker
Pick your operating system:
Linux
Install Docker Engine:
➡️ Docker Engine Installation Guide
Windows
-
Install WSL2 with Ubuntu:
➡️ WSL Installation Guide -
Install Docker Desktop:
➡️ Docker Desktop for Windows
Important: Run all Docker commands inside the Ubuntu WSL2 terminal, not PowerShell or CMD.
macOS
Install Docker Desktop:
➡️ Docker Desktop for macOS
Step 2 — Pull the BonicBot Docker Image
docker pull autobonicsofficial/bonicbot:latestStep 3 — Create the Development Container
⚠️ Run this only once. After creation, use
docker startto reopen the container (see below).
Thebonicbot-datavolume is created automatically by Docker if it doesn’t exist — no setup needed.
Linux
docker run -it \
--name bonicbot-dev \
--network host \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ~/bonicbot-data:/root \
autobonicsofficial/bonicbot:latestBefore launching Gazebo or RViz for the first time, run:
xhost +local:docker
Windows (WSL2 Ubuntu Terminal)
docker run -it \
--name bonicbot-dev \
--network host \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ~/bonicbot-data:/root \
autobonicsofficial/bonicbot:latest
macOS
docker run -it \
--name bonicbot-dev \
-v ~/bonicbot-data:/root \
autobonicsofficial/bonicbot-a2:latestManaging Your Container
💡 Windows users: Run all Docker commands inside the Ubuntu WSL2 terminal — not PowerShell or CMD.
Essential Docker Commands
| Command | What it does |
|---|---|
docker start bonicbot-dev | Start the container |
docker stop bonicbot-dev | Stop the container gracefully |
docker restart bonicbot-dev | Stop everything running inside and start fresh — useful when nodes get stuck or something misbehaves |
docker ps | List currently running containers |
docker ps -a | List all containers, including stopped ones |
Starting a Session
Every time you want to work, open a terminal (WSL Ubuntu on Windows) and run:
# 1. Start the container
docker start bonicbot-dev
# 2. Verify it's running
docker psYou should see bonicbot-dev listed with status Up.
⚠️ If you don’t see it in
docker ps, rundocker ps -a— if it shows asExited, just rundocker start bonicbot-devagain.
When Things Go Wrong — Restart
If a ROS2 node crashes, a simulation freezes, or you want a clean slate without rebuilding anything:
docker restart bonicbot-devThis stops all processes running inside the container and brings it back up in seconds. Your workspace files are untouched.
Working Inside the Container — Recommended: Antigravity + Docker Extension
Opening shell sessions with docker exec -it bonicbot-dev bash works, but becomes awkward when you need multiple terminals, want to browse files, or edit code. The Antigravity Docker extension gives you all of that in one window.
Step 1 — Install the Extension
In Antigravity, install:
- Containers —
ms-azuretools.vscode-containers
Windows users: Also make sure the WSL extension is installed so Antigravity integrates with your Ubuntu environment.
Step 2 — Attach to the Running Container
- Make sure your container is running (
docker start bonicbot-dev) - In Antigravity, open the Docker panel from the left sidebar
- Under Containers, right-click
bonicbot-dev→ Attach to Container
A new Antigravity window opens — you’re now inside the container.
Step 3 — Use It Like a Normal Dev Environment
From inside the attached window you can:
- Open terminals:
Ctrl+`or Terminal → New Terminal — open as many as you need, all inside the container - Browse files: Use the Explorer panel to navigate your workspace directories
- Edit files: Open, edit, and save files directly — no need to copy anything in or out
- Split terminals: Run a ROS2 node in one terminal,
ros2 topic echoin another, Gazebo in a third — all managed in one window
This is the recommended way to work when you have multiple ROS2 processes running simultaneously.
What You Can Do Inside the Container
Once inside, your full development environment is ready:
- 🤖 Run Gazebo simulations
- 🗺️ Build maps with SLAM
- 🧭 Test Navigation2 workflows
- 📊 Visualize with RViz
- 🔧 Write and test ROS2 packages — connect to the real robot or run in simulation
Troubleshooting
⚠️ Gazebo or RViz window doesn't open
Linux
Run the following, then restart the container:
xhost +local:docker
Windows WSL2
Check if WSLg display is configured:
echo $DISPLAYIf the output is empty, update WSL from PowerShell:
wsl --updateThen restart WSL.
⚠️ Docker: Permission Denied
sudo usermod -aG docker $USERThen reboot or log out and back in.
⚠️ "Container name already in use" error
The container already exists — don’t create a new one. Just start the existing one:
docker start bonicbot-dev
docker exec -it bonicbot-dev bashNext Steps
Ready to go deeper? Follow the complete hands-on guide:
🚀