-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_gs.sh
executable file
·65 lines (53 loc) · 1.72 KB
/
start_gs.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# Usage: ./start_gs.sh <start_ground_station? 0|1|2> <gs_id>
GS_START="1"
if [ $1 -a $1 = "h" ]; then
echo "Usage: ${0} <start_ground_station? 0|1|2> <gs_id>"
exit 0
fi
if [ $1 -a $1 = "0" ]; then
GS_START="0"
fi
if [ $1 -a $1 = "2" ]; then
GS_START="2"
fi
GS_ID=10
if [ $2 ]; then
GS_ID=$2
fi
if [ $GS_START = "1" ]; then
# Start the simulated ground station with id GS_ID
groundStationSim/build/main $GS_ID > output/output_gs &
YARP_NAME=groundstationsim${GS_ID}
fi
if [ $GS_START = "2" ]; then
# Start the real ground station with id GS_ID
groundStation/build/main $GS_ID > output/output_gs &
YARP_NAME=groundstation${GS_ID}
fi
if [ $GS_START != "0" ]; then
# Start common ground station modules
mapUAVs/build/main $GS_ID > output/output_mapuavs_${GS_ID} &
mapFire/build/main $GS_ID > output/output_mapfire_${GS_ID} &
gsGuiInterface/build/main $GS_ID > output/output_gsGuiInterface &
fi
# Modules that need to read shared memory need to wait a bit until shared memory is created
sleep 5
if [ $GS_START != "0" ]; then
gsVisualizer/build/main $GS_ID > output/output_gsVis &
fi
# Wait for all modules to be ready
sleep 5
# Connect the modules, assume simulator is ready
if [ $GS_START = "1" ]; then
# Connect ground station to simulator
yarp connect /sim0/groundstation /${YARP_NAME}/sim
yarp connect /${YARP_NAME}/tosim /sim0/fromgroundstation
fi
if [ $GS_START != "0" ]; then
# Connect modules within simulated ground station
yarp connect /${YARP_NAME}/tomapuavs /mapuavs${GS_ID}/fromradio
yarp connect /${YARP_NAME}/tomapfire /mapfire${GS_ID}/fromradio
yarp connect /${YARP_NAME}/toguiinterface /gsguiinterface${GS_ID}/fromradio
yarp connect /gsguiinterface${GS_ID}/toradio /${YARP_NAME}/fromguiinterface
fi