mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 03:01:35 +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:
+17
-6
@@ -128,16 +128,27 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
|
|||||||
SIM_PID=$!
|
SIM_PID=$!
|
||||||
|
|
||||||
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
|
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
|
||||||
readarray -d : -t paths <<< ${GAZEBO_MODEL_PATH}
|
IFS_bak=$IFS
|
||||||
for possibleModelPath in "${paths[@]}"; do
|
IFS=":"
|
||||||
|
for possible_model_path in ${GAZEBO_MODEL_PATH}; do
|
||||||
|
if [ -z $possible_model_path ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
# trim \r from path
|
# trim \r from path
|
||||||
possibleModelPath=$(echo $possibleModelPath | tr -d '\r')
|
possible_model_path=$(echo $possible_model_path | tr -d '\r')
|
||||||
if test -f "${possibleModelPath}/${model}/${model}.sdf" ; then
|
if test -f "${possible_model_path}/${model}/${model}.sdf" ; then
|
||||||
modelpath=$possibleModelPath
|
modelpath=$possible_model_path
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
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
|
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!"
|
echo "gzserver not ready yet, trying again!"
|
||||||
|
|||||||
Reference in New Issue
Block a user