mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
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
This commit is contained in:
parent
3215c50660
commit
c5486ca47e
@ -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…
x
Reference in New Issue
Block a user