2018-09-13 09:49:56 -03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
2016-06-14 06:03:37 -03:00
|
|
|
|
2023-01-04 17:43:45 -04:00
|
|
|
SCRIPT_DIR=$(dirname $(readlink -f "$BASH_SOURCE"))
|
|
|
|
|
2016-06-14 06:03:37 -03:00
|
|
|
cd "$SCRIPT_DIR/jMAVSim"
|
|
|
|
|
2022-06-09 04:52:34 -03:00
|
|
|
port=4560
|
2016-10-20 11:50:35 -03:00
|
|
|
extra_args=
|
|
|
|
baudrate=921600
|
|
|
|
device=
|
2017-03-09 06:12:48 -04:00
|
|
|
ip="127.0.0.1"
|
2022-06-09 04:52:34 -03:00
|
|
|
protocol="tcp"
|
|
|
|
while getopts ":b:d:u:p:qsr:f:i:loat" opt; do
|
2016-09-19 15:09:12 -03:00
|
|
|
case $opt in
|
2016-10-20 11:50:35 -03:00
|
|
|
b)
|
|
|
|
baudrate=$OPTARG
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
device="$OPTARG"
|
|
|
|
;;
|
2022-06-09 04:52:34 -03:00
|
|
|
u)
|
|
|
|
protocol="udp"
|
|
|
|
;;
|
2017-03-09 06:12:48 -04:00
|
|
|
i)
|
|
|
|
ip="$OPTARG"
|
|
|
|
;;
|
2016-09-19 15:09:12 -03:00
|
|
|
p)
|
2022-06-09 04:52:34 -03:00
|
|
|
port=$OPTARG
|
2016-09-19 15:09:12 -03:00
|
|
|
;;
|
2016-10-20 11:50:35 -03:00
|
|
|
q)
|
|
|
|
extra_args="$extra_args -qgc"
|
|
|
|
;;
|
2019-05-09 04:41:06 -03:00
|
|
|
s)
|
|
|
|
extra_args="$extra_args -sdk"
|
|
|
|
;;
|
2017-03-03 12:42:41 -04:00
|
|
|
r)
|
|
|
|
extra_args="$extra_args -r $OPTARG"
|
|
|
|
;;
|
2019-03-15 04:13:03 -03:00
|
|
|
l)
|
|
|
|
extra_args="$extra_args -lockstep"
|
|
|
|
;;
|
2020-01-13 11:09:40 -04:00
|
|
|
o)
|
|
|
|
extra_args="$extra_args -disponly"
|
|
|
|
;;
|
2021-08-05 04:16:14 -03:00
|
|
|
a)
|
2022-01-11 03:29:19 -04:00
|
|
|
extra_args="$extra_args -fw" # aircraft model
|
|
|
|
;;
|
|
|
|
t)
|
|
|
|
extra_args="$extra_args -ts" # tailsitter model
|
2021-08-05 04:16:14 -03:00
|
|
|
;;
|
2016-09-19 15:09:12 -03:00
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-10-20 11:50:35 -03:00
|
|
|
if [ "$device" == "" ]; then
|
2022-06-09 04:52:34 -03:00
|
|
|
if [ "$protocol" == "tcp" ]; then
|
|
|
|
device="-tcp $ip:$port"
|
|
|
|
else
|
|
|
|
device="-udp $port"
|
|
|
|
fi
|
2016-10-20 11:50:35 -03:00
|
|
|
else
|
|
|
|
device="-serial $device $baudrate"
|
|
|
|
fi
|
|
|
|
|
2019-08-22 12:29:46 -03:00
|
|
|
if [ "$HEADLESS" = "1" ]; then
|
2019-11-01 20:17:50 -03:00
|
|
|
extra_args="$extra_args -no-gui"
|
2019-08-22 12:29:46 -03:00
|
|
|
fi
|
|
|
|
|
2016-06-14 06:03:37 -03:00
|
|
|
ant create_run_jar copy_res
|
|
|
|
cd out/production
|
2017-10-26 10:02:20 -03:00
|
|
|
|
2022-12-06 04:29:03 -04:00
|
|
|
java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.awt=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED \
|
|
|
|
-XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
|