From 3078feb2fbddc0fcd751a7a0f1507d06d4307fc6 Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Fri, 1 Nov 2024 12:47:35 -0300 Subject: [PATCH] https://git.spirirobotics.com/Spiri/spiri-sdk/pulls/6#issuecomment-818 and fix drone name --- guiTools/spawn_drones.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/guiTools/spawn_drones.sh b/guiTools/spawn_drones.sh index 4047359..a5429c3 100644 --- a/guiTools/spawn_drones.sh +++ b/guiTools/spawn_drones.sh @@ -1,11 +1,17 @@ #!/bin/bash - +set -e #PR #6 source /opt/ros/$ROS_DISTRO/setup.bash + +if [[ -z $SIM_DRONE_COUNT ]] +then + echo "SIM_DRONE_COUNT environment variable is not set." + exit 1 +fi + gz sim -v -r $WORLD_FILE_NAME & while true do topics=$(gz topic -l) - echo $topics if [[ $topics == *"/world/$WORLD_NAME"* ]] then break @@ -13,17 +19,14 @@ do sleep 1 done -if [[ -z $SIM_DRONE_COUNT ]] -then - exit 0 -fi - cd /ardupilot_gazebo/models/$DRONE_MODEL for (( j=0; j<$SIM_DRONE_COUNT; j++ )); do xacro -v gstreamer_udp_port:=$(($GSTREAMER_UDP_PORT + ($j * 10))) fdm_port_in:=$(($FDM_PORT_IN + ($j * 10))) model.xacro.sdf -o model.sdf + #! string is better than using -file option. File is not up to date in the next iteration. value=$(