Ardupilot Controller Script
This commit is contained in:
@@ -24,14 +24,20 @@ Terminal 1 Terminal 2
|
||||
└───────────────────┘ ROS └───────────────────┘
|
||||
```
|
||||
|
||||
### 3. ArduPilot GPS-Denied (2 Terminals)
|
||||
### 3. ArduPilot (2 Terminals)
|
||||
|
||||
```
|
||||
Terminal 1 Terminal 2
|
||||
┌───────────────────┐ ┌───────────────────┐
|
||||
│ Gazebo + │◄──────►│ ArduPilot SITL │
|
||||
│ ArduPilot Plugin │ JSON │ + MAVProxy │
|
||||
└───────────────────┘ └───────────────────┘
|
||||
┌───────────────────┐ ┌────────────────────────────┐
|
||||
│ Gazebo + │◄──────►│ run_ardupilot_controller.sh│
|
||||
│ ArduPilot Plugin │ JSON │ ┌──────────────────┐ │
|
||||
└───────────────────┘ │ │ ArduPilot SITL │ │
|
||||
│ └─────────┬────────┘ │
|
||||
│ │ MAVLink │
|
||||
│ ┌─────────▼────────┐ │
|
||||
│ │ run_ardupilot.py │ │
|
||||
│ └──────────────────┘ │
|
||||
└────────────────────────────┘
|
||||
```
|
||||
|
||||
## Data Flow
|
||||
@@ -48,31 +54,45 @@ Controller → /cmd_vel → Gazebo → /odometry → Controller
|
||||
|
||||
### ArduPilot
|
||||
```
|
||||
Gazebo ◄─── JSON/UDP ───► SITL ◄─── MAVLink ───► MAVProxy
|
||||
Gazebo ◄─── JSON ───► SITL ◄─── MAVLink ───► Controller
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `drone_controller.py` | Your landing algorithm |
|
||||
| `gazebo_bridge.py` | Gazebo ↔ ROS bridge |
|
||||
| `camera_viewer.py` | Camera display |
|
||||
| `config.py` | Configuration |
|
||||
| `drone_controller.py` | **Your landing algorithm (used in ALL modes)** |
|
||||
| `run_ardupilot.py` | MAVLink interface for ArduPilot |
|
||||
| `run_gazebo.py` | ROS 2 interface for Gazebo |
|
||||
| `standalone_simulation.py` | PyBullet simulation engine |
|
||||
| `config.py` | Shared configuration |
|
||||
|
||||
## GPS-Denied Sensors
|
||||
|
||||
| Sensor | Data |
|
||||
|--------|------|
|
||||
| IMU | Orientation, angular velocity |
|
||||
| Altimeter | Altitude, vertical velocity |
|
||||
| Camera | Downward image |
|
||||
| Landing Pad | Relative position |
|
||||
The controller receives this standardized telemetry structure in all modes:
|
||||
|
||||
## Topics
|
||||
|
||||
| Topic | Direction |
|
||||
|-------|-----------|
|
||||
| `/cmd_vel` | → Drone commands |
|
||||
| `/drone/telemetry` | ← Sensor data |
|
||||
| `/drone/camera` | ← Camera images |
|
||||
```python
|
||||
telemetry = {
|
||||
"altimeter": {
|
||||
"altitude": float, # Meters
|
||||
"vertical_velocity": float # m/s (positive = up)
|
||||
},
|
||||
"velocity": { # Body or Local frame
|
||||
"x": float,
|
||||
"y": float,
|
||||
"z": float
|
||||
},
|
||||
"imu": {
|
||||
"orientation": {
|
||||
"roll": float,
|
||||
"pitch": float,
|
||||
"yaw": float
|
||||
}
|
||||
},
|
||||
"landing_pad": { # If visible (None otherwise)
|
||||
"relative_x": float,
|
||||
"relative_y": float,
|
||||
"distance": float
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user