ArduPilot SITL Update

This commit is contained in:
2026-01-04 00:24:46 +00:00
parent 6c72bbf24c
commit 6804180e21
20 changed files with 2138 additions and 2970 deletions

159
README.md
View File

@@ -1,154 +1,107 @@
# Drone Landing Simulation (GPS-Denied)
A GPS-denied drone landing simulation using relative sensors (IMU, altimeter, camera, landing pad detection) with multiple backends:
- **PyBullet** - Lightweight physics simulation
- **Gazebo** - Full robotics simulator
- **ArduPilot SITL** - Realistic flight controller with MAVProxy
A GPS-denied drone landing simulation with multiple backends. Land a drone on a moving platform using only relative sensors (IMU, altimeter, camera).
## Quick Start
### Standalone Mode (Any Platform - No ROS 2 Required)
### Standalone Mode (No ROS 2 - Any Platform)
```bash
source activate.sh # Linux/macOS
. .\activate.ps1 # Windows
source activate.sh
python standalone_simulation.py --pattern circular --speed 0.3
```
### PyBullet + ROS 2 (Two Terminals)
### Gazebo + ROS 2 (Linux/WSL2)
**Terminal 1 - Simulator:**
```bash
python simulation_host.py
```
**Terminal 2 - Bridge + Controllers:**
```bash
python run_bridge.py --pattern circular --speed 0.3
```
### Gazebo + ROS 2 (Two Terminals - Linux/WSL2)
**Terminal 1 - Launch Gazebo + Bridge:**
**Terminal 1:**
```bash
ros2 launch gazebo/launch/drone_landing.launch.py
```
**Terminal 2 - Run Controllers:**
**Terminal 2:**
```bash
python run_gazebo.py --pattern circular --speed 0.3
source activate.sh
python run_gazebo.py --pattern circular
python camera_viewer.py # Optional: view camera feed
```
### ArduPilot SITL + Gazebo (Three Terminals - Realistic Flight Controller)
### ArduPilot SITL (Realistic Flight Controller)
**Terminal 1 - Launch Gazebo with ArduPilot world:**
**Terminal 1:**
```bash
ros2 launch gazebo/launch/ardupilot_drone.launch.py
source ~/ardu_ws/install/setup.bash
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
```
**Terminal 2 - Start ArduPilot SITL:**
**Terminal 2:**
```bash
cd ~/ardupilot
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
```
**Terminal 3 - Run MAVLink Bridge + Controllers:**
```bash
python run_ardupilot.py --no-sitl --pattern circular
mavproxy.py --console --map --master=:14550
```
## Installation
| Platform | Command |
|----------|---------|
```bash
# Ubuntu/Debian (includes ROS 2 + Gazebo)
./setup/install_ubuntu.sh
# With ArduPilot SITL
./setup/install_ardupilot.sh
# Activate environment
source activate.sh
```
| Platform | Install Script |
|----------|---------------|
| Ubuntu/Debian | `./setup/install_ubuntu.sh` |
| ArduPilot SITL | `./setup/install_ardupilot.sh` |
| Arch Linux | `./setup/install_arch.sh` |
| macOS | `./setup/install_macos.sh` |
| Windows | `.\setup\install_windows.ps1` |
## Platform Compatibility
| Feature | Ubuntu | Arch | macOS | Windows | WSL2 |
|---------|--------|------|-------|---------|------|
| Standalone | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyBullet + ROS 2 | ✅ | ⚠️ | ❌ | ❌ | ✅ |
| Gazebo + ROS 2 | ✅ | ⚠️ | ❌ | ❌ | ✅ |
| ArduPilot + Gazebo | ✅ | ⚠️ | ❌ | ❌ | ✅ |
## Files
| File | Description |
|------|-------------|
| `standalone_simulation.py` | All-in-one (no ROS 2 required) |
| `simulation_host.py` | PyBullet simulator server |
| `run_bridge.py` | PyBullet bridge + Controllers |
| `run_gazebo.py` | Gazebo bridge + Controllers |
| `run_ardupilot.py` | **ArduPilot SITL** + MAVLink bridge |
| `mavlink_bridge.py` | MAVLink ↔ ROS 2 bridge |
| `config.py` | **Configuration file** (edit to customize) |
| `drone_controller.py` | **Your landing algorithm** (edit this!) |
| `rover_controller.py` | Moving landing pad controller |
| `standalone_simulation.py` | **All-in-one** (no ROS 2) |
| `run_gazebo.py` | Gazebo controllers |
| `run_ardupilot.py` | ArduPilot launcher |
| `camera_viewer.py` | Drone camera window |
| `drone_controller.py` | **Your landing algorithm** |
| `config.py` | Configuration |
## Sensors Available
| Sensor | Data |
|--------|------|
| IMU | Orientation (roll, pitch, yaw), angular velocity |
| Altimeter | Altitude, vertical velocity |
| Velocity | Estimated velocity (x, y, z) |
| Camera | Downward-facing image |
| Landing Pad | Relative position when visible |
## Configuration
Edit `config.py` to customize:
- Drone/rover starting positions
- Physical properties (mass, size)
- Drone/rover positions
- Controller gains (Kp, Kd)
- Landing detection thresholds
- Camera settings
- Landing thresholds
## Command Line Options
```bash
# Standalone (no ROS 2)
python standalone_simulation.py --pattern circular --speed 0.3
# PyBullet + ROS 2
python run_bridge.py --pattern circular --speed 0.3 --host <SIMULATOR_IP>
# Gazebo + ROS 2
python run_gazebo.py --pattern circular --speed 0.3
Options:
--pattern, -p stationary, linear, circular, square, random
--speed, -s Speed in m/s (default: 0.5)
--amplitude, -a Amplitude in meters (default: 2.0)
--host, -H Simulator IP (default: 0.0.0.0)
# Movement patterns
--pattern, -p stationary, linear, circular, square, random
--speed, -s Speed in m/s (default: 0.5)
--amplitude, -a Amplitude in meters (default: 2.0)
```
## GPS-Denied Sensors
| Sensor | Data |
|--------|------|
| **IMU** | Orientation (roll, pitch, yaw), angular velocity |
| **Altimeter** | Altitude, vertical velocity |
| **Velocity** | Estimated horizontal velocity (x, y, z) |
| **Camera** | 320x240 downward-facing JPEG image |
| **Landing Pad** | Relative position when visible in camera FOV |
## Documentation
| Document | Description |
|----------|-------------|
| [Installation](docs/installation.md) | Platform setup guides + WSL2 |
| [Architecture](docs/architecture.md) | System components diagram |
| [Gazebo Guide](docs/gazebo.md) | Gazebo-specific instructions |
| [PyBullet Guide](docs/pybullet.md) | PyBullet-specific instructions |
| [ArduPilot Guide](docs/ardupilot.md) | **ArduPilot SITL + MAVProxy** |
| [Protocol](docs/protocol.md) | Sensor data formats |
| [Drone Guide](docs/drone_guide.md) | Landing algorithm guide |
## Network Setup (Remote Simulator)
Run simulator on one machine, controllers on another:
**Machine 1 (with display):**
```bash
python simulation_host.py # Listens on 0.0.0.0:5555
```
**Machine 2 (headless):**
```bash
python run_bridge.py --host 192.168.1.100 # Connect to Machine 1
```
| [Installation](docs/installation.md) | Full setup guide |
| [Architecture](docs/architecture.md) | System overview |
| [ArduPilot](docs/ardupilot.md) | ArduPilot SITL guide |
| [Gazebo](docs/gazebo.md) | Gazebo guide |