121 lines
3.0 KiB
Markdown
121 lines
3.0 KiB
Markdown
# RDC Simulation
|
|
|
|
GPS-denied drone landing simulation using ArduPilot and Gazebo.
|
|
|
|
## Quick Start
|
|
|
|
### Prerequisites
|
|
- Ubuntu 22.04/24.04 (or WSL2 on Windows)
|
|
- Python 3.10+
|
|
- ~10GB disk space
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Clone the repository
|
|
git clone <repo-url> RDC_Simulation
|
|
cd RDC_Simulation
|
|
|
|
# Install everything (20-30 minutes)
|
|
./setup/install_ubuntu.sh --with-ardupilot
|
|
|
|
# Reload environment
|
|
source ~/.bashrc
|
|
```
|
|
|
|
### Run the Simulation
|
|
|
|
You need **3 terminals**:
|
|
|
|
**Terminal 1 - Gazebo:**
|
|
```bash
|
|
cd ~/RDC_Simulation
|
|
./scripts/run_ardupilot_sim.sh runway
|
|
# Wait until the drone appears in Gazebo
|
|
```
|
|
|
|
**Terminal 2 - SITL:**
|
|
```bash
|
|
source ~/venv-ardupilot/bin/activate
|
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
|
# Wait for "Waiting for connection" then telemetry
|
|
```
|
|
|
|
**Terminal 3 - Controller:**
|
|
```bash
|
|
source ~/venv-ardupilot/bin/activate
|
|
cd ~/RDC_Simulation
|
|
python scripts/run_ardupilot.py --pattern square
|
|
```
|
|
|
|
### Flight Patterns
|
|
|
|
```bash
|
|
# Fly a square pattern (default)
|
|
python scripts/run_ardupilot.py --pattern square --size 5
|
|
|
|
# Fly a circle
|
|
python scripts/run_ardupilot.py --pattern circle --size 5
|
|
|
|
# Just hover in place
|
|
python scripts/run_ardupilot.py --pattern hover
|
|
|
|
# Custom altitude
|
|
python scripts/run_ardupilot.py --pattern square --altitude 10
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
RDC_Simulation/
|
|
├── scripts/
|
|
│ ├── run_ardupilot_sim.sh # Launch Gazebo
|
|
│ ├── run_ardupilot_controller.sh # Launch SITL + Controller
|
|
│ └── run_ardupilot.py # Flight controller
|
|
├── src/
|
|
│ ├── drone_controller.py # Simple drone controller
|
|
│ ├── rover_controller.py # Moving landing pad (ROS 2)
|
|
│ └── camera_viewer.py # Camera viewer (ROS 2)
|
|
├── setup/
|
|
│ ├── install_ubuntu.sh # Ubuntu installer
|
|
│ ├── install_ardupilot.sh # ArduPilot installer
|
|
│ └── install_arch.sh # Arch Linux installer
|
|
├── gazebo/
|
|
│ └── models/ # Custom Gazebo models
|
|
├── docs/ # Documentation
|
|
└── config.py # Configuration
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### "No JSON sensor message received"
|
|
Gazebo isn't sending data to SITL.
|
|
- **Fix**: Start Gazebo FIRST, wait for it to fully load, THEN start SITL.
|
|
|
|
### "empy not found"
|
|
Wrong Python environment.
|
|
- **Fix**: `source ~/venv-ardupilot/bin/activate`
|
|
|
|
### "sim_vehicle.py not found"
|
|
ArduPilot tools not in PATH.
|
|
- **Fix**: `source ~/.ardupilot_env`
|
|
|
|
### Can't arm
|
|
The drone won't arm or takeoff.
|
|
- **Fix**: Make sure you're in GUIDED mode and Gazebo is running.
|
|
- Check console for pre-arm errors.
|
|
|
|
### Gazebo is slow
|
|
- Try a lighter world: `./scripts/run_ardupilot_sim.sh runway`
|
|
- Check GPU: `glxinfo | grep "OpenGL renderer"`
|
|
|
|
## Documentation
|
|
|
|
- [Installation Guide](docs/installation.md)
|
|
- [ArduPilot Guide](docs/ardupilot.md)
|
|
- [Architecture](docs/architecture.md)
|
|
- [Gazebo Worlds](docs/gazebo_worlds.md)
|
|
|
|
## License
|
|
|
|
MIT License |