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

@@ -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:**

View File

@@ -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
param set ARMING_CHECK 0 # Disable pre-arm checks
mode stabilize # Manual with stabilization
mode alt_hold # Altitude hold
mode guided_nogps # Guided without GPS
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.

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