Skip to Content
BonicBot A2DevelopmentRobot Operating SystemROS2 Development Setup

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 RobotOption 2: Develop on Your PC
Best forBeginners, quick testingCustom packages, simulations
Setup requiredNoneDocker + BonicBot image
Tools availableROS2 CLI, real hardwareRViz, Gazebo, Nav2, SLAM
Risk to robotDirect (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_IP

Replace ROBOT_IP with your robot’s actual IP address:

# Example ssh username@192.168.1.50

Enter 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/Twist
📖
Getting Started with ROS2
Drive the robot, explore topics, and run your first simulation

Option 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

  1. Install WSL2 with Ubuntu:
    ➡️ WSL Installation Guide 

  2. 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:latest

Step 3 — Create the Development Container

⚠️ Run this only once. After creation, use docker start to reopen the container (see below).
The bonicbot-data volume 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:latest

Before 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:latest

Managing Your Container

💡 Windows users: Run all Docker commands inside the Ubuntu WSL2 terminal — not PowerShell or CMD.

Essential Docker Commands

CommandWhat it does
docker start bonicbot-devStart the container
docker stop bonicbot-devStop the container gracefully
docker restart bonicbot-devStop everything running inside and start fresh — useful when nodes get stuck or something misbehaves
docker psList currently running containers
docker ps -aList 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 ps

You should see bonicbot-dev listed with status Up.

⚠️ If you don’t see it in docker ps, run docker ps -a — if it shows as Exited, just run docker start bonicbot-dev again.


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-dev

This stops all processes running inside the container and brings it back up in seconds. Your workspace files are untouched.


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:

Windows users: Also make sure the WSL extension is installed so Antigravity integrates with your Ubuntu environment.

Step 2 — Attach to the Running Container

  1. Make sure your container is running (docker start bonicbot-dev)
  2. In Antigravity, open the Docker panel from the left sidebar
  3. Under Containers, right-click bonicbot-devAttach 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 echo in 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 $DISPLAY

If the output is empty, update WSL from PowerShell:

wsl --update

Then restart WSL.


⚠️ Docker: Permission Denied

sudo usermod -aG docker $USER

Then 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 bash

Next Steps

Ready to go deeper? Follow the complete hands-on guide:

🚀
Getting Started with ROS2
Hands-on guide — teleop, simulation, RViz, and beyond
Last updated on