From 5e5c50d1cb6916385dc87a875cca3181605b8e78 Mon Sep 17 00:00:00 2001
From: ucart <ucart_groundstation@iastate.edu>
Date: Wed, 12 Apr 2017 23:59:05 -0500
Subject: [PATCH] updates to take off and touch down scripts

---
 groundStation/scripts/take_off.sh   |  5 +++--
 groundStation/scripts/touch_down.sh | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100755 groundStation/scripts/touch_down.sh

diff --git a/groundStation/scripts/take_off.sh b/groundStation/scripts/take_off.sh
index 1e7ffb322..956374e9c 100755
--- a/groundStation/scripts/take_off.sh
+++ b/groundStation/scripts/take_off.sh
@@ -1,15 +1,16 @@
 #! /bin/bash
 
 #./setsource "T trim add" "summand 1" "zero" 0
-./setsource 14 0 38 0
+./setsource 14 0 45 0
 #./setparam "Throttle trim" 0 135000
 ./setparam 13 0 135000
 
+# sleep 2
 sleep 2
 
 #./setsource "T trim add" "summand 1" "Altitude PID" "Correction"
 ./setsource 14 0 8 0
 #./setparam "Throttle trim" 0 145000 
 ./setparam 13 0 150000
-#./setparam "Alt Setpoint" 0 -0.5
+#./setparam "Alt Setpoint" 0 -0.88
 ./setparam 11 0 -0.88
diff --git a/groundStation/scripts/touch_down.sh b/groundStation/scripts/touch_down.sh
new file mode 100755
index 000000000..57b5e04aa
--- /dev/null
+++ b/groundStation/scripts/touch_down.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+
+cut_off="-0.2"
+regex='[+-]?[0-9]+\.?[0-9]*$'
+
+
+
+alt="$(echo "$(./getparam 33 0)" | grep -Eo "$regex")"
+
+while awk 'BEGIN { if ('$alt'>='$cut_off') {exit 1}}'; do
+	alt="$(echo "$(./getparam 33 0)" | grep -Eo "$regex")"
+	./setparam 11 0 $( bc <<< "$alt - 0.01")
+	echo "$alt   too high"
+	sleep .5
+done
+
+#./setparam "Throttle trim" 0 0
+./setparam 13 0 0
+#./setsource "T trim add" "summand 1" "zero" 0
+./setsource 14 0 45 0
-- 
GitLab