From e0869144367ef00f64eaef5af961ce5134173c53 Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Mon, 27 Sep 2021 00:05:53 -0500 Subject: Add makefile for easy installation --- Makefile | 20 ++++++++++++++++++++ tf2_watch | 36 ++++++++++++++++++++++++++++++++++++ tf2_watch.bash | 35 ----------------------------------- 3 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 Makefile create mode 100755 tf2_watch delete mode 100755 tf2_watch.bash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..63779dd --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +BINS :=tf2_watch + +ifeq ($(PREFIX),) + PREFIX := /usr/local +endif + +ifeq ($(BINDIR),) + BINDIR := /bin +endif + +install: + mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)/ + for bin in $(BINS); do \ + install -m 755 $$bin $(DESTDIR)$(PREFIX)$(BINDIR)/; \ + done + +uninstall: + for bin in $(BINS); do \ + rm -rf $(DESTDIR)$(BINDIR)/$$bin; \ + done 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 diff --git a/tf2_watch.bash b/tf2_watch.bash deleted file mode 100755 index 02e2580..0000000 --- a/tf2_watch.bash +++ /dev/null @@ -1,35 +0,0 @@ -#!/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="frames.pdf" - -cleanstop() { - rm -rf "./${GENERATED}" - pkill mupdf -} - -trap "cleanstop" EXIT - - -MU_LAUNCHED="" - -while : ; do - rosrun tf2_tools view_frames.py - - if [ -z "${MU_LAUNCHED}" ]; then - mupdf "${GENERATED}" & - MU_LAUNCHED="y" - else - pkill -hup mupdf - fi - - sleep "${TIME_BETWEEN_SAMPLES}" -done -- cgit v1.2.3