summaryrefslogtreecommitdiff
path: root/tf2_watch
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2021-09-27 00:05:53 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2021-09-27 00:05:53 -0500
commite0869144367ef00f64eaef5af961ce5134173c53 (patch)
tree596740a7f845b9bee716e30d668cdced5138ac6f /tf2_watch
parent9285ee94806349f32fd4b9dba707ab5ffae7fa8b (diff)
downloadextra-ros-utils-e0869144367ef00f64eaef5af961ce5134173c53.tar.xz
extra-ros-utils-e0869144367ef00f64eaef5af961ce5134173c53.zip
Add makefile for easy installation
Diffstat (limited to 'tf2_watch')
-rwxr-xr-xtf2_watch36
1 files changed, 36 insertions, 0 deletions
diff --git a/tf2_watch b/tf2_watch
new file mode 100755
index 0000000..b8e205b
--- /dev/null
+++ b/tf2_watch
@@ -0,0 +1,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