Skip to content

Commit

Permalink
Dev (#1)
Browse files Browse the repository at this point in the history
* working ffmpeg and namespaces
  • Loading branch information
DominikN authored May 31, 2024
1 parent 2e9090b commit 21e6858
Show file tree
Hide file tree
Showing 24 changed files with 1,023 additions and 195 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/snap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: snap
on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
outputs:
snap-file: ${{ steps.build-snap.outputs.snap }}
steps:

- uses: actions/checkout@v3
with:
fetch-tags: true

# Build the snap
- uses: snapcore/action-build@v1
with:
snapcraft-channel: latest/edge
id: build-snap
env:
SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: 1

# Make sure the snap is installable
- run: |
sudo snap install --dangerous ${{ steps.build-snap.outputs.snap }}
# Save snap for subsequent job(s)
- uses: actions/upload-artifact@v3
with:
name: husarion-depthai-snap
path: ${{ steps.build-snap.outputs.snap }}

publish:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:

# Retrieve the snap
- uses: actions/download-artifact@v3
with:
name: husarion-depthai-snap
path: .

# Publish the snap on the store
# by default on 'edge' but on 'candidate' for tags
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{needs.build.outputs.snap-file}}
release: ${{ startsWith(github.ref, 'refs/tags/') && 'candidate' || 'edge'}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
squashfs-root/
husarion-depthai*
husarion-depthai*
exported.txt
151 changes: 149 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,149 @@
# depthai-snap
Building husarion-depthai snap for depthai-ros package
# husarion-depthai-snap

Snap for OAK-x cameras customized for Husarion robots

## Apps

| app | description |
| - | - |
| `husarion-depthai.start` | Start the `husarion-depthai.daemon` service |
| `husarion-depthai.stop` | Stop the `husarion-depthai.daemon` service |
| `husarion-depthai` | Start the application in the foreground (run in the current terminal). Remember to stop the daemon first |

## Setup FFMPEG

The default values for `ffmpeg-image-transport` are:

```bash
$ sudo snap get husarion-depthai driver.ffmpeg-image-transport
Key Value
driver.ffmpeg-image-transport.encoding libx264
driver.ffmpeg-image-transport.preset ultrafast
driver.ffmpeg-image-transport.tune zerolatency
```

to check available options run:

```bash
ffmpeg -encoders
```

find the list of available presets by running

```bash
ffmpeg -h encoder=$SELECTED_ENCODER`
```

## Setup Astra Params

Default astra params are stored in the following file:

```bash
$ sudo snap get husarion-depthai driver.params-file
/var/snap/husarion-depthai/common/depthai_params.yaml
```

The default `depthai_params.yaml` file content:

```yaml
---
/**:
ros__parameters:
camera:
i_calibration_dump: false
i_enable_imu: false
i_enable_ir: false
i_external_calibration_path: ''
i_floodlight_brightness: 0
i_ip: ''
i_laser_dot_brightness: 800
i_mx_id: ''
i_nn_type: none
i_pipeline_dump: false
i_pipeline_type: RGB
i_publish_tf_from_calibration: false
i_restart_on_diagnostics_error: false
i_usb_port_id: ''
i_usb_speed: SUPER_PLUS
diagnostic_updater:
period: 1.0
imu:
i_acc_cov: 0.0
i_acc_freq: 400
i_batch_report_threshold: 5
i_enable_rotation: false
i_get_base_device_timestamp: false
i_gyro_cov: 0.0
i_gyro_freq: 400
i_mag_cov: 0.0
i_max_batch_reports: 10
i_message_type: IMU
i_rot_cov: -1.0
i_sync_method: LINEAR_INTERPOLATE_ACCEL
i_update_ros_base_time_on_ros_msg: false
rgb:
i_add_exposure_offset: false
i_board_socket_id: 0
i_calibration_file: ''
i_disable_node: false
i_enable_feature_tracker: false
i_enable_lazy_publisher: false #true
i_enable_nn: false
i_enable_preview: false
i_exposure_offset: 0
i_fps: 20.0
i_fsync_continuous: false
i_fsync_trigger: false
i_get_base_device_timestamp: false
i_height: 432 #720
i_interleaved: false
i_isp_den: 5 #3 #3 valid if i_output_isp: true
i_isp_num: 2 #2 valid if i_output_isp: true
i_keep_preview_aspect_ratio: true
i_low_bandwidth: true #false
i_low_bandwidth_quality: 20
i_max_q_size: 30
i_output_isp: true
i_preview_height: 300
i_preview_size: 300
i_preview_width: 300
i_publish_topic: true
i_resolution: 1080P
i_reverse_stereo_socket_order: false
i_sensor_img_orientation: AUTO
i_set_isp3a_fps: false
i_set_isp_scale: true
i_simulate_from_topic: false
i_simulated_topic_name: ''
i_update_ros_base_time_on_ros_msg: false
i_width: 768 #1280
r_exposure: 20000
r_focus: 1
r_iso: 800
r_set_man_exposure: false
r_set_man_focus: false
r_set_man_whitebalance: false
r_whitebalance: 3300
use_sim_time: false
```

To set a new params create a copy of the `astra-params.yaml` file:

```bash
sudo cp \
/var/snap/husarion-depthai/common/depthai_params.yaml \
/var/snap/husarion-depthai/common/depthai_params2.yaml
```

Modify the content of the `astra-params2.yaml` file, eg:

```bash
sudo vim /var/snap/husarion-depthai/common/depthai_params2.yaml
```

And set the new path to the config file:

```bash
sudo snap set husarion-depthai driver.params-file=/var/snap/husarion-depthai/common/depthai_params2.yaml
```
11 changes: 0 additions & 11 deletions compose.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions demo/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# services:
# luxonis:
# image: husarion/depthai:humble-2.8.1-20240127
# volumes:
# - /dev/bus/usb:/dev/bus/usb
# - ./squashfs-root/usr/share/husarion-depthai/config/oak-1-low-bandwidth.yaml:/params.yaml
# device_cgroup_rules:
# - 'c 189:* rmw'
# command: >
# ros2 launch depthai_ros_driver camera.launch.py
# params_file:=/params.yaml

# x-common-config:
# &common-config
# network_mode: host
# ipc: host
# restart: unless-stopped

# x-dds-envs:
# &dds-envs
# env_file: .env.dds

services:

rviz:
image: husarion/rviz2:humble-11.2.9-20240111
network_mode: host
ipc: host
runtime: ${DOCKER_RUNTIME:-runc}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./default.rviz:/default.rviz
- ./rviz.launch.py:/rviz.launch.py
environment:
- DISPLAY=${DISPLAY:?err}
- LIBGL_ALWAYS_SOFTWARE=${LIBGL_ALWAYS_SOFTWARE:-1}
- NVIDIA_VISIBLE_DEVICES=all # if LIBGL_ALWAYS_SOFTWARE=1 this env var is ignored
- NVIDIA_DRIVER_CAPABILITIES=all # if LIBGL_ALWAYS_SOFTWARE=1 this env var is ignored
command: ros2 launch /rviz.launch.py

Loading

0 comments on commit 21e6858

Please sign in to comment.