Scripts and simulation packaging update
This commit is contained in:
@@ -1,8 +1,32 @@
|
||||
# Architecture Overview
|
||||
|
||||
GPS-denied drone landing simulation with camera vision.
|
||||
GPS-denied drone landing simulation with multiple operation modes.
|
||||
|
||||
## System Diagram
|
||||
## Operation Modes
|
||||
|
||||
### Standalone Mode (Windows/Simple)
|
||||
|
||||
All-in-one simulation - no ROS 2 or external dependencies:
|
||||
|
||||
```
|
||||
┌────────────────────────────────────────┐
|
||||
│ standalone_simulation.py │
|
||||
│ ┌──────────────────────────────────┐ │
|
||||
│ │ PyBullet Physics Engine │ │
|
||||
│ │ ┌────────┐ ┌────────────────┐ │ │
|
||||
│ │ │ Drone │ │ Landing Pad │ │ │
|
||||
│ │ └────────┘ └────────────────┘ │ │
|
||||
│ ├──────────────────────────────────┤ │
|
||||
│ │ Built-in Controller │ │
|
||||
│ │ • Landing algorithm │ │
|
||||
│ │ • Rover movement patterns │ │
|
||||
│ └──────────────────────────────────┘ │
|
||||
└────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Full Mode (Linux + ROS 2)
|
||||
|
||||
Modular architecture for development and testing:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -16,7 +40,7 @@ GPS-denied drone landing simulation with camera vision.
|
||||
│ OR │ │
|
||||
│ ┌──────────────────┐ ┌────────────┴─────────────┐ │
|
||||
│ │ Gazebo │◄── ROS Topics ────►│ gazebo_bridge.py │ │
|
||||
│ │ (Ignition) │ │ (Gazebo ↔ ROS Bridge) │ │
|
||||
│ │ (Linux only) │ │ (Gazebo ↔ ROS Bridge) │ │
|
||||
│ └──────────────────┘ └────────────┬─────────────┘ │
|
||||
│ │ │
|
||||
│ ┌────────────▼─────────────┐ │
|
||||
@@ -31,37 +55,31 @@ GPS-denied drone landing simulation with camera vision.
|
||||
|
||||
## Components
|
||||
|
||||
### Simulators
|
||||
### Standalone
|
||||
|
||||
| Component | Description |
|
||||
|-----------|-------------|
|
||||
| **PyBullet** (`simulation_host.py`) | Standalone physics, UDP networking, camera rendering |
|
||||
| **Gazebo** | Full robotics simulator, native ROS 2 integration, camera sensor |
|
||||
| **standalone_simulation.py** | Complete simulation with built-in controller |
|
||||
|
||||
### Bridges
|
||||
### Full Mode
|
||||
|
||||
| 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, provides same interface |
|
||||
|
||||
### Controllers
|
||||
|
||||
| Component | Description |
|
||||
|-----------|-------------|
|
||||
| **controllers.py** | Runs drone + rover controllers together |
|
||||
| **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 |
|
||||
|
||||
## ROS Topics
|
||||
## ROS Topics (Full Mode)
|
||||
|
||||
| Topic | Type | Publisher | Subscriber |
|
||||
|-------|------|-----------|------------|
|
||||
| `/cmd_vel` | `Twist` | DroneController | Bridge |
|
||||
| `/drone/telemetry` | `String` | Bridge | DroneController |
|
||||
| `/rover/telemetry` | `String` | RoverController | DroneController |
|
||||
| `/rover/cmd_vel` | `Twist` | RoverController | (internal) |
|
||||
| `/rover/position` | `Point` | RoverController | (debug) |
|
||||
|
||||
## GPS-Denied Sensor Flow
|
||||
|
||||
@@ -71,49 +89,28 @@ Simulator Bridge DroneController
|
||||
│ Render Camera │ │
|
||||
│ Compute Physics │ │
|
||||
│──────────────────────►│ │
|
||||
│ │ │
|
||||
│ │ GPS-Denied Sensors: │
|
||||
│ │ - IMU │
|
||||
│ │ - Altimeter │
|
||||
│ │ - Velocity │
|
||||
│ │ - Camera Image (JPEG) │
|
||||
│ │ - Camera Image │
|
||||
│ │ - Landing Pad Detection │
|
||||
│ │─────────────────────────►│
|
||||
│ │ │
|
||||
│ │ /cmd_vel │
|
||||
│◄──────────────────────│◄─────────────────────────│
|
||||
```
|
||||
|
||||
## Camera System
|
||||
## Platform Support
|
||||
|
||||
Both simulators provide a downward-facing camera:
|
||||
| Mode | Windows | Linux | macOS |
|
||||
|------|---------|-------|-------|
|
||||
| Standalone | ✅ | ✅ | ✅ |
|
||||
| Full (ROS 2) | ⚠️ | ✅ | ⚠️ |
|
||||
| Gazebo | ❌ | ✅ | ❌ |
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| Resolution | 320 x 240 |
|
||||
| FOV | 60 degrees |
|
||||
| Format | Base64 JPEG |
|
||||
| Update Rate | ~5 Hz |
|
||||
| Direction | Downward |
|
||||
|
||||
## Data Flow
|
||||
|
||||
### PyBullet Mode
|
||||
```
|
||||
DroneController → /cmd_vel → ros_bridge → UDP:5555 → simulation_host
|
||||
simulation_host → UDP:5556 → ros_bridge → /drone/telemetry → DroneController
|
||||
```
|
||||
|
||||
### Gazebo Mode
|
||||
```
|
||||
DroneController → /cmd_vel → gazebo_bridge → /drone/cmd_vel → Gazebo
|
||||
Gazebo → /model/drone/odometry → gazebo_bridge → /drone/telemetry → DroneController
|
||||
Gazebo → /drone/camera → gazebo_bridge → (encoded in telemetry)
|
||||
```
|
||||
|
||||
## UDP Protocol
|
||||
## UDP Protocol (Full Mode)
|
||||
|
||||
| Port | Direction | Content |
|
||||
|------|-----------|---------|
|
||||
| 5555 | Bridge → Simulator | Command JSON |
|
||||
| 5556 | Simulator → Bridge | Telemetry JSON (includes camera image) |
|
||||
| 5556 | Simulator → Bridge | Telemetry JSON |
|
||||
|
||||
@@ -228,10 +228,18 @@ chmod +x activate.sh
|
||||
|
||||
### Windows
|
||||
|
||||
- PyBullet works in GUI mode
|
||||
- Gazebo not officially supported
|
||||
- ROS 2 requires Windows-specific binaries
|
||||
- Consider WSL2 for full Linux experience
|
||||
- **PyBullet works fully** - GUI mode with camera
|
||||
- **Gazebo NOT supported** - Linux only
|
||||
- **ROS 2 optional** - Only needed for ros_bridge.py
|
||||
- Use `python simulation_host.py` directly
|
||||
|
||||
**On Windows, the recommended workflow is:**
|
||||
```powershell
|
||||
. .\activate.ps1
|
||||
python simulation_host.py
|
||||
```
|
||||
|
||||
The PyBullet simulation runs standalone with full GUI - no ROS 2 or Gazebo needed.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,37 @@
|
||||
|
||||
Running the GPS-denied drone simulation with PyBullet.
|
||||
|
||||
## Quick Start
|
||||
## Windows (Standalone Mode)
|
||||
|
||||
No ROS 2 required! Run the all-in-one simulation:
|
||||
|
||||
```powershell
|
||||
. .\activate.ps1
|
||||
python standalone_simulation.py
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```powershell
|
||||
# Stationary landing pad
|
||||
python standalone_simulation.py
|
||||
|
||||
# Moving rover patterns
|
||||
python standalone_simulation.py --pattern circular --speed 0.3
|
||||
python standalone_simulation.py --pattern linear --speed 0.5
|
||||
python standalone_simulation.py --pattern square --speed 0.4
|
||||
|
||||
Options:
|
||||
--pattern, -p stationary, linear, circular, square
|
||||
--speed, -s Rover speed in m/s (default: 0.5)
|
||||
--amplitude, -a Movement amplitude in meters (default: 2.0)
|
||||
```
|
||||
|
||||
The simulation includes a built-in landing controller. Watch the drone automatically land on the rover!
|
||||
|
||||
---
|
||||
|
||||
## Linux (Full ROS 2 Mode)
|
||||
|
||||
**Terminal 1 - Simulator:**
|
||||
```bash
|
||||
@@ -22,7 +52,7 @@ source activate.sh
|
||||
python controllers.py --pattern circular --speed 0.3
|
||||
```
|
||||
|
||||
## Remote Setup
|
||||
### Remote Setup
|
||||
|
||||
Run simulator on one machine, controllers on another.
|
||||
|
||||
@@ -38,6 +68,8 @@ python ros_bridge.py --host <MACHINE_1_IP>
|
||||
python controllers.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Simulation Parameters
|
||||
|
||||
| Parameter | Value |
|
||||
@@ -49,30 +81,23 @@ python controllers.py
|
||||
|
||||
## GPS-Denied Sensors
|
||||
|
||||
The simulator provides:
|
||||
|
||||
| Sensor | Description |
|
||||
|--------|-------------|
|
||||
| IMU | Orientation (roll, pitch, yaw), angular velocity |
|
||||
| IMU | Orientation, angular velocity |
|
||||
| Altimeter | Barometric altitude, vertical velocity |
|
||||
| Velocity | Optical flow estimate (x, y, z) |
|
||||
| Velocity | Optical flow estimate |
|
||||
| Camera | 320x240 downward JPEG image |
|
||||
| Landing Pad | Vision-based relative position (60° FOV, 10m range) |
|
||||
| Landing Pad | Vision-based relative position |
|
||||
|
||||
## Camera System
|
||||
|
||||
PyBullet renders a camera image from the drone's perspective:
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| Resolution | 320 x 240 |
|
||||
| FOV | 60 degrees |
|
||||
| Format | Base64 encoded JPEG |
|
||||
| Update Rate | ~5 Hz |
|
||||
| Direction | Downward-facing |
|
||||
|
||||
The image is included in telemetry as `camera.image`.
|
||||
|
||||
## World Setup
|
||||
|
||||
| Object | Position | Description |
|
||||
@@ -81,23 +106,6 @@ The image is included in telemetry as `camera.image`.
|
||||
| Rover | (0, 0, 0.15) | 1m × 1m landing pad |
|
||||
| Drone | (0, 0, 5) | Starting position |
|
||||
|
||||
## UDP Communication
|
||||
|
||||
| Port | Direction | Data |
|
||||
|------|-----------|------|
|
||||
| 5555 | Bridge → Sim | Commands (JSON) |
|
||||
| 5556 | Sim → Bridge | Telemetry (JSON with camera) |
|
||||
|
||||
## ROS Bridge Options
|
||||
|
||||
```bash
|
||||
python ros_bridge.py --help
|
||||
|
||||
Options:
|
||||
--host, -H Simulator IP (default: 127.0.0.1)
|
||||
--port, -p Simulator port (default: 5555)
|
||||
```
|
||||
|
||||
## Building Executable
|
||||
|
||||
Create standalone executable:
|
||||
@@ -107,8 +115,6 @@ source activate.sh
|
||||
python build_exe.py
|
||||
```
|
||||
|
||||
Output: `dist/simulation_host` (or `.exe` on Windows)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Cannot connect to X server"
|
||||
@@ -120,18 +126,12 @@ PyBullet requires a display:
|
||||
|
||||
### Drone flies erratically
|
||||
|
||||
Reduce control gains:
|
||||
Reduce control gains in `drone_controller.py`:
|
||||
```python
|
||||
Kp = 0.3
|
||||
Kd = 0.2
|
||||
```
|
||||
|
||||
### No telemetry received
|
||||
|
||||
1. Check simulator is running
|
||||
2. Verify firewall allows UDP 5555-5556
|
||||
3. Check IP address in ros_bridge.py
|
||||
|
||||
### Camera image not appearing
|
||||
|
||||
Ensure PIL/Pillow is installed:
|
||||
|
||||
Reference in New Issue
Block a user