sitl_run.sh: cleanup, kill jmavsim only if $program == jmavsim

This commit is contained in:
Beat Küng 2020-09-10 13:34:09 +02:00
parent 055fa768d8
commit d5b8f6cdf9

View File

@ -49,7 +49,7 @@ else
verbose=""
fi
if [ "$model" != none ]; then
if [ "$program" == "jmavsim" ]; then
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
if [ -n "$jmavsim_pid" ]; then
kill $jmavsim_pid
@ -84,7 +84,7 @@ SIM_PID=0
if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]; then
# Start Java simulator
"$src_path"/Tools/jmavsim_run.sh -r 250 -l &
SIM_PID=`echo $!`
SIM_PID=$!
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
if [ -x "$(command -v gazebo)" ]; then
# Get the model name
@ -134,7 +134,7 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
# is putting it into the background we need to avoid it by backing off
sleep 3
nice -n 20 gzclient --verbose &
GUI_PID=`echo $!`
GUI_PID=$!
fi
else
echo "You need to have gazebo simulator installed!"
@ -145,7 +145,7 @@ elif [ "$program" == "flightgear" ] && [ -z "$no_sim" ]; then
cd "${src_path}/Tools/flightgear_bridge/"
"${src_path}/Tools/flightgear_bridge/FG_run.py" "models/"${model}".json" 0
"${build_path}/build_flightgear_bridge/flightgear_bridge" 0 `./get_FGbridge_params.py "models/"${model}".json"` &
FG_BRIDGE_PID=`echo $!`
FG_BRIDGE_PID=$!
fi
pushd "$rootfs" >/dev/null