sitl: add possibility to not run gazebo when running make

This commit is contained in:
Jonas Vautherin 2017-09-14 11:51:02 +02:00 committed by Lorenz Meier
parent dd98ed565e
commit 93c1ad3103
1 changed files with 30 additions and 21 deletions

View File

@ -93,6 +93,8 @@ then
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]
then
if [ -x "$(command -v gazebo)" ]
then
if [[ -z "$DONT_RUN" ]]
then
# Set the plugin path so Gazebo finds our model and sim
source $src_path/Tools/setup_gazebo.bash ${src_path} ${build_path}
@ -109,6 +111,7 @@ then
nice -n 20 gzclient --verbose &
GUI_PID=`echo $!`
fi
fi
else
echo "You need to have gazebo simulator installed!"
exit 1
@ -124,8 +127,11 @@ sitl_command="$sudo_enabled $sitl_bin $no_pxh $chroot_enabled $src_path $src_pat
echo SITL COMMAND: $sitl_command
if [[ -n "$DONT_RUN" ]]
then
echo "Not running simulation (\$DONT_RUN is set)."
# Start Java simulator
if [ "$debugger" == "lldb" ]
elif [ "$debugger" == "lldb" ]
then
lldb -- $sitl_command
elif [ "$debugger" == "gdb" ]
@ -153,6 +159,8 @@ else
$sitl_command
fi
if [[ -z "$DONT_RUN" ]]
then
if [ "$program" == "jmavsim" ]
then
pkill -9 -P $SIM_PID
@ -164,3 +172,4 @@ then
kill -9 $GUI_PID
fi
fi
fi