Update to Bridges

This commit is contained in:
2026-01-01 01:08:30 +00:00
parent 2b01f636fe
commit 4b44c3de91
9 changed files with 578 additions and 324 deletions

View File

@@ -4,113 +4,107 @@ GPS-denied drone landing simulation with multiple operation modes.
## Operation Modes
### Standalone Mode (Windows/Simple)
### 1. Standalone Mode (Any Platform)
All-in-one simulation - no ROS 2 or external dependencies:
Single-process simulation - no ROS 2 or networking required:
```
┌────────────────────────────────────────┐
│ standalone_simulation.py │
│ ┌──────────────────────────────────┐ │
│ │ PyBullet Physics Engine │ │
│ │ ┌────────┐ ┌────────────────┐ │ │
│ │ │ Drone │ │ Landing Pad │ │
│ │ └────────┘ └────────────────┘ │ │
│ ├──────────────────────────────────┤ │
│ │ Built-in Controller │ │
│ │ • Landing algorithm │ │
│ │ • Rover movement patterns │ │
│ │ PyBullet Physics + Camera │ │
│ │ Built-in Landing Controller │ │
│ │ Rover Movement Patterns │ │
│ └──────────────────────────────────┘ │
└────────────────────────────────────────┘
```
### Full Mode (Linux + ROS 2)
Modular architecture for development and testing:
### 2. PyBullet + ROS 2 Mode (2 Terminals)
```
┌─────────────────────────────────────────────────────────────────────────┐
│ Simulation System │
├─────────────────────────────────────────────────────────────────────────┤
┌──────────────────┐ ┌──────────────────────────┐
│ simulation_host │◄── UDP:5555 ──────►│ ros_bridge.py │
(PyBullet) (UDP ↔ ROS Bridge)
└──────────────────┘ └────────────┬─────────────┘
│ OR │ │
│ ┌──────────────────┐ ┌────────────┴─────────────┐ │
│ │ Gazebo │◄── ROS Topics ────►│ gazebo_bridge.py │ │
│ │ (Linux only) │ │ (Gazebo ROS Bridge) │ │
│ └──────────────────┘ └────────────┬─────────────┘ │
│ │ │
┌────────────▼─────────────┐ │
│ │ controllers.py │ │
│ ┌─────────────────────┐ │
DroneController │ │
│ │ RoverController
│ └─────────────────────┘
└──────────────────────────┘
└─────────────────────────────────────────────────────────────────────────┘
Terminal 1 Terminal 2
┌──────────────────┐ ┌──────────────────────────┐
│ simulation_host │◄─UDP───►│ run_bridge.py │
(PyBullet) ┌────────────────────┐
Port 5555 │ ROS2SimulatorBridge│
│ │ │ DroneController │
│ RoverController │ │
└──────────────────┘ └────────────────────
└──────────────────────────┘
```
### 3. Gazebo + ROS 2 Mode (2 Terminals, Linux Only)
```
Terminal 1 Terminal 2
┌──────────────────┐ ┌──────────────────────────┐
Gazebo │◄─ROS───►│ run_gazebo.py
(gz sim ...) │ ┌────────────────────┐
│ │ │ GazeboBridge │ │
│ DroneController │ │
│ RoverController │
└──────────────────┘ │ └────────────────────┘
└──────────────────────────┘
```
## Components
### Standalone
| File | Description |
|------|-------------|
| `standalone_simulation.py` | All-in-one simulation |
| `simulation_host.py` | PyBullet physics server (UDP) |
| `run_bridge.py` | PyBullet bridge + controllers |
| `run_gazebo.py` | Gazebo bridge + controllers |
| `drone_controller.py` | Landing algorithm |
| `rover_controller.py` | Moving landing pad |
| Component | Description |
|-----------|-------------|
| **standalone_simulation.py** | Complete simulation with built-in controller |
## ROS Topics
### Full Mode
| Topic | Type | Description |
|-------|------|-------------|
| `/cmd_vel` | `Twist` | Drone velocity commands |
| `/drone/telemetry` | `String` | GPS-denied sensor data |
| `/rover/telemetry` | `String` | Rover position (internal) |
| Component | Description |
|-----------|-------------|
| **PyBullet** (`simulation_host.py`) | Physics engine, UDP networking, camera |
| **Gazebo** | Full robotics simulator (Linux only) |
| **ros_bridge.py** | Connects PyBullet ↔ ROS 2 via UDP |
| **gazebo_bridge.py** | Connects Gazebo ↔ ROS 2 |
| **controllers.py** | Runs drone + rover controllers |
| **drone_controller.py** | GPS-denied landing logic |
| **rover_controller.py** | Moving landing pad patterns |
## Network Configuration
## ROS Topics (Full Mode)
All components default to `0.0.0.0` for network accessibility.
| Topic | Type | Publisher | Subscriber |
|-------|------|-----------|------------|
| `/cmd_vel` | `Twist` | DroneController | Bridge |
| `/drone/telemetry` | `String` | Bridge | DroneController |
| `/rover/telemetry` | `String` | RoverController | DroneController |
### Remote Setup
## GPS-Denied Sensor Flow
```
Simulator Bridge DroneController
│ │ │
│ Render Camera │ │
│ Compute Physics │ │
│──────────────────────►│ │
│ │ GPS-Denied Sensors: │
│ │ - IMU │
│ │ - Altimeter │
│ │ - Velocity │
│ │ - Camera Image │
│ │ - Landing Pad Detection │
│ │─────────────────────────►│
│ │ /cmd_vel │
│◄──────────────────────│◄─────────────────────────│
**Machine 1 (with display):**
```bash
python simulation_host.py # Listens on 0.0.0.0:5555
```
## Platform Support
**Machine 2 (headless controller):**
```bash
python run_bridge.py --host 192.168.1.100
```
| Mode | Windows | Linux | macOS |
|------|---------|-------|-------|
| Standalone | ✅ | ✅ | ✅ |
| Full (ROS 2) | ⚠️ | ✅ | ⚠️ |
| Gazebo | ❌ | ✅ | ❌ |
## UDP Protocol (Full Mode)
### UDP Ports
| Port | Direction | Content |
|------|-----------|---------|
| 5555 | Bridge → Simulator | Command JSON |
| 5556 | Simulator → Bridge | Telemetry JSON |
| 5555 | Bridge → Simulator | Commands |
| 5556 | Simulator → Bridge | Telemetry |
## GPS-Denied Sensors
All modes provide the same sensor data:
| Sensor | Data |
|--------|------|
| IMU | Orientation, angular velocity |
| Altimeter | Altitude, vertical velocity |
| Velocity | Estimated from optical flow |
| Camera | 320x240 downward JPEG |
| Landing Pad | Relative position (when visible) |
## Platform Support
| Mode | Ubuntu | Arch | macOS | Windows | WSL2 |
|------|--------|------|-------|---------|------|
| Standalone | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyBullet+ROS | ✅ | ⚠️ | ❌ | ❌ | ✅ |
| Gazebo+ROS | ✅ | ⚠️ | ❌ | ❌ | ✅ |