From 91e7eb8865deb6eca67f63846ea31b050da513c8 Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Thu, 20 Jun 2019 13:57:08 +0200 Subject: [PATCH 1/3] Added plotting scripts. --- .gitignore | 1 + plotting/speedplot-shower.sh | 7 +++++++ plotting/speedplot.gnuplot | 2 ++ plotting/speedplot.py | 33 +++++++++++++++++++++++++++++++++ plotting/speedplot.sh | 12 ++++++++++++ plotting/speedplot1.sh | 14 ++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100755 plotting/speedplot-shower.sh create mode 100644 plotting/speedplot.gnuplot create mode 100644 plotting/speedplot.py create mode 100755 plotting/speedplot.sh create mode 100755 plotting/speedplot1.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d4ce65 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +plotting/speedplot.dat diff --git a/plotting/speedplot-shower.sh b/plotting/speedplot-shower.sh new file mode 100755 index 0000000..8c69635 --- /dev/null +++ b/plotting/speedplot-shower.sh @@ -0,0 +1,7 @@ +while true; +do + tail -n 1 speedplot.dat | awk '{printf("time since start: %.0f s\ncurrent speed: %.3f m·s¯¹\naverage speed: %.3f m·s¯¹", $1, $2, $3)}' + sleep 0.1; + clear; +done + diff --git a/plotting/speedplot.gnuplot b/plotting/speedplot.gnuplot new file mode 100644 index 0000000..d762f53 --- /dev/null +++ b/plotting/speedplot.gnuplot @@ -0,0 +1,2 @@ +set terminal qt +plot " 30000): + break +while True: + millis = input() + if millis.isspace() or millis == "": + continue + millis = int(millis) + if (millis < 5000): + break +while True: + millis = input() + if millis.isspace() or millis == "": + continue + measurements+=1 + millis = int(millis) + pulseLength = millis - lastMillis + lastMillis = millis + speed = 0.6666666666666 / (pulseLength / 1000) + avg = (avg*(measurements-1)+speed)/measurements + print(str(millis/1000) + " " + str(speed) + " " + str(avg)) + diff --git a/plotting/speedplot.sh b/plotting/speedplot.sh new file mode 100755 index 0000000..bac253e --- /dev/null +++ b/plotting/speedplot.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +for i in 1 +do + printf "plot 'speedplot.dat' using 1:2 with lines, '' using 1:3 with lines\n"; + while true + do + printf "set autoscale xy\n" + printf "replot\n" + sleep 1 + done +done | gnuplot diff --git a/plotting/speedplot1.sh b/plotting/speedplot1.sh new file mode 100755 index 0000000..281ad7d --- /dev/null +++ b/plotting/speedplot1.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +for i in 1 +do + printf "plot 'speedplot.dat' using 1:2 with lines, '' using 1:3 with lines\n"; + while true + do + printf "set autoscale y\n" + export lastMeasurementTime=$(cat speedplot.dat | tail -n 1 | awk '{print $1}') + printf "set xrange[$(echo "$lastMeasurementTime - 30" | bc):$lastMeasurementTime]\n" + printf "replot\n" + sleep 1 + done +done | gnuplot From 32ec341f2942f809d08c20366a903bff72ef068c Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Fri, 21 Jun 2019 15:51:14 +0200 Subject: [PATCH 2/3] Added titles to graphs. --- plotting/speedplot.sh | 2 +- plotting/speedplot1.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plotting/speedplot.sh b/plotting/speedplot.sh index bac253e..e98489c 100755 --- a/plotting/speedplot.sh +++ b/plotting/speedplot.sh @@ -2,7 +2,7 @@ for i in 1 do - printf "plot 'speedplot.dat' using 1:2 with lines, '' using 1:3 with lines\n"; + printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Average speed'\n"; while true do printf "set autoscale xy\n" diff --git a/plotting/speedplot1.sh b/plotting/speedplot1.sh index 281ad7d..fe0a36e 100755 --- a/plotting/speedplot1.sh +++ b/plotting/speedplot1.sh @@ -2,7 +2,7 @@ for i in 1 do - printf "plot 'speedplot.dat' using 1:2 with lines, '' using 1:3 with lines\n"; + printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Avergage speed'\n"; while true do printf "set autoscale y\n" From a6376c3e04181162be6cef2f949a32070cd54154 Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Mon, 15 Jul 2019 19:19:24 +0200 Subject: [PATCH 3/3] Gnuplots now don't steal focus. --- plotting/speedplot.sh | 2 +- plotting/speedplot1.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plotting/speedplot.sh b/plotting/speedplot.sh index e98489c..1a3f011 100755 --- a/plotting/speedplot.sh +++ b/plotting/speedplot.sh @@ -2,7 +2,7 @@ for i in 1 do - printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Average speed'\n"; + printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Average speed'\nset terminal qt noraise\n"; while true do printf "set autoscale xy\n" diff --git a/plotting/speedplot1.sh b/plotting/speedplot1.sh index fe0a36e..899326a 100755 --- a/plotting/speedplot1.sh +++ b/plotting/speedplot1.sh @@ -2,7 +2,7 @@ for i in 1 do - printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Avergage speed'\n"; + printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Avergage speed'\nset terminal qt noraise\n"; while true do printf "set autoscale y\n"