Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 15 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,145 +1,27 @@
# Examples
# examples

## BlueROV with ArduSub
Example applications for Bumblebee simulators.

### Quickstart
## Sub-examples

We assume the ROS workspace is `~/workspaces/bluerov_ws`. Change the paths accordingly if needed.
- [BlueROV examples](bluerov/README.md)
- [Multivehicle examples](multivehicle/README.md)

Clone the repositories:
## Demo videos

```bash
cd ~/workspaces/bluerov_ws/src
vcs import --recursive < examples/bluerov_ws.repos
```

> **Note:** `ml_models` is hosted on Hugging Face.
> Install [Git LFS](https://git-lfs.com/) **before** importing.

Build the minimal sim image first:

```bash
cd ~/workspaces/bluerov_ws/src/ardusub_sim
./build.bash
```

Build the examples image with perception and mission-tree dependencies:

```bash
cd ~/workspaces/bluerov_ws/src/examples
./build.bash
```

### Start the container

#### Native Ubuntu with NVIDIA

Install [Rocker](https://github.com/osrf/rocker), then run:

```bash
cd ~/workspaces/bluerov_ws/src/examples
./run.bash bluerov_ws:humble
```

#### WSL 2 with WSLg

```bash
docker run --rm -it \
--gpus all \
--device=/dev/dxg \
--network=host \
--ipc=host \
-e DISPLAY="$DISPLAY" \
-e WAYLAND_DISPLAY="$WAYLAND_DISPLAY" \
-e XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" \
-e PULSE_SERVER="$PULSE_SERVER" \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA \
-e LD_LIBRARY_PATH=/usr/lib/wsl/lib \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v /mnt/wslg:/mnt/wslg \
-v /usr/lib/wsl:/usr/lib/wsl:ro \
-v ~/workspaces/bluerov_ws:/root/HOST/bluerov_ws \
bluerov_ws:humble
```

The WSL command exposes WSLg's X11/Wayland sockets and the `/dev/dxg` virtual
GPU device, allowing Gazebo to use hardware-accelerated rendering.

### Verify GPU rendering

Inside the container, before launching Gazebo:

```bash
glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"
```
### BlueROV missions

On native Linux, the renderer should identify the NVIDIA GPU. Under WSLg, it
should mention D3D12 and the GPU. It should not report `llvmpipe`, which is
software rendering.
- Bin mission: https://github.com/user-attachments/assets/6c262df8-bac6-492a-aef1-9e8cfc30d8a8
- Torpedo mission: https://github.com/user-attachments/assets/9a9c25c5-637a-403a-b34d-4048f9afb5e0

### Build the workspace
## Building

Inside the container:
Build only the project you imported dependencies for:

```bash
cd /root/HOST/bluerov_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-install \
--packages-up-to bluerov_tasks bluerov_sim bb_worlds
source install/setup.bash
```

### Demo: Square Mission

The square mission is a control smoke test:

1. Arm and enter `GUIDED`.
2. Move 2 m forward.
3. Move 2 m left.
4. Move 2 m backward.
5. Move 2 m right.

Inside the container:
# multivehicle
colcon build --packages-up-to multivehicle_examples

```bash
cd /root/HOST/bluerov_ws
tmuxp load src/examples/bluerov_mission.yaml
```

### Demo: Bin Mission

https://github.com/user-attachments/assets/6c262df8-bac6-492a-aef1-9e8cfc30d8a8

```bash
tmuxp load src/examples/bluerov_bin_mission.yaml
# bluerov
colcon build --packages-up-to bluerov_tasks
```

### Demo: Torpedo Mission

https://github.com/user-attachments/assets/9a9c25c5-637a-403a-b34d-4048f9afb5e0

```bash
tmuxp load src/examples/bluerov_torpedo_mission.yaml
```
### Foxglove layouts

Prebuilt Foxglove layouts for the Bin and Torpedo missions are available at
[BumblebeeAS/controlkitv3](https://github.com/BumblebeeAS/controlkitv3/tree/main/foxglove_layouts).
Import them into Foxglove Studio for a ready-made view of the relevant topics,
making it easier to visualize and debug each mission.

## Useful Commands

```bash
ros2 topic echo /bluerov/odom --once
ros2 topic echo /mavros/state --once
ros2 topic echo /mavros/local_position/pose --once
ros2 topic echo /bluerov/controls/_action/feedback --once
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: 'GUIDED'}"
```

## Documentation

- [Architecture and conventions](docs/architecture.md)
145 changes: 145 additions & 0 deletions bluerov/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Examples

## BlueROV with ArduSub

### Quickstart

We assume the ROS workspace is `~/workspaces/bluerov_ws`. Change the paths accordingly if needed.

Clone the repositories:

```bash
cd ~/workspaces/bluerov_ws/src
vcs import --recursive < examples/bluerov_ws.repos
```

> **Note:** `ml_models` is hosted on Hugging Face.
> Install [Git LFS](https://git-lfs.com/) **before** importing.

Build the minimal sim image first:

```bash
cd ~/workspaces/bluerov_ws/src/ardusub_sim
./build.bash
```

Build the examples image with perception and mission-tree dependencies:

```bash
cd ~/workspaces/bluerov_ws/src/examples
./build.bash
```

### Start the container

#### Native Ubuntu with NVIDIA

Install [Rocker](https://github.com/osrf/rocker), then run:

```bash
cd ~/workspaces/bluerov_ws/src/examples
./run.bash bluerov_ws:humble
```

#### WSL 2 with WSLg

```bash
docker run --rm -it \
--gpus all \
--device=/dev/dxg \
--network=host \
--ipc=host \
-e DISPLAY="$DISPLAY" \
-e WAYLAND_DISPLAY="$WAYLAND_DISPLAY" \
-e XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" \
-e PULSE_SERVER="$PULSE_SERVER" \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA \
-e LD_LIBRARY_PATH=/usr/lib/wsl/lib \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v /mnt/wslg:/mnt/wslg \
-v /usr/lib/wsl:/usr/lib/wsl:ro \
-v ~/workspaces/bluerov_ws:/root/HOST/bluerov_ws \
bluerov_ws:humble
```

The WSL command exposes WSLg's X11/Wayland sockets and the `/dev/dxg` virtual
GPU device, allowing Gazebo to use hardware-accelerated rendering.

### Verify GPU rendering

Inside the container, before launching Gazebo:

```bash
glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"
```

On native Linux, the renderer should identify the NVIDIA GPU. Under WSLg, it
should mention D3D12 and the GPU. It should not report `llvmpipe`, which is
software rendering.

### Build the workspace

Inside the container:

```bash
cd /root/HOST/bluerov_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-install \
--packages-up-to bluerov_tasks bluerov_sim bb_worlds
source install/setup.bash
```

### Demo: Square Mission

The square mission is a control smoke test:

1. Arm and enter `GUIDED`.
2. Move 2 m forward.
3. Move 2 m left.
4. Move 2 m backward.
5. Move 2 m right.

Inside the container:

```bash
cd /root/HOST/bluerov_ws
tmuxp load src/examples/bluerov_mission.yaml
```

### Demo: Bin Mission

https://github.com/user-attachments/assets/6c262df8-bac6-492a-aef1-9e8cfc30d8a8

```bash
tmuxp load src/examples/bluerov_bin_mission.yaml
```

### Demo: Torpedo Mission

https://github.com/user-attachments/assets/9a9c25c5-637a-403a-b34d-4048f9afb5e0

```bash
tmuxp load src/examples/bluerov_torpedo_mission.yaml
```
### Foxglove layouts

Prebuilt Foxglove layouts for the Bin and Torpedo missions are available at
[BumblebeeAS/controlkitv3](https://github.com/BumblebeeAS/controlkitv3/tree/main/foxglove_layouts).
Import them into Foxglove Studio for a ready-made view of the relevant topics,
making it easier to visualize and debug each mission.

## Useful Commands

```bash
ros2 topic echo /bluerov/odom --once
ros2 topic echo /mavros/state --once
ros2 topic echo /mavros/local_position/pose --once
ros2 topic echo /bluerov/controls/_action/feedback --once
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: 'GUIDED'}"
```

## Documentation

- [Architecture and conventions](docs/architecture.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion run.bash → bluerov/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e

IMAGE_NAME="${1:-bluerov_ws:humble}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
WORKSPACE_DIR="$(cd "${SCRIPT_DIR}/../../.." && pwd)"

rocker \
--devices /dev/dri \
Expand Down
40 changes: 40 additions & 0 deletions multivehicle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# multivehicle examples

Missions and control demos built on
[`multivehicle_sim`](https://github.com/BumblebeeAS/multivehicle_sim).

## Launch files

- `bluerov_mission.launch.py`: `multivehicle_sim` + `ground_truth_to_mavros` + `bluerov_tasks/bluerov_movement.py`
- `boat_control.launch.py`: BlueBoat thrust mixer + LOS controller (+ optional mission node)
- `px4_offboard.launch.py`: PX4 offboard demo from `uav2_offboard`

## Setup

```bash
cd ~/mvsim_ws
vcs import src < src/examples/multivehicle/examples.repos --recursive

cd src/multivehicle_sim
./build.bash

cd ../examples/multivehicle
./build.bash
./run.bash multivehicle_examples:humble
```

Inside the container:

```bash
cd /root/HOST/mvsim_ws
colcon build --symlink-install --packages-up-to multivehicle_examples microxrcedds_agent bb_robotx_dashboard
source install/setup.bash
tmuxp load src/examples/multivehicle/tmuxp/mvsim_debug.yaml
```

## Provenance

- `packages/multivehicle_examples/scripts/blueboat_mission.py` adapted from `bring-up/etc/uav2_sim`
- `packages/multivehicle_examples/scripts/blueboat_thrust_mixer.py` adapted from `bring-up/etc/uav2_sim`
- `packages/multivehicle_examples/scripts/blueboat_waypoint_controller.py` adapted from `bring-up/etc/uav2_sim`
- PX4 offboard demo is provided by `https://github.com/BumblebeeAS/uav2_offboard`
22 changes: 22 additions & 0 deletions multivehicle/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -e

image_name=multivehicle_examples
image_tag=humble

if [ ! -f "docker/Dockerfile" ]; then
echo "Err: docker/Dockerfile not found. Run from src/examples/multivehicle."
exit 1
fi

if ! docker image inspect multivehicle_sim:humble >/dev/null 2>&1; then
echo "Err: base image multivehicle_sim:humble not found."
echo "Build it first from src/multivehicle_sim."
exit 1
fi

image_plus_tag=$image_name:$(export LC_ALL=C; date +%Y_%m_%d_%H%M)
docker build --rm -t $image_plus_tag -f docker/Dockerfile docker && \
docker tag $image_plus_tag $image_name:$image_tag && \
echo "Built $image_plus_tag and tagged as $image_name:$image_tag"
14 changes: 14 additions & 0 deletions multivehicle/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM multivehicle_sim:humble

SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ARG HOME_DIR=/root

RUN apt-get update && apt-get install -y --no-install-recommends \
ros-humble-navigation2 \
ros-humble-nav2-bringup && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR ${HOME_DIR}
Loading