diff --git a/snap/local/image_view_launcher.sh b/snap/local/image_view_launcher.sh new file mode 100755 index 0000000..b8a1a2c --- /dev/null +++ b/snap/local/image_view_launcher.sh @@ -0,0 +1,20 @@ +#!/bin/sh -e + +# Get the namespace and device namespace from snapctl +NAMESPACE="$(snapctl get driver.namespace)" +NAME="$(snapctl get driver.name)" + +# Construct the topic name, ensuring no double slashes +TOPIC="/${NAMESPACE}/${NAME}/rgb/image_raw/ffmpeg" + +# Remove any leading or trailing slashes and ensure the topic starts with a single slash +TOPIC=$(echo $TOPIC | sed 's:^/*::' | sed 's:/*$::') +TOPIC="/$TOPIC" + +echo "Running image_view with topic: $TOPIC" + +# find . -name "libcanberra-gtk-module.so" +# export LD_LIBRARY_PATH=$SNAP/usr/lib/$(uname -m)-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so:$LD_LIBRARY_PATH + +# Run the image_view node with the constructed topic +ros2 run image_view image_view --ros-args --remap image/ffmpeg:=$TOPIC -p image_transport:=ffmpeg diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index c7cfe05..32fb515 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -102,6 +102,13 @@ apps: stop: command: usr/bin/stop_launcher.sh + image-view: + command: usr/bin/image_view_launcher.sh + command-chain: [usr/bin/ros_setup.sh] + plugs: [network, network-bind, shm-plug, desktop, desktop-legacy, wayland, unity7, opengl] + slots: [shm-slot] + extensions: [ros2-humble-ros-base] + parts: husarion-depthai: @@ -124,6 +131,14 @@ parts: craftctl set version="$version" craftctl set grade="stable" + image-view: + plugin: nil + stage-packages: + - ros-humble-image-view + - libcanberra-gtk-module + - libcanberra-gtk3-module + - libglu1-mesa + # ffmpeg: # plugin: colcon # source: https://github.com/ros-misc-utilities/ffmpeg_image_transport.git