Skip to content

Instantly share code, notes, and snippets.

@xZise
Created November 10, 2013 21:40
Show Gist options
  • Select an option

  • Save xZise/7404340 to your computer and use it in GitHub Desktop.

Select an option

Save xZise/7404340 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
echo "Parameter missing"
exit
fi
atmo=`echo "-5000*l(10^-6)" | bc -l`
velocity="42" #dummy value
echo "Atmospheric height: $atmo m"
echo ""
echo "" > vtdata
while (( $(bc -l <<< "$velocity > 2") ))
do
altitude=`curl -s "http://$1/telemachus/datalink?a=v.altitude" | grep -oE "\-?[0-9]+(\.[0-9]*)?"`
if (( $(bc -l <<< "$altitude < $atmo") )); then
velocity=`curl -s "http://$1/telemachus/datalink?v=v.surfaceVelocity" | grep -oE "\-?[0-9]+(\.[0-9]*)?"`
radar=`curl -s "http://$1/telemachus/datalink?v=v.heightFromTerrain" | grep -oE "\-?[0-9]+(\.[0-9]*)?"`
printf "\e[1A%.1f m %.1f m/s %.1f m\n" "$altitude" "$velocity" "$radar"
echo "$altitude $velocity $radar" >> vtdata
else
printf "\e[1AToo high: %.1f m (Threshold: %.1f m)\n" "$altitude" "$atmo"
fi
sleep 1
done
echo "landed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment