mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Update sitl_run to check for -gen.sdf files (#15232)
Co-authored-by: Anton Erasmus <antonerasm@gmail.com>
This commit is contained in:
parent
979243f38f
commit
1ae579b5d5
@ -80,6 +80,13 @@ if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]; then
|
||||
SIM_PID=`echo $!`
|
||||
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
|
||||
if [ -x "$(command -v gazebo)" ]; then
|
||||
# Get the model name
|
||||
model_name="${model}"
|
||||
# Check if a 'modelname-gen.sdf' file exist for the models using jinja and generating the SDF files
|
||||
if [ -f "${src_path}/Tools/sitl_gazebo/models/${model}/${model}-gen.sdf" ]; then
|
||||
model_name="${model}-gen"
|
||||
fi
|
||||
|
||||
# Set the plugin path so Gazebo finds our model and sim
|
||||
source "$src_path/Tools/setup_gazebo.bash" "${src_path}" "${build_path}"
|
||||
if [ -z $PX4_SITL_WORLD ]; then
|
||||
@ -107,7 +114,7 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
|
||||
fi
|
||||
SIM_PID=$!
|
||||
|
||||
while gz model --verbose --spawn-file="${src_path}/Tools/sitl_gazebo/models/${model}/${model}.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="${src_path}/Tools/sitl_gazebo/models/${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!"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user