Files
RDC_Simulation/docs/pybullet.md
2026-01-04 00:24:46 +00:00

69 lines
1.2 KiB
Markdown

# PyBullet Simulation Guide
## Standalone Mode (1 Terminal)
No ROS 2 required. Works on Windows, macOS, Linux:
```bash
source activate.sh
python standalone_simulation.py --pattern circular
```
## ROS 2 Mode (2 Terminals)
**Terminal 1 - Simulator:**
```bash
python simulation_host.py
```
**Terminal 2 - Controllers:**
```bash
python run_bridge.py --pattern circular
```
## Options
```bash
--pattern, -p stationary, linear, circular, square, random
--speed, -s Rover speed in m/s (default: 0.5)
--amplitude, -a Movement radius (default: 2.0)
```
## Remote Setup
**Machine 1:** `python simulation_host.py`
**Machine 2:** `python run_bridge.py --host <IP>`
## Sensors
| Sensor | Description |
|--------|-------------|
| IMU | Orientation, angular velocity |
| Altimeter | Altitude, vertical velocity |
| Velocity | Estimated velocity (x, y, z) |
| Camera | 320x240 downward JPEG |
| Landing Pad | Relative position |
## Configuration
Edit `config.py`:
```python
CONTROLLER = {
"Kp_z": 0.5,
"Kd_z": 0.3,
"Kp_xy": 0.3,
"Kd_xy": 0.2,
}
```
## Troubleshooting
**"Cannot connect to X server":**
```bash
xvfb-run python standalone_simulation.py
```
**Drone flies erratically:**
Reduce gains in `config.py`