Skip to content

Commit

Permalink
Add OAK-D demo (#5)
Browse files Browse the repository at this point in the history
* Add pre-commit

* Add oak-d-lite

* Rename

* Rviz config

* Jakub suggestions

Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com>

---------

Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com>
  • Loading branch information
rafal-gorecki and delihus authored May 7, 2024
1 parent 8e58798 commit d3fe1f7
Show file tree
Hide file tree
Showing 19 changed files with 489 additions and 79 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
name: Build/Publish ROS Docker Image
---
name: Build/Publish ROS Docker Image

on:
on:
workflow_dispatch:
inputs:
build_type:
description: "Is it a \"development\" or a \"stable\" release?"
description: Is it a "development" or a "stable" release?
required: true
default: 'development'
default: development
type: choice
options:
- development
- stable
target_distro:
description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)"
description: In case of "stable" release specify the ROS distro of the existing docker image (eg.
humble)
type: string
default: "ardent"
default: ardent
target_release:
description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)"
description: In case of "stable" release specify the version of the existing docker image (eg.
1.0.12)
type: string
default: "0.0.0"
default: 0.0.0
target_date:
description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)"
description: In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: "20131206"
default: '20131206'
repository_dispatch:
types: [rebuild]
pull_request:
Expand All @@ -36,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ros_distro: ["iron", "humble"]
ros_distro: [iron, humble]

steps:

Expand All @@ -47,11 +51,11 @@ jobs:
uses: husarion-ci/ros-docker-img-action@v0.4
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
main_branch_name: main
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: "linux/amd64, linux/arm64"
platforms: linux/amd64, linux/arm64
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/vulcanexus-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
name: Build/Publish Vulcanexus Docker Image
---
name: Build/Publish Vulcanexus Docker Image

on:
on:
workflow_dispatch:
inputs:
build_type:
description: "Is it a \"development\" or a \"stable\" release?"
description: Is it a "development" or a "stable" release?
required: true
default: 'development'
default: development
type: choice
options:
- development
- stable
target_distro:
description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)"
description: In case of "stable" release specify the ROS distro of the existing docker image (eg.
humble)
type: string
default: "ardent"
default: ardent
target_release:
description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)"
description: In case of "stable" release specify the version of the existing docker image (eg.
1.0.12)
type: string
default: "0.0.0"
default: 0.0.0
target_date:
description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)"
description: In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: "20131206"
default: '20131206'
repository_dispatch:
types: [rebuild]
pull_request:
Expand All @@ -36,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ros_distro: ["humble"]
ros_distro: [humble]

steps:

Expand All @@ -47,12 +51,12 @@ jobs:
uses: husarion-ci/ros-docker-img-action@v0.4
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
main_branch_name: ros2
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: "linux/amd64, linux/arm64"
prefix: "vulcanexus-"
platforms: linux/amd64, linux/arm64
prefix: vulcanexus-
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
Expand Down
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-xml
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: name-tests-test
files: ^.*\/test\/.*$
args: [--pytest-test-first]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
entry: codespell *

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
files: ^(?!.*compose).*$
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100']

- repo: https://github.com/psf/black
rev: 23.12.0
hooks:
- id: black
args: [--line-length=99]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator,
# black checks it

- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
args: [--max-line-length=100, --ignore=D001]
exclude: ^.*\/CHANGELOG\.rst/.*$

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ RUN apt-get update && apt-get install -y \
rm -rf /var/lib/apt/lists/*

RUN echo $(cat /ros2_ws/src/depthai-ros/depthai-ros/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') > /version.txt

48 changes: 30 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
# depthai-docker
# Docker Images for Luxonis OAK Series cameras

Dockerized `depthai-ros` ROS package ([GitHub repo here](https://github.com/luxonis/depthai-ros))
The repository includes a GitHub Actions workflow that automatically deploys built Docker images to the [husarion/depthai-docker](https://hub.docker.com/r/husarion/depthai) Docker Hub repository. This process is based on [depthai-ros](https://github.com/luxonis/depthai-ros) repository.

## Quick start
[![ROS Docker Image](https://github.com/husarion/depthai-docker/actions/workflows/ros-docker-image.yaml/badge.svg)](https://github.com/husarion/depthai-docker/actions/workflows/ros-docker-image.yaml)

1. Connect the camera with the USB cable.
## Prepare Environment

2. Clone this repository:
```
git clone https://github.com/husarion/depthai-docker.git
cd depthai-docker/demo/oak-1
```
1. Plug in the Device

3. Pull necessary docker images:
```
docker compose pull
```
You can use `lsusb` command to check if the device is visible.

4. Launch it with the RViz:
```
xhost +local:docker
docker compose up
```
## Demo

1. Clone the repository

```bash
git clone https://github.com/husarion/depthai-docker.git
cd depthai-docker/demo/oak-1
```

2. Activate the device

```bash
docker compose up luxonis
```

3. Launch visualization

```bash
xhost local:root
docker compose up rviz
```

> [!NOTE]
> To use the latest version of the image, run the `docker compose pull` command.
2 changes: 1 addition & 1 deletion demo/oak-1-ffmpeg/.env.gpu
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DISPLAY=${DISPLAY:?err}
NVIDIA_VISIBLE_DEVICES=all
NVIDIA_DRIVER_CAPABILITIES=all
NVIDIA_DRIVER_CAPABILITIES=all
5 changes: 3 additions & 2 deletions demo/oak-1-ffmpeg/camera.params.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
/oak:
ros__parameters:
# qos_overrides: # group for all the qos settings
Expand Down Expand Up @@ -35,7 +36,7 @@
i_width: 640
i_height: 360
i_interleaved: false
i_isp_den: 3
i_isp_den: 3
i_isp_num: 2
i_keep_preview_aspect_ratio: true
i_low_bandwidth: false
Expand Down Expand Up @@ -67,4 +68,4 @@
tune: zerolatency
use_sim_time: false

# 1080P is in pixels 1920x1080
# 1080P is in pixels 1920x1080
8 changes: 4 additions & 4 deletions demo/oak-1-ffmpeg/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ services:
device_cgroup_rules:
- 'c 189:* rmw'
command: >
ros2 launch depthai_ros_driver camera.launch.py
parent_frame:=oak-1-base-frame
ros2 launch depthai_ros_driver camera.launch.py
parent_frame:=oak-1-base-frame
params_file:=/camera.params.yaml
rviz:
image: husarion/rviz2:humble-11.2.9-20240111
<<:
<<:
- *common-config
- *gpu-config
volumes:
Expand All @@ -58,4 +58,4 @@ services:
# # ==========================
# # - ROS_LOCALHOST_ONLY=0
# # - HUSARNET_PARTICIPANT_ENABLED=false
# command: ddsrouter -c /config.yaml
# command: ddsrouter -c /config.yaml
3 changes: 2 additions & 1 deletion demo/oak-1-ffmpeg/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: v3.0
participants:
- name: LocalUdpParticipant
Expand All @@ -12,6 +13,6 @@ participants:
domain: 0
transport: shm
allowlist:
- name: "rt/*"
- name: rt/*
blocklist: []
builtin-topics: []
2 changes: 1 addition & 1 deletion demo/oak-1-ffmpeg/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
run:
#!/bin/bash
xhost +local:docker
docker compose up
docker compose up
44 changes: 26 additions & 18 deletions demo/oak-1-ffmpeg/rviz.launch.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
return LaunchDescription([
# Launch RViz2 with a default configuration
Node(
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=['-d', '/default.rviz'],
output='screen'
),
# Launch image_transport to republish images
Node(
package='image_transport',
executable='republish',
name='republish',
arguments=['ffmpeg', 'in/ffmpeg:=/oak/rgb/image_raw/ffmpeg', 'raw', 'out:=/image_raw/uncompressed'],
output='screen'
),
])
return LaunchDescription(
[
# Launch RViz2 with a default configuration
Node(
package="rviz2",
executable="rviz2",
name="rviz2",
arguments=["-d", "/default.rviz"],
output="screen",
),
# Launch image_transport to republish images
Node(
package="image_transport",
executable="republish",
name="republish",
arguments=[
"ffmpeg",
"in/ffmpeg:=/oak/rgb/image_raw/ffmpeg",
"raw",
"out:=/image_raw/uncompressed",
],
output="screen",
),
]
)
2 changes: 1 addition & 1 deletion demo/oak-1-ffmpeg/shm-only.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>
</profiles>
2 changes: 1 addition & 1 deletion demo/oak-1-theora/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ros:iron-ros-core

RUN apt update && apt install -y \
ros-${ROS_DISTRO}-rqt*
ros-${ROS_DISTRO}-rqt-image-view
3 changes: 2 additions & 1 deletion demo/oak-1-theora/camera.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
/oak:
ros__parameters:
# qos_overrides: # group for all the qos settings
Expand Down Expand Up @@ -26,7 +27,7 @@
i_calibration_file: ''
i_enable_preview: false
i_fps: 30.0
i_width: 640
i_width: 640
i_height: 360
i_interleaved: false
i_keep_preview_aspect_ratio: true
Expand Down
Loading

0 comments on commit d3fe1f7

Please sign in to comment.