-
Notifications
You must be signed in to change notification settings - Fork 51
/
start_gazebo.sh
executable file
·119 lines (97 loc) · 2.41 KB
/
start_gazebo.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
#
# UT Austin Villa start script for 3D Simulation Competitions
#
AGENT_BINARY=agentspark
BINARY_DIR="."
LIBS_DIR="./libs"
NUM_PLAYERS=1
team="UTAustinVilla_Base"
host="localhost"
port=3100
paramsfile=paramfiles/defaultParams.txt
mhost="localhost"
export LD_LIBRARY_PATH=$LIBS_DIR:$LD_LIBRARY_PATH
usage()
{
(echo "Usage: $0 [options]"
echo "Available options:"
echo " --help prints this"
echo " HOST specifies server host (default: localhost)"
echo " -p, --port PORT specifies server port (default: 3100)"
echo " -t, --team TEAMNAME specifies team name"
echo " -mh, --mhost HOST IP of the monitor for sending draw commands (default: localhost)"
echo " -pf, --paramsfile FILENAME name of a parameters file to be loaded (default: paramfiles/defaultParams.txt)") 1>&2
}
fParsedHost=false
paramsfile_args="--paramsfile ${paramsfile}"
while [ $# -gt 0 ]
do
case $1 in
--help)
usage
exit 0
;;
-mh|--mhost)
if [ $# -lt 2 ]; then
usage
exit 1
fi
mhost="${2}"
shift 1
;;
-p|--port)
if [ $# -lt 2 ]; then
usage
exit 1
fi
port="${2}"
shift 1
;;
-t|--team)
if [ $# -lt 2 ]; then
usage
exit 1
fi
team="${2}"
shift 1
;;
-pf|--paramsfile)
if [ $# -lt 2 ]; then
usage
exit 1
fi
DIR_PARAMS="$( cd "$( dirname "$2" )" && pwd )"
PARAMS_FILE=$DIR_PARAMS/$(basename $2)
paramsfile_args="${paramsfile_args} --paramsfile ${PARAMS_FILE}"
shift 1
;;
*)
if $fParsedHost;
then
echo 1>&2
echo "invalid option \"${1}\"." 1>&2
echo 1>&2
usage
exit 1
else
host="${1}"
fParsedHost=true
fi
;;
esac
shift 1
done
opt="${opt} --host=${host} --port ${port} --team ${team} ${paramsfile_args} --mhost=${mhost}"
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR
for ((i=1;i<=$NUM_PLAYERS;i++)); do
case $i in
*)
echo "Running agent No. $i"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --gazebo --paramsfile paramfiles/defaultParams_gazebo.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --gazebo --paramsfile paramfiles/defaultParams_gazebo.txt > stdout$i 2> stderr$i &
;;
esac
sleep 1
done