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

@@ -2,25 +2,19 @@
Running the GPS-denied drone simulation with PyBullet.
## Windows (Standalone Mode)
## Standalone Mode (Recommended)
No ROS 2 required! Run the all-in-one simulation:
No ROS 2 required! Single terminal:
```powershell
. .\activate.ps1
python standalone_simulation.py
```bash
source activate.sh
python standalone_simulation.py --pattern circular --speed 0.3
```
### 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
```bash
python standalone_simulation.py --help
Options:
--pattern, -p stationary, linear, circular, square
@@ -28,11 +22,11 @@ Options:
--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)
## ROS 2 Mode (2 Terminals)
For distributed or remote simulation:
**Terminal 1 - Simulator:**
```bash
@@ -40,36 +34,49 @@ source activate.sh
python simulation_host.py
```
**Terminal 2 - ROS Bridge:**
**Terminal 2 - Controllers:**
```bash
source activate.sh
python ros_bridge.py
```
**Terminal 3 - Controllers:**
```bash
source activate.sh
python controllers.py --pattern circular --speed 0.3
python run_bridge.py --pattern circular --speed 0.3
```
### Remote Setup
Run simulator on one machine, controllers on another.
Run simulator on one machine, controllers on another:
**Machine 1 (with display):**
```bash
python simulation_host.py
python simulation_host.py # Listens on 0.0.0.0:5555
```
**Machine 2 (headless):**
```bash
source activate.sh
python ros_bridge.py --host <MACHINE_1_IP>
python controllers.py
python run_bridge.py --host 192.168.1.100 --pattern circular
```
---
## Building Standalone Executable
Create a distributable executable:
```bash
source activate.sh
# Build standalone simulation (recommended)
python build_exe.py
# Build simulation_host
python build_exe.py simulation_host
# Build all
python build_exe.py all
```
Executables are created in `dist/`.
---
## Simulation Parameters
| Parameter | Value |
@@ -77,7 +84,7 @@ python controllers.py
| Physics Rate | 240 Hz |
| Telemetry Rate | 24 Hz |
| Drone Mass | 1.0 kg |
| Gravity | -9.81 m/s² |
| UDP Port | 5555 (commands), 5556 (telemetry) |
## GPS-Denied Sensors
@@ -89,40 +96,18 @@ python controllers.py
| Camera | 320x240 downward JPEG image |
| Landing Pad | Vision-based relative position |
## Camera System
| Property | Value |
|----------|-------|
| Resolution | 320 x 240 |
| FOV | 60 degrees |
| Format | Base64 encoded JPEG |
| Direction | Downward-facing |
## World Setup
| Object | Position | Description |
|--------|----------|-------------|
| Ground | z = 0 | Infinite plane |
| Rover | (0, 0, 0.15) | 1m × 1m landing pad |
| Drone | (0, 0, 5) | Starting position |
## Building Executable
Create standalone executable:
```bash
source activate.sh
python build_exe.py
```
## Troubleshooting
### "Cannot connect to X server"
PyBullet requires a display:
- Run on machine with monitor
- Use X11 forwarding: `ssh -X user@host`
- Virtual display: `xvfb-run python simulation_host.py`
PyBullet GUI requires a display:
```bash
# Use virtual display
xvfb-run python standalone_simulation.py
# Or use X11 forwarding
ssh -X user@host
```
### Drone flies erratically
@@ -134,7 +119,7 @@ Kd = 0.2
### Camera image not appearing
Ensure PIL/Pillow is installed:
Install Pillow:
```bash
pip install pillow
```