From 101d2d736117314719dd2475bd219f394e699cfa Mon Sep 17 00:00:00 2001 From: Brendan Bartels <bbartels@iastate.edu> Date: Mon, 30 Jan 2017 14:05:19 -0600 Subject: [PATCH] groundStation: Add script for batch setting of PID constants --- groundStation/scripts/parameters.txt | 27 +++++++++++++++++++++++++++ groundStation/scripts/setpid_batch.sh | 17 +++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 groundStation/scripts/parameters.txt create mode 100644 groundStation/scripts/setpid_batch.sh diff --git a/groundStation/scripts/parameters.txt b/groundStation/scripts/parameters.txt new file mode 100644 index 000000000..b9bc0a6b0 --- /dev/null +++ b/groundStation/scripts/parameters.txt @@ -0,0 +1,27 @@ +lat p 1.0 +lat i 1.0 +lat d 1.0 +long p 1.0 +long i 1.0 +long d 1.0 +height p 1.0 +height i 1.0 +height d 1.0 +pitch p 1.0 +pitch i 1.0 +pitch d 1.0 +roll p 1.0 +roll i 1.0 +roll d 1.0 +yaw p 1.0 +yaw i 1.0 +yaw d 1.0 +pitchv p 1.0 +pitchv i 1.0 +pitchv d 1.0 +rollv p 1.0 +rollv i 1.0 +rollv d 1.0 +yawv p 1.0 +yawv i 1.0 +yawv d 1.0 diff --git a/groundStation/scripts/setpid_batch.sh b/groundStation/scripts/setpid_batch.sh new file mode 100644 index 000000000..2525b2bce --- /dev/null +++ b/groundStation/scripts/setpid_batch.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Use default filename if it wasn't given at the command line +if [ $# -eq 0 ]; then + filename="parameters.txt" +else + filename=$1 +fi + +# Define the regular expression used for grep to define accepted line +regex='(lat|long|height|pitch|roll|yaw|pitchv|rollv|yawv) (p|i|d) ([-+]?[0-9]*\.?[0-9]+)' + +# the awk program to assemble the correct pieces of the string for a ./Cli call +awk_prog='{print "./Cli setpid" " " "--" $1 " " "-" $2 " " $3}' + +# Search, parse, and execute ./Cli commands +grep -E "$regex" $filename | awk "$awk_prog" | bash -- GitLab