sitl_run.sh handle spaces in paths

launch script for jmavsim failed to start if there were any spaces in
paths, string handling in paths was improved and tested.
This commit is contained in:
Ramón Hernán Roche Quintana 2018-11-23 09:55:44 -08:00 committed by Daniel Agar
parent a4c4f356b3
commit f387fe7e65

View File

@ -56,8 +56,8 @@ pkill -x gazebo || true
pkill -x px4 || true
pkill -x px4_$model || true
cp $src_path/Tools/posix_lldbinit $rootfs/.lldbinit
cp $src_path/Tools/posix.gdbinit $rootfs/.gdbinit
cp "$src_path/Tools/posix_lldbinit" "$rootfs/.lldbinit"
cp "$src_path/Tools/posix.gdbinit" "$rootfs/.gdbinit"
shift 6
for file in "$@"; do
@ -69,7 +69,7 @@ SIM_PID=0
if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]
then
# Start Java simulator
$src_path/Tools/jmavsim_run.sh -r 500 &
"$src_path"/Tools/jmavsim_run.sh -r 500 &
SIM_PID=`echo $!`
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]
then
@ -78,9 +78,9 @@ 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}
source "$src_path/Tools/setup_gazebo.bash" "${src_path}" "${build_path}"
gzserver --verbose ${src_path}/Tools/sitl_gazebo/worlds/${model}.world &
gzserver --verbose "${src_path}/Tools/sitl_gazebo/worlds/${model}.world" &
SIM_PID=`echo $!`
if [[ -n "$HEADLESS" ]]; then
@ -105,9 +105,9 @@ pushd "$rootfs" >/dev/null
set +e
if [[ ${model} == test_* ]] || [[ ${model} == *_generated ]]; then
sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_test -s ${src_path}/posix-configs/SITL/init/test/${model} -t $src_path/test_data"
sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_test -s \"${src_path}\"/posix-configs/SITL/init/test/${model} -t \"$src_path\"/test_data"
else
sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t $src_path/test_data"
sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t \"$src_path\"/test_data"
fi
echo SITL COMMAND: $sitl_command