Scripts and simulation packaging update

This commit is contained in:
2026-01-01 00:50:28 +00:00
parent b740994185
commit 7a1c4ba227
10 changed files with 750 additions and 570 deletions

View File

@@ -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: