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..1a3f011 --- /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 title 'Current speed', '' using 1:3 with lines title 'Average speed'\nset terminal qt noraise\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..899326a --- /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 title 'Current speed', '' using 1:3 with lines title 'Avergage speed'\nset terminal qt noraise\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