Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed May 6, 2024
1 parent 0e7b6bd commit 2e9090b
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
squashfs-root/
husarion-depthai*
11 changes: 11 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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
36 changes: 19 additions & 17 deletions snap/local/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ log() {
logger -t "${SNAP_NAME}" "launcher: $message"
}

# Iterate over the snap parameters and retrieve their value.
# If a value is set, it is forwarded to the launch file.
OPTIONS="namespace mecanum include-camera-mount camera-model lidar-model"
LAUNCH_OPTIONS=""
ros2 launch depthai_ros_driver camera.launch.py params_file:=$SNAP/usr/share/${SNAP_NAME}/config/oak-1-low-bandwidth.yaml

for OPTION in ${OPTIONS}; do
VALUE="$(snapctl get driver.${OPTION})"
if [ -n "${VALUE}" ]; then
LAUNCH_OPTIONS+="${OPTION}:=${VALUE} "
fi
done
# # Iterate over the snap parameters and retrieve their value.
# # If a value is set, it is forwarded to the launch file.
# OPTIONS="namespace mecanum include-camera-mount camera-model lidar-model"
# LAUNCH_OPTIONS=""

# Replace '-' with '_'
LAUNCH_OPTIONS=$(echo ${LAUNCH_OPTIONS} | tr - _)
# for OPTION in ${OPTIONS}; do
# VALUE="$(snapctl get driver.${OPTION})"
# if [ -n "${VALUE}" ]; then
# LAUNCH_OPTIONS+="${OPTION}:=${VALUE} "
# fi
# done

if [ "${LAUNCH_OPTIONS}" ]; then
# watch the log with: "journalctl -t rosbot-xl"
log "Running with options: ${LAUNCH_OPTIONS}"
fi
# # Replace '-' with '_'
# LAUNCH_OPTIONS=$(echo ${LAUNCH_OPTIONS} | tr - _)

ros2 launch rosbot_xl_bringup combined.launch.py ${LAUNCH_OPTIONS}
# if [ "${LAUNCH_OPTIONS}" ]; then
# # watch the log with: "journalctl -t rosbot-xl"
# log "Running with options: ${LAUNCH_OPTIONS}"
# fi

# ros2 launch rosbot_xl_bringup combined.launch.py ${LAUNCH_OPTIONS}
96 changes: 96 additions & 0 deletions snap/local/oak-1-low-bandwidth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
/oak:
ros__parameters:
# qos_overrides:
# /oak/rgb/image_raw:
# publisher:
# reliability: best_effort
# /oak/rgb/image_raw/compressed:
# publisher:
# reliability: best_effort
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_width: 1280 #valid if i_output_isp: false
# i_height: 720 #valid if i_output_isp: false
# i_interleaved: false
# scaling 1920x1080 1:3 to 640x360
# https://docs-beta.luxonis.com/develop/ros/depthai-ros-driver#Available%20sensors%20and%20their%20resolutions%3A
# IMX378, 1080P is 1920x1080, i_isp_den=3 and i_isp_num=2 will give 1280x720 (/16=)
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
ffmpeg_image_transport:
encoding: libx264
preset: ultrafast
tune: zerolatency
use_sim_time: false
8 changes: 4 additions & 4 deletions snap/local/ros_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ log() {
FASTDDS_FILE=$(snapctl get fastdds-default-profiles-file)

if [ ! -f "${SNAP_COMMON}/${FASTDDS_FILE}" ]; then
# eg. /var/snap/rosbot-xl/common/fastdds.xml
# eg. /var/snap/${SNAP_NAME}/common/fastdds.xml
log "${SNAP_COMMON}/${FASTDDS_FILE} does not exist."
fi

Expand All @@ -19,16 +19,16 @@ if [ -n "${FASTDDS_FILE}" ] && [ -f "${SNAP_COMMON}/${FASTDDS_FILE}" ]; then
log "$(cat $FASTRTPS_DEFAULT_PROFILES_FILE)"
else
TRANSPORT="$(snapctl get transport)"
# watch the log with: "journalctl -t rosbot-xl"
# watch the log with: "journalctl -t ${SNAP_NAME}"
log "transport: ${TRANSPORT}"

case "$TRANSPORT" in
shm)
export FASTRTPS_DEFAULT_PROFILES_FILE=$SNAP/usr/share/rosbot-xl/config/shm-only.xml
export FASTRTPS_DEFAULT_PROFILES_FILE=$SNAP/usr/share/${SNAP_NAME}/config/shm-only.xml
log "$(cat $FASTRTPS_DEFAULT_PROFILES_FILE)"
;;
udp)
export FASTRTPS_DEFAULT_PROFILES_FILE=$SNAP/usr/share/rosbot-xl/config/udp-only.xml
export FASTRTPS_DEFAULT_PROFILES_FILE=$SNAP/usr/share/${SNAP_NAME}/config/udp-only.xml
log "$(cat $FASTRTPS_DEFAULT_PROFILES_FILE)"
;;
builtin)
Expand Down
54 changes: 36 additions & 18 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ apps:
command: usr/bin/launcher.sh
command-chain: [usr/bin/ros_setup.sh]
daemon: simple
install-mode: enable
plugs: [network, network-bind, shm-plug]
install-mode: disable
plugs: [network, network-bind, shm-plug, raw-usb]
slots: [shm-slot]
extensions: [ros2-humble-ros-base]

husarion-depthai:
command: usr/bin/launcher.sh
command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh]
plugs: [network, network-bind, shm-plug]
plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support]
# block-devices,
slots: [shm-slot]
extensions: [ros2-humble-ros-base]

Expand All @@ -67,24 +68,41 @@ apps:
stop:
command: usr/bin/stop_launcher.sh

layout:
/run/udev/data:
bind: $SNAP_DATA/run/udev/data

parts:

husarion-depthai:
plugin: colcon
source: https://github.com/luxonis/depthai-ros.git
source-branch: v2.8.1-humble
build-packages:
- python3-catkin-pkg-modules
override-pull: |
plugin: nil
stage-packages:
- ros-humble-depthai-ros
# override-stage: |
override-prime: |
craftctl default
# Set the snap version from the git tag
# The grade is set to 'stable' if the latest entry in the git history
# is the tag itself, otherwise set to devel
version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')"
[ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
craftctl set version="$version"
craftctl set grade="$grade"
#version="$(dpkg -s ros-humble-depthai-ros-driver | grep Version | awk '{print $2}')"
#craftctl set version="$version"
craftctl set version="2.9.0-1jammy.20240415.141623"
craftctl set grade="stable"
# husarion-depthai:
# plugin: colcon
# source: https://github.com/luxonis/depthai-ros.git
# source-branch: v2.8.1-humble
# build-packages:
# - python3-catkin-pkg-modules
# override-pull: |
# craftctl default

# # Set the snap version from the git tag
# # The grade is set to 'stable' if the latest entry in the git history
# # is the tag itself, otherwise set to devel
# version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')"
# [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
# craftctl set version="$version"
# craftctl set grade="$grade"

# build-packages:
# - python3-vcstool
Expand Down Expand Up @@ -113,5 +131,5 @@ parts:
organize:
'*.sh': usr/bin/
'*.py': usr/bin/
'*.yaml': usr/share/rosbot-xl/config/
'*.xml': usr/share/rosbot-xl/config/
'*.yaml': usr/share/husarion-depthai/config/
'*.xml': usr/share/husarion-depthai/config/

0 comments on commit 2e9090b

Please sign in to comment.