Files
ros-raspbot-v2/README.md
T
m5p3nc3r ef78f19e72 Add image and streaming from USB camera
Plus a little freshen up of the readme's
2026-05-07 16:38:36 +00:00

143 lines
3.9 KiB
Markdown

# raspbot_v2
ROS 2 robot platform based on the Yahboom Raspbot V2. Multiple services run as Docker containers, coordinated by Docker Compose.
---
## Sub-projects
| Directory | Description |
|---|---|
| [robot/](robot/README.md) | Differential-drive motor control, pan/tilt camera, and ultrasonic range sensor |
| [lidar/](lidar/README.md) | RPLIDAR A1 laser scanner |
| [oled/](oled/README.md) | OLED display dashboard |
| [wifi/](wifi/README.md) | Wi-Fi hotspot fallback manager |
| [camera_publisher/](camera_publisher/README.md) | V4L2 camera → ROS 2 topic publisher |
| [webrtc_streamer/](webrtc_streamer/README.md) | WebRTC browser stream server |
| [webui/](webui/README.md) | Browser-based robot controller |
| [ansible/](ansible/README.md) | Provisioning playbook for the Raspberry Pi |
---
## Setting up the robot
### 1. Flash Raspberry Pi OS
Use the [Raspberry Pi Imager](https://www.raspberrypi.com/software/) to write Raspberry Pi OS (64-bit, Lite recommended) to a microSD card.
Before writing, open **Advanced options** (⚙) and configure:
| Setting | Value |
|---|---|
| Hostname | `raspbot-v2.local` |
| SSH | Enabled |
| Username / Password | Your preferred credentials |
| Wi-Fi | Your network SSID and password (if not using Ethernet) |
Write the image, insert the card, and power on the Pi. Once it is reachable on the network (test with `ping raspbot-v2.local`), proceed to the next step.
### 2. Provision with Ansible
The [ansible/](ansible/) directory contains a playbook that handles the remaining setup (enabling SPI, installing Docker). See [ansible/README.md](ansible/README.md) for full instructions.
---
## Building
### Prerequisites
- Docker with BuildKit enabled
- For cross-compilation from an amd64 host, register QEMU user-space emulation once:
```bash
docker run --rm --privileged tonistiigi/binfmt --install arm64
```
### Build all images
```bash
docker compose build
```
Or build a single service:
```bash
docker compose build robot
docker compose build lidar
```
---
## Deploying
Pipe images directly to the target over SSH — no intermediate file or registry needed:
```bash
docker save raspbot_v2:latest raspbot_v2_lidar:latest \
| ssh <user>@raspbot-v2.local docker load
```
Then copy the compose file and any `.env` to the target:
```bash
scp docker-compose.yml <user>@raspbot-v2.local:~/
```
Replace `<user>` with the username configured in [ansible/inventory.ini](ansible/inventory.ini).
---
## Launching
### Start everything
```bash
docker compose up
```
To run in the background:
```bash
docker compose up -d
docker compose logs -f # follow logs
docker compose down # stop and remove containers
```
### Environment variables
Create a `.env` file alongside `docker-compose.yml` to override defaults:
```bash
ROS_DOMAIN_ID=0
LIDAR_PORT=/dev/ttyUSB0
LIDAR_FRAME_ID=laser
WIFI_SSID=MyNetwork
```
| Variable | Default | Description |
|---|---|---|
| `ROS_DOMAIN_ID` | `0` | ROS 2 domain — must match on all nodes |
| `LIDAR_PORT` | `/dev/ttyUSB0` | Host device node for the RPLIDAR |
| `LIDAR_FRAME_ID` | `laser` | `frame_id` in published `LaserScan` messages |
| `WIFI_SSID` | _(empty)_ | Target SSID; if unset the Wi-Fi container creates a hotspot immediately |
| `HOTSPOT_SSID` | `raspbot-hotspot` | Fallback hotspot SSID |
| `HOTSPOT_PASSWORD` | `raspbot1234` | Fallback hotspot passphrase |
---
## Project layout
```
.
├── docker-compose.yml
├── docker-entrypoint.sh
├── robot/ # Motor controller, pan/tilt, ultrasonic
├── lidar/ # RPLIDAR A1
├── oled/ # OLED display dashboard
├── wifi/ # Wi-Fi hotspot fallback
├── camera_publisher/ # V4L2 camera → ROS 2 topic
├── webrtc_streamer/ # WebRTC browser stream
├── webui/ # Browser-based controller UI
└── ansible/ # Raspberry Pi provisioning
```