jmavsim: fix HIL, don't add -lockstep by default

This commit is contained in:
Beat Küng 2019-03-15 08:13:03 +01:00 committed by Julian Oes
parent 8692d72501
commit 898664d919
3 changed files with 8 additions and 5 deletions

View File

@ -10,7 +10,7 @@ extra_args=
baudrate=921600 baudrate=921600
device= device=
ip="127.0.0.1" ip="127.0.0.1"
while getopts ":b:d:p:qr:f:i:" opt; do while getopts ":b:d:p:qr:f:i:l" opt; do
case $opt in case $opt in
b) b)
baudrate=$OPTARG baudrate=$OPTARG
@ -33,6 +33,9 @@ while getopts ":b:d:p:qr:f:i:" opt; do
f) f)
extra_args="$extra_args -f $OPTARG" extra_args="$extra_args -f $OPTARG"
;; ;;
l)
extra_args="$extra_args -lockstep"
;;
\?) \?)
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2
exit 1 exit 1
@ -61,11 +64,11 @@ fi
ant create_run_jar copy_res ant create_run_jar copy_res
cd out/production cd out/production
java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar -lockstep $device $extra_args java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
ret=$? ret=$?
if [ $ret -ne 0 -a $ret -ne 130 ]; then # 130 is Ctrl-C if [ $ret -ne 0 -a $ret -ne 130 ]; then # 130 is Ctrl-C
# if the start of java fails, it's probably because the GC option is not # if the start of java fails, it's probably because the GC option is not
# understood. Try starting without it # understood. Try starting without it
java -Djava.ext.dirs= -jar jmavsim_run.jar -lockstep $device $extra_args java -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
fi fi

View File

@ -4,7 +4,7 @@
# The simulator is expected to send to TCP port 4560+i for i in [0, N-1] # The simulator is expected to send to TCP port 4560+i for i in [0, N-1]
# For example jmavsim can be run like this: # For example jmavsim can be run like this:
#./Tools/jmavsim_run.sh -p 4561 #./Tools/jmavsim_run.sh -p 4561 -l
sitl_num=2 sitl_num=2
[ -n "$1" ] && sitl_num="$1" [ -n "$1" ] && sitl_num="$1"

View File

@ -72,7 +72,7 @@ fi
if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]; then if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]; then
# Start Java simulator # Start Java simulator
"$src_path"/Tools/jmavsim_run.sh -r 250 -f $speed_factor & "$src_path"/Tools/jmavsim_run.sh -r 250 -f $speed_factor -l &
SIM_PID=`echo $!` SIM_PID=`echo $!`
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
if [ -x "$(command -v gazebo)" ]; then if [ -x "$(command -v gazebo)" ]; then