-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_recorder.sh
More file actions
37 lines (31 loc) · 1.04 KB
/
Copy pathrun_recorder.sh
File metadata and controls
37 lines (31 loc) · 1.04 KB
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
#!/bin/bash
# Pose Battle — pose recorder launcher
TAPPAS_DIR="/usr/lib/aarch64-linux-gnu/hailo/tappas/post_processes"
HAILO_APPS_DIR="/home/norek/hailo_tappas/hailo-apps"
VENV="$HAILO_APPS_DIR/venv_hailo_apps"
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
SCRIPT="$PROJECT_DIR/pose_recorder.py"
if [ ! -w /dev/hailo0 ]; then
echo "[*] Granting access to /dev/hailo0..."
sudo chown root:video /dev/hailo0
sudo chmod 660 /dev/hailo0
fi
export XDG_RUNTIME_DIR=/run/user/1000
export WAYLAND_DISPLAY=wayland-0
export PYTHONPATH="$HAILO_APPS_DIR:$PYTHONPATH"
cd "$TAPPAS_DIR"
echo "[*] Pose recorder. Stand in front of the camera, then SPACE."
echo "[*] E/M/H - difficulty, ENTER - save, ESC - exit"
"$VENV/bin/python3" "$SCRIPT" --input rpi --arch hailo10h "$@" &
PYTHON_PID=$!
cleanup() {
kill -INT "$PYTHON_PID" 2>/dev/null
for i in 1 2 3 4 5 6 7 8 9 10; do
kill -0 "$PYTHON_PID" 2>/dev/null || break
sleep 0.3
done
kill -KILL "$PYTHON_PID" 2>/dev/null
exit 0
}
trap cleanup SIGINT SIGTERM
wait "$PYTHON_PID"