run script Fixes 2

This commit is contained in:
2026-01-04 01:59:30 +00:00
parent 0ce6ed7e4a
commit 4b514f1dd9
3 changed files with 59 additions and 46 deletions

View File

@@ -113,29 +113,48 @@ fi
# =============================================================================
WORLD_ARG="${1:-runway}"
# All worlds must come from ardupilot_gazebo (they have the ArduPilot plugin)
# Map friendly names to actual world files
case "$WORLD_ARG" in
runway|iris)
runway|iris|default)
WORLD="${HOME}/ardupilot_gazebo/worlds/iris_runway.sdf"
;;
warehouse)
WORLD="${HOME}/ardupilot_gazebo/worlds/iris_warehouse.sdf"
;;
gimbal)
WORLD="${HOME}/ardupilot_gazebo/worlds/gimbal.sdf"
;;
zephyr|plane)
WORLD="${HOME}/ardupilot_gazebo/worlds/zephyr_runway.sdf"
;;
parachute)
WORLD="${HOME}/ardupilot_gazebo/worlds/zephyr_parachute.sdf"
;;
*)
# Try as full path
# Try as full path or filename
if [ -f "$WORLD_ARG" ]; then
WORLD="$WORLD_ARG"
else
elif [ -f "${HOME}/ardupilot_gazebo/worlds/${WORLD_ARG}" ]; then
WORLD="${HOME}/ardupilot_gazebo/worlds/${WORLD_ARG}"
elif [ -f "${HOME}/ardupilot_gazebo/worlds/${WORLD_ARG}.sdf" ]; then
WORLD="${HOME}/ardupilot_gazebo/worlds/${WORLD_ARG}.sdf"
else
WORLD=""
fi
;;
esac
if [ ! -f "$WORLD" ]; then
echo "[ERROR] World file not found: $WORLD"
if [ -z "$WORLD" ] || [ ! -f "$WORLD" ]; then
echo "[ERROR] World not found: $WORLD_ARG"
echo ""
echo "Available worlds in ~/ardupilot_gazebo/worlds/:"
ls -1 ~/ardupilot_gazebo/worlds/*.sdf 2>/dev/null | xargs -n1 basename
echo "Available options:"
echo " runway - Iris drone on runway (default)"
echo " warehouse - Iris in warehouse"
echo " gimbal - Gimbal test"
echo " zephyr - Zephyr plane"
echo " parachute - Parachute test"
echo ""
echo "Or specify full path to .sdf file"
exit 1
fi