Browse Source

sitl: fix sitl_run to run on macOS (#16287)

This commit removes the readarray command from the Tools/sitl_run.sh.
This fixes the issue where SITL was not able to run due to readarray not being available on macOS
release/1.12
JaeyoungLim 4 years ago committed by GitHub
parent
commit
c5486ca47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      Tools/sitl_run.sh

23
Tools/sitl_run.sh

@ -128,16 +128,27 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then @@ -128,16 +128,27 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
SIM_PID=$!
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
readarray -d : -t paths <<< ${GAZEBO_MODEL_PATH}
for possibleModelPath in "${paths[@]}"; do
IFS_bak=$IFS
IFS=":"
for possible_model_path in ${GAZEBO_MODEL_PATH}; do
if [ -z $possible_model_path ]; then
continue
fi
# trim \r from path
possibleModelPath=$(echo $possibleModelPath | tr -d '\r')
if test -f "${possibleModelPath}/${model}/${model}.sdf" ; then
modelpath=$possibleModelPath
possible_model_path=$(echo $possible_model_path | tr -d '\r')
if test -f "${possible_model_path}/${model}/${model}.sdf" ; then
modelpath=$possible_model_path
break
fi
done
echo "Using: ${modelpath}/${model}/${model}.sdf"
IFS=$IFS_bak
if [ -z $modelpath ]; then
echo "Model ${model} not found in model path: ${GAZEBO_MODEL_PATH}"
exit 1
else
echo "Using: ${modelpath}/${model}/${model}.sdf"
fi
while gz model --verbose --spawn-file="${modelpath}/${model}/${model_name}.sdf" --model-name=${model} -x 1.01 -y 0.98 -z 0.83 2>&1 | grep -q "An instance of Gazebo is not running."; do
echo "gzserver not ready yet, trying again!"

Loading…
Cancel
Save