Skip to content

Commit

Permalink
added image-view app
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed Jun 7, 2024
1 parent 7a4fa2c commit febfc87
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions snap/local/image_view_launcher.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit febfc87

Please sign in to comment.