-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_live.sh
executable file
·50 lines (39 loc) · 975 Bytes
/
run_live.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Connect our thermal soaring program to the real APM:Plane autopilot over the
# USB telemetry radio
#
# Setup: look at docs/PixhawkSimulation.md
#
# Path to find APM's sim_vehicle.sh script
APM="../ardupilot"
# Configuration
ProxyPort=2050
Script="soaring.py"
# Kill/interrupt all the processes we started on Ctrl+C
intList=()
killList=()
exiting() {
echo "Exiting..."
for i in "${killList[@]}"; do
kill $i &>/dev/null
done
# Otherwise we'll be left with it's child proccesses still running
mavlink="$(pgrep mavlink.py)"
[[ -n $mavlink ]] && kill -INT $mavlink
exit 1
}
trap "exiting" 2 15
# Start the autopilot
run_mavproxy() {
mavproxy.py --console --map --master=/dev/ttyUSB0 --out=127.0.0.1:$ProxyPort
}
# Run our code which connects to the MAVProxy ground station started by the
# autopilot script
run_ourcode() {
xterm -e "python3 \"$Script\"" &
killList+=("$!")
}
run_ourcode
run_mavproxy
wait