# PyBullet Simulation Running the GPS-denied drone simulation with PyBullet. ## Standalone Mode (Recommended) No ROS 2 required! Single terminal: ```bash source activate.sh python standalone_simulation.py --pattern circular --speed 0.3 ``` ### Options ```bash python standalone_simulation.py --help 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) ``` --- ## ROS 2 Mode (2 Terminals) For distributed or remote simulation: **Terminal 1 - Simulator:** ```bash source activate.sh python simulation_host.py ``` **Terminal 2 - Controllers:** ```bash source activate.sh python run_bridge.py --pattern circular --speed 0.3 ``` ### Remote Setup Run simulator on one machine, controllers on another: **Machine 1 (with display):** ```bash python simulation_host.py # Listens on 0.0.0.0:5555 ``` **Machine 2 (headless):** ```bash 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 | |-----------|-------| | Physics Rate | 240 Hz | | Telemetry Rate | 24 Hz | | Drone Mass | 1.0 kg | | UDP Port | 5555 (commands), 5556 (telemetry) | ## 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 | ## Troubleshooting ### "Cannot connect to X server" 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 Reduce control gains in `drone_controller.py`: ```python Kp = 0.3 Kd = 0.2 ``` ### Camera image not appearing Install Pillow: ```bash pip install pillow ```