From 4b514f1dd91b0ebc3ff713affa5962118095e4b3 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 4 Jan 2026 01:59:30 +0000 Subject: [PATCH] run script Fixes 2 --- README.md | 3 +- docs/ardupilot.md | 67 ++++++++++++++++-------------------- scripts/run_ardupilot_sim.sh | 35 ++++++++++++++----- 3 files changed, 59 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 62bcda2..8e611c4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ python camera_viewer.py # View camera **Terminal 1:** ```bash -./scripts/run_ardupilot_sim.sh camera +./scripts/run_ardupilot_sim.sh runway +# Options: runway, warehouse, zephyr ``` **Terminal 2:** diff --git a/docs/ardupilot.md b/docs/ardupilot.md index 671ddce..7e25597 100644 --- a/docs/ardupilot.md +++ b/docs/ardupilot.md @@ -6,7 +6,7 @@ Realistic flight controller simulation without GPS. **Terminal 1:** ```bash -./scripts/run_ardupilot_sim.sh camera +./scripts/run_ardupilot_sim.sh runway ``` **Terminal 2:** @@ -26,56 +26,40 @@ arm throttle force source ~/.bashrc ``` -Installs: ArduPilot SITL, Gazebo, ardupilot_gazebo plugin, MAVProxy +## World Options + +```bash +./scripts/run_ardupilot_sim.sh runway # Iris on runway (default) +./scripts/run_ardupilot_sim.sh warehouse # Iris in warehouse +./scripts/run_ardupilot_sim.sh zephyr # Zephyr plane +./scripts/run_ardupilot_sim.sh gimbal # Gimbal test +./scripts/run_ardupilot_sim.sh parachute # Parachute test +``` ## GPS-Denied Configuration In MAVProxy console: ```bash -# Disable all pre-arm checks -param set ARMING_CHECK 0 - -# GPS-free flight modes -mode stabilize # Manual with stabilization -mode alt_hold # Altitude hold -mode guided_nogps # Guided without GPS +param set ARMING_CHECK 0 # Disable pre-arm checks +mode stabilize # Manual with stabilization +arm throttle force # Force arm ``` ## GPU Support -The launcher auto-detects your GPU: +Auto-detects: NVIDIA > Intel > AMD > Software -| GPU | Status | -|-----|--------| -| NVIDIA | Best performance | -| Intel integrated | Good for laptops | -| AMD | Good performance | -| Software | Works but slow | - -## Camera Feed - -### In Gazebo GUI -Click camera icon → Select drone camera - -### Using camera_viewer +Check your GPU: ```bash -ros2 run ros_gz_bridge parameter_bridge /drone/camera@sensor_msgs/msg/Image[gz.msgs.Image -python camera_viewer.py --topic /drone/camera -``` - -## World Options - -```bash -./scripts/run_ardupilot_sim.sh runway # Default -./scripts/run_ardupilot_sim.sh camera # With camera +glxinfo | grep "OpenGL renderer" ``` ## MAVProxy Commands ```bash mode stabilize # Manual mode -mode guided_nogps # Autonomous (no GPS) +mode alt_hold # Altitude hold arm throttle force # Arm motors takeoff 5 # Takeoff 5m mode land # Land @@ -83,17 +67,26 @@ mode land # Land ## Troubleshooting +### "No JSON sensor message" + +Gazebo isn't sending data to SITL. Check: +1. Start Gazebo FIRST, then SITL +2. Plugin path is set: +```bash +echo $GZ_SIM_SYSTEM_PLUGIN_PATH | grep ardupilot +``` + ### Simulation laggy + +Check GPU is being used (not software): ```bash glxinfo | grep "OpenGL renderer" -# Should show GPU, not "llvmpipe" +# Should NOT show "llvmpipe" ``` ### Can't arm + ```bash param set ARMING_CHECK 0 arm throttle force ``` - -### No camera -Use `./scripts/run_ardupilot_sim.sh camera` for camera world. diff --git a/scripts/run_ardupilot_sim.sh b/scripts/run_ardupilot_sim.sh index 9b9a315..b0dbb5d 100755 --- a/scripts/run_ardupilot_sim.sh +++ b/scripts/run_ardupilot_sim.sh @@ -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