134 lines
3.3 KiB
Markdown
134 lines
3.3 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
|
|
|
|
# Full installation (20-30 minutes)
|
|
./setup/install_ubuntu.sh
|
|
|
|
# Activate environment
|
|
source activate.sh
|
|
```
|
|
|
|
### Run the Simulation (3 Terminals)
|
|
|
|
**Terminal 1 - Start Gazebo FIRST:**
|
|
```bash
|
|
cd ~/RDC_Simulation
|
|
./scripts/run_ardupilot_sim.sh runway
|
|
# WAIT until you see the drone in Gazebo!
|
|
```
|
|
|
|
**Terminal 2 - Start ArduCopter SITL:**
|
|
```bash
|
|
source activate.sh
|
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
|
# Wait for "JSON received:" messages (shows Gazebo is connected)
|
|
```
|
|
|
|
**Terminal 3 - Run Controller:**
|
|
```bash
|
|
cd ~/RDC_Simulation
|
|
source activate.sh
|
|
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
|
|
|
|
# Use GPS mode instead of GPS-denied
|
|
python scripts/run_ardupilot.py --pattern square --gps
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
RDC_Simulation/
|
|
├── scripts/
|
|
│ ├── run_ardupilot_sim.sh # Launch Gazebo
|
|
│ ├── run_ardupilot_controller.sh # Launch SITL + Controller
|
|
│ └── run_ardupilot.py # Flight controller entry point
|
|
├── src/
|
|
│ ├── drone_controller.py # Main drone controller class
|
|
│ ├── rover_controller.py # Moving landing pad (ROS 2)
|
|
│ └── camera_viewer.py # Camera viewer (ROS 2)
|
|
├── setup/
|
|
│ ├── install_ubuntu.sh # Ubuntu/WSL 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" or wrong Python
|
|
Wrong virtual environment.
|
|
```bash
|
|
source activate.sh
|
|
pip install empy==3.3.4
|
|
```
|
|
|
|
### "sim_vehicle.py not found"
|
|
ArduPilot tools not in PATH.
|
|
```bash
|
|
source activate.sh
|
|
```
|
|
|
|
### Drone won't arm
|
|
- Make sure SITL is in STABILIZE or GUIDED mode
|
|
- Check for pre-arm errors in MAVProxy console
|
|
- Try in MAVProxy: `arm throttle force`
|
|
|
|
### Wrong vehicle type (ArduPlane instead of ArduCopter)
|
|
You see modes like FBWA, FBWB, QSTABILIZE.
|
|
```bash
|
|
# Kill old processes
|
|
pkill -9 -f sim_vehicle
|
|
|
|
# Start with explicit ArduCopter
|
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --wipe-eeprom
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- [Installation Guide](docs/installation.md)
|
|
- [Docker Guide](docs/docker.md)
|
|
- [ArduPilot Guide](docs/ardupilot.md)
|
|
- [Drone Controller Guide](docs/drone_guide.md)
|
|
- [Architecture](docs/architecture.md)
|
|
|
|
## License
|
|
|
|
MIT License |