2.7 KiB
2.7 KiB
PyBullet Simulation
Running the GPS-denied drone simulation with PyBullet.
Windows (Standalone Mode)
No ROS 2 required! Run the all-in-one simulation:
. .\activate.ps1
python standalone_simulation.py
Options
# 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:
source activate.sh
python simulation_host.py
Terminal 2 - ROS Bridge:
source activate.sh
python ros_bridge.py
Terminal 3 - Controllers:
source activate.sh
python controllers.py --pattern circular --speed 0.3
Remote Setup
Run simulator on one machine, controllers on another.
Machine 1 (with display):
python simulation_host.py
Machine 2 (headless):
source activate.sh
python ros_bridge.py --host <MACHINE_1_IP>
python controllers.py
Simulation Parameters
| Parameter | Value |
|---|---|
| Physics Rate | 240 Hz |
| Telemetry Rate | 24 Hz |
| Drone Mass | 1.0 kg |
| Gravity | -9.81 m/s² |
GPS-Denied Sensors
| Sensor | Description |
|---|---|
| IMU | Orientation, angular velocity |
| Altimeter | Barometric altitude, vertical velocity |
| Velocity | Optical flow estimate |
| 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:
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
Drone flies erratically
Reduce control gains in drone_controller.py:
Kp = 0.3
Kd = 0.2
Camera image not appearing
Ensure PIL/Pillow is installed:
pip install pillow