-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunsim
executable file
·52 lines (43 loc) · 1.23 KB
/
runsim
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
#!/bin/bash
TELEOPTIME=120
AUTOTIME=15
DISABLEDTIME=30
STARTTIME=2
TESTTIME=0
if [ $1 == "--gui" ]; then
GUI=--simscreen
shift
fi
rootdir=$(git rev-parse --show-toplevel)
cd $rootdir
if [ $# -lt 2 ]; then
echo Expected at least two arguments, the name of the robot and the mode
echo An optional third argument can be the simulator event file
echo The mode should be 'auto', 'teleop'
exit 1
fi
FLAGS=""
if [ $# -eq 3 ]; then
FLAGS="--events robots/$1/sims/$3"
fi
legal=NO
if [ $2 == 'auto' ]; then
legal=YES
echo Running auto mode
echo makebuild/SIMULATOR/Debug/$1/$1 --auto $AUTOTIME --oper 0 --start $STARTTIME --test 0 $FLAGS $GUI
exec makebuild/SIMULATOR/Debug/$1/$1 --auto $AUTOTIME --oper 0 --start $STARTTIME --test 0 $FLAGS $GUI
fi
if [ $2 == 'teleop' ]; then
legal=YES
echo Running teleop mode
exec makebuild/SIMULATOR/Debug/$1/$1 --auto 0 --oper $TELEOPTIME --start $STARTTIME --test 0 $FLAGS $GUI
fi
if [ $2 == 'both' ]; then
legal=YES
echo Running teleop mode
exec makebuild/SIMULATOR/Debug/$1/$1 --auto $AUTOTIME --oper $TELEOPTIME --start $STARTTIME --test 0 $FLAGS $GUI
fi
if [ legal == 'NO' ]; then
echo "Invalid mode, must be 'auto' or 'teleop'"
exit 1
fi