Files
RDC_Simulation/docs/architecture.md

90 lines
2.7 KiB
Markdown

# Architecture Overview
## Operation Modes
### 1. Standalone (Any Platform, 1 Terminal)
```bash
python standalone_simulation.py --pattern circular
```
```
┌────────────────────────────────────────┐
│ standalone_simulation.py │
│ PyBullet Physics + Camera + Controllers│
└────────────────────────────────────────┘
```
### 2. Gazebo + ROS 2 (2 Terminals)
**Terminal 1:**
```bash
ros2 launch gazebo/launch/drone_landing.launch.py
```
**Terminal 2:**
```bash
python run_gazebo.py --pattern circular
```
```
Terminal 1 Terminal 2
┌───────────────────┐ ┌───────────────────┐
│ Gazebo + Bridge │◄──────►│ run_gazebo.py │
│ (Physics) │ ROS │ + Controllers │
└───────────────────┘ └───────────────────┘
```
### 3. ArduPilot SITL + Gazebo (2 Terminals)
**Terminal 1:**
```bash
gz sim -v4 -r ~/ardupilot_gazebo/worlds/iris_runway.sdf
```
**Terminal 2:**
```bash
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
```
```
Terminal 1 Terminal 2
┌───────────────────┐ ┌───────────────────┐
│ Gazebo + │◄──────►│ ArduPilot SITL │
│ ArduPilot Plugin │ JSON │ + MAVProxy │
└───────────────────┘ UDP └───────────────────┘
```
**Key features:**
- Full ArduPilot flight controller
- EKF, stabilization, failsafes
- MAVLink protocol
- Compatible with QGroundControl, Mission Planner
## Key Components
| Component | Description |
|-----------|-------------|
| `standalone_simulation.py` | All-in-one PyBullet simulation |
| `run_gazebo.py` | Gazebo bridge + controllers |
| `drone_controller.py` | Your landing algorithm |
| `camera_viewer.py` | Camera display window |
## ROS 2 Topics (Gazebo Mode)
| Topic | Direction | Description |
|-------|-----------|-------------|
| `/drone/telemetry` | ← | Sensor data (JSON) |
| `/cmd_vel` | → | Velocity commands |
| `/drone/camera` | ← | Camera images |
## Sensors
| Sensor | Data |
|--------|------|
| IMU | orientation, angular_velocity |
| Altimeter | altitude, vertical_velocity |
| Velocity | x, y, z (m/s) |
| Camera | 320x240 image |
| Landing Pad | relative_x, relative_y (when visible) |