summaryrefslogtreecommitdiff
path: root/tf2_watch
blob: b8e205b7a2036ccb33b4daac48731227a4808f24 (plain)
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
#!/bin/env bash

TIME_BETWEEN_SAMPLES="$1"

set -euo pipefail
IFS=$'\n\t'

if [ -z "${TIME_BETWEEN_SAMPLES}" ]; then
	TIME_BETWEEN_SAMPLES="25"
fi

GENERATED_PDF="frames.pdf"
GENERATED_RV="frames.gv"

cleanstop() {
	rm -rf "./${GENERATED_PDF}" "./${GENERATED_RV}"
	pkill mupdf
}

trap "cleanstop" EXIT


MU_LAUNCHED=""

while : ; do
	rosrun tf2_tools view_frames.py

	if [ -z "${MU_LAUNCHED}" ]; then
		mupdf "${GENERATED_PDF}" &
		MU_LAUNCHED="y"
	else
		pkill -hup mupdf
	fi

	sleep "${TIME_BETWEEN_SAMPLES}"
done