mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:23:33 +08:00
sitl_run.sh: cleanup, kill jmavsim only if $program == jmavsim
This commit is contained in:
+4
-4
@@ -49,7 +49,7 @@ else
|
|||||||
verbose=""
|
verbose=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$model" != none ]; then
|
if [ "$program" == "jmavsim" ]; then
|
||||||
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
|
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
|
||||||
if [ -n "$jmavsim_pid" ]; then
|
if [ -n "$jmavsim_pid" ]; then
|
||||||
kill $jmavsim_pid
|
kill $jmavsim_pid
|
||||||
@@ -84,7 +84,7 @@ SIM_PID=0
|
|||||||
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 -l &
|
"$src_path"/Tools/jmavsim_run.sh -r 250 -l &
|
||||||
SIM_PID=`echo $!`
|
SIM_PID=$!
|
||||||
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
|
||||||
# Get the model name
|
# 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
|
# is putting it into the background we need to avoid it by backing off
|
||||||
sleep 3
|
sleep 3
|
||||||
nice -n 20 gzclient --verbose &
|
nice -n 20 gzclient --verbose &
|
||||||
GUI_PID=`echo $!`
|
GUI_PID=$!
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "You need to have gazebo simulator installed!"
|
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/"
|
cd "${src_path}/Tools/flightgear_bridge/"
|
||||||
"${src_path}/Tools/flightgear_bridge/FG_run.py" "models/"${model}".json" 0
|
"${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"` &
|
"${build_path}/build_flightgear_bridge/flightgear_bridge" 0 `./get_FGbridge_params.py "models/"${model}".json"` &
|
||||||
FG_BRIDGE_PID=`echo $!`
|
FG_BRIDGE_PID=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd "$rootfs" >/dev/null
|
pushd "$rootfs" >/dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user