-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnapcraft_template.yaml.jinja2
192 lines (164 loc) · 6.08 KB
/
snapcraft_template.yaml.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: husarion-depthai
adopt-info: husarion-depthai
license: Apache-2.0
summary: OAK-x cameras driver for Husarion robots
icon: snap/gui/icon.png
description: |
The `husarion-depthai` snap contains all the necessary software to bring the OAK-x cameras up.
**Parameters**
The snap provides the following configurable parameters (`param name`: `default value`):
* `driver`: `{...}`
* `ros`: `{...}`
The `ros` contains the following keys:
* `ros.domain-id`: `0` - Sets the `ROS_DOMAIN_ID` environment variable for the ROS driver.
* `ros.localhost-only`: `0` - Sets the `ROS_LOCALHOST_ONLY` environment variable for the ROS driver.
* `ros.transport`: `udp` - Configures DDS transport. Options are `udp`, `shm`, `builtin` (or `rmw_fastrtps_cpp`), `rmw_cyclonedds_cpp`. Corresponding DDS XML files can be found in the `/var/snap/husarion-depthai/common` directory (custom FastDDS setups can also be created here).
* `ros.namespace`: `(unset)` - Namespace for all topics and transforms.
The `driver` contains the following keys:
* name: `oak`
* parent-frame: `oak-d-base-frame`
* camera-model: `OAK-D`
* cam-pos-x: `0.0`
* cam-pos-y: `0.0`
* cam-pos-z: `0.0`
* cam-roll: `0.0`
* cam-pitch: `0.0`
* cam-yaw: `0.0`
* camera-params: `default` - Sets the camera parameters based on `/var/snap/husarion-depthai/common/camera-params-<VALUE>.yaml`
* ffmpeg-params: `default` - Sets the FFMPEG parameters based on `/var/snap/husarion-camera/common/ffmpeg-params-<VALUE>.yaml`
To set the parameters, use the snap set command, e.g.,
snap set husarion-depthai driver.namespace=robot
grade: stable
confinement: strict
base: {{ 'core22' if ros_distro == 'humble' else 'core24' }}
contact: https://github.com/husarion/depthai-snap/issues
issues: https://github.com/husarion/depthai-snap/issues
website: https://husarion.com/
slots:
shm-slot:
interface: shared-memory
write: ['*'] # paths are relative to /dev/shm
plugs:
shm-plug:
interface: shared-memory
shared-memory: shm-slot
private: false
apps:
daemon:
command: usr/bin/launcher.sh
command-chain: [usr/bin/ros_setup.sh]
daemon: simple
install-mode: enable
plugs: [network, network-bind, shm-plug, raw-usb, hardware-observe]
slots: [shm-slot]
extensions: [ros2-{{ ros_distro }}-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, raw-usb, hardware-observe]
slots: [shm-slot]
extensions: [ros2-{{ ros_distro }}-ros-base]
start:
command: usr/bin/start_launcher.sh
restart:
command: usr/bin/restart_launcher.sh
stop:
command: usr/bin/stop_launcher.sh
parts:
husarion-depthai:
plugin: colcon
source: https://github.com/luxonis/depthai-ros.git
source-branch: {{ ros_distro }}
build-packages:
- python3-vcstool
stage-packages:
- ros-{{ ros_distro }}-image-transport
- ros-{{ ros_distro }}-image-transport-plugins
# https://index.ros.org/p/ffmpeg_image_transport/github-ros-misc-utilities-ffmpeg_image_transport/#humble
- ros-{{ ros_distro }}-ffmpeg-image-transport
- ffmpeg
- ros-{{ ros_distro }}-cv-bridge
# needed to run ffmpeg without errors:
- libpulse-dev
- libblas3
- libjpeg-turbo8-dev
- ros-{{ ros_distro }}-rmw-cyclonedds-cpp
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="stable"
{#
# uncomment when depthai-ros package for jazzy is available here: https://index.ros.org/search/?term=depthai
husarion-depthai:
plugin: nil
stage-packages:
- ros-{{ ros_distro }}-depthai-ros
- ros-{{ ros_distro }}-image-transport
- ros-{{ ros_distro }}-image-transport-plugins
# https://index.ros.org/p/ffmpeg_image_transport/github-ros-misc-utilities-ffmpeg_image_transport/#humble
- ros-{{ ros_distro }}-ffmpeg-image-transport
- ffmpeg
- ros-{{ ros_distro }}-cv-bridge
# needed to run ffmpeg without errors:
- libpulse-dev
- libblas3
- libjpeg-turbo8-dev
override-stage: |
craftctl default
version="$(apt-cache policy ros-{{ ros_distro }}-depthai-ros-driver | grep Candidate | awk '{print $2}')"
craftctl set version="$version"
craftctl set grade="stable" #}
local-files:
plugin: dump
source: snap/local/
organize:
'*.sh': usr/bin/
'*.py': usr/bin/
'*.yaml': usr/share/husarion-depthai/config/
# '*.xml': usr/share/husarion-depthai/config/
# '*.json': usr/share/husarion-depthai/config/
husarion-snap-common:
plugin: dump
source: https://github.com/husarion/husarion-snap-common
source-branch: "0.5.0"
source-type: git
build-environment:
- YQ_VERSION: "v4.35.1"
build-packages:
- curl
organize:
'local-ros/*.sh': usr/bin/
'local-ros/*.xml': usr/share/husarion-snap-common/config/
'local-ros/ros.env': usr/share/husarion-snap-common/config/
override-build: |
craftctl default
curl -L "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${CRAFT_ARCH_BUILD_FOR}" -o $CRAFT_PART_BUILD/yq
override-prime: |
craftctl default
cp $CRAFT_PART_BUILD/yq $CRAFT_PRIME/usr/bin/yq
chmod +x $CRAFT_PRIME/usr/bin/yq
rm -rf $CRAFT_PRIME/local-ros
fix-execstack:
plugin: nil
after:
- husarion-depthai
- local-files
- husarion-snap-common
build-packages:
- execstack
override-prime: |
set -eu
craftctl default
choosen_files=(
usr/lib/x86_64-linux-gnu/libamdhip64.so*
)
for f in "${choosen_files[@]}"; do
if [ -f "$f" ]; then
execstack -c "$f"
fi
done