68 lines
2.5 KiB
Markdown
68 lines
2.5 KiB
Markdown
# Architecture
|
|
|
|
## System Overview
|
|
|
|
```
|
|
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
│ Gazebo │◄───►│ ArduPilot SITL │◄───►│ Controller │
|
|
│ (Physics) │JSON │ (Flight Ctrl) │MAV │ (Your Logic) │
|
|
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
│ │
|
|
▼ ▼
|
|
~/ardupilot_gazebo src/drone_controller.py
|
|
```
|
|
|
|
## Terminal Layout
|
|
|
|
**Terminal 1:**
|
|
```
|
|
./scripts/run_ardupilot_sim.sh
|
|
│
|
|
▼
|
|
Gazebo + ArduPilot Plugin
|
|
```
|
|
|
|
**Terminal 2:**
|
|
```
|
|
./scripts/run_ardupilot_controller.sh
|
|
│
|
|
├── ArduPilot SITL (background)
|
|
│
|
|
└── run_ardupilot.py
|
|
│
|
|
└── src/drone_controller.py
|
|
```
|
|
|
|
## Data Flow
|
|
|
|
```
|
|
Gazebo ◄─── JSON/UDP ───► SITL ◄─── MAVLink ───► Controller
|
|
│ │ │
|
|
│ Physics │ Flight control │ Your logic
|
|
│ Sensors │ EKF │ 3-phase mission
|
|
│ Rendering │ Stabilization │ QR detection
|
|
▼ ▼ ▼
|
|
Display Attitude/Position Commands
|
|
```
|
|
|
|
## Key Files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `src/drone_controller.py` | 3-phase mission logic |
|
|
| `scripts/run_ardupilot.py` | MAVLink interface |
|
|
| `src/mavlink_bridge.py` | MAVLink utilities |
|
|
| `src/gazebo_bridge.py` | Gazebo ROS bridge |
|
|
| `config.py` | Configuration |
|
|
|
|
## 3-Phase Mission
|
|
|
|
```
|
|
┌────────┐ QR Found ┌─────────┐ Timeout ┌──────┐
|
|
│ SEARCH │───────────────►│ COMMAND │──────────────►│ LAND │
|
|
└────────┘ └─────────┘ └──────┘
|
|
│ │ │
|
|
▼ ▼ ▼
|
|
Detect QR Send to rover Track & descend
|
|
```
|