From 26021b01cb68c3d1b77ff1db1adae07f793bab00 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 22 Jul 2020 14:57:56 +0200 Subject: [PATCH] Tools: abort SITL start if gzserver fails Sometimes gzserver seems to not start or not start fast enough. In this case, instead of stalling forever, it would be nice to abort. --- Tools/sitl_run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 324969718e..bd872b133c 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -105,8 +105,11 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then fi fi SIM_PID=$! - gz model --spawn-file="${src_path}/Tools/sitl_gazebo/models/${model}/${model}.sdf" --model-name=${model} -x 1.01 -y 0.98 -z 0.83 + if gz model --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 "An instance of Gazebo is not running."; then + echo "Start of gzserver failed" + exit 1 + fi if [[ -n "$HEADLESS" ]]; then echo "not running gazebo gui"