175 lines
3.2 KiB
Markdown
175 lines
3.2 KiB
Markdown
# Installation Guide
|
|
|
|
## System Requirements
|
|
|
|
- **OS**: Ubuntu 22.04 or 24.04 (Windows users: use WSL2)
|
|
- **RAM**: 8GB minimum, 16GB recommended
|
|
- **Disk**: 10GB free space
|
|
- **GPU**: Any GPU with OpenGL 3.3+ support
|
|
|
|
## Quick Install (Ubuntu)
|
|
|
|
```bash
|
|
# Clone repository
|
|
git clone <repo-url> RDC_Simulation
|
|
cd RDC_Simulation
|
|
|
|
# Run installer (includes ArduPilot)
|
|
./setup/install_ubuntu.sh --with-ardupilot
|
|
|
|
# Reload shell
|
|
source ~/.bashrc
|
|
```
|
|
|
|
This installs:
|
|
- Python 3 + virtual environment
|
|
- Gazebo Harmonic
|
|
- ArduPilot SITL
|
|
- ArduPilot Gazebo plugin
|
|
- MAVProxy
|
|
|
|
## Windows (WSL2)
|
|
|
|
### Step 1: Install WSL2
|
|
|
|
Open PowerShell as Administrator:
|
|
```powershell
|
|
wsl --install -d Ubuntu-24.04
|
|
```
|
|
Restart computer, then open Ubuntu from Start menu.
|
|
|
|
### Step 2: Install in WSL
|
|
|
|
```bash
|
|
# Update system
|
|
sudo apt update && sudo apt upgrade -y
|
|
|
|
# Clone and install
|
|
git clone <repo-url> ~/RDC_Simulation
|
|
cd ~/RDC_Simulation
|
|
./setup/install_ubuntu.sh --with-ardupilot
|
|
|
|
# Reload
|
|
source ~/.bashrc
|
|
```
|
|
|
|
### WSL2 Tips
|
|
|
|
- **GUI Apps**: Windows 11 has WSLg built-in. Gazebo should work automatically.
|
|
- **GPU**: Install NVIDIA WSL driver from [nvidia.com/wsl](https://developer.nvidia.com/cuda/wsl)
|
|
- **Access Windows files**: `/mnt/c/Users/YourName/`
|
|
- **Performance**: Clone repo to Linux filesystem (not `/mnt/c/`)
|
|
|
|
## macOS
|
|
|
|
macOS doesn't support Gazebo Harmonic natively. Options:
|
|
|
|
1. **Docker** (recommended): Use Linux container
|
|
2. **VM**: Use UTM or Parallels with Ubuntu
|
|
3. **Standalone**: Run PyBullet-only simulation
|
|
|
|
```bash
|
|
# Install basic dependencies
|
|
./setup/install_macos.sh
|
|
|
|
# Use standalone simulation
|
|
python standalone_simulation.py
|
|
```
|
|
|
|
## Arch Linux
|
|
|
|
```bash
|
|
./setup/install_arch.sh --with-ardupilot
|
|
source ~/.bashrc
|
|
```
|
|
|
|
## Verify Installation
|
|
|
|
```bash
|
|
# Check ArduPilot
|
|
source ~/venv-ardupilot/bin/activate
|
|
python -c "import em; print('empy OK')"
|
|
sim_vehicle.py --help
|
|
|
|
# Check Gazebo
|
|
gz sim --version
|
|
ls ~/ardupilot_gazebo/build/libArduPilotPlugin.so
|
|
```
|
|
|
|
## Post-Installation
|
|
|
|
### Environment Setup
|
|
|
|
The installer creates `activate.sh` in the project root:
|
|
|
|
```bash
|
|
cd ~/RDC_Simulation
|
|
source activate.sh
|
|
```
|
|
|
|
This sources:
|
|
- ROS 2 (if installed)
|
|
- ArduPilot virtual environment
|
|
- Gazebo paths
|
|
|
|
### First Run
|
|
|
|
```bash
|
|
# Terminal 1: Start Gazebo
|
|
./scripts/run_ardupilot_sim.sh runway
|
|
|
|
# Terminal 2: Start SITL (after Gazebo loads)
|
|
source ~/venv-ardupilot/bin/activate
|
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
|
|
|
# Terminal 3: Run controller
|
|
source ~/venv-ardupilot/bin/activate
|
|
cd ~/RDC_Simulation
|
|
python scripts/run_ardupilot.py --pattern square
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### "empy not found"
|
|
|
|
```bash
|
|
source ~/venv-ardupilot/bin/activate
|
|
pip install empy==3.3.4
|
|
```
|
|
|
|
### "No JSON sensor message"
|
|
|
|
SITL isn't receiving data from Gazebo.
|
|
- Start Gazebo FIRST
|
|
- Wait for it to fully load
|
|
- Then start SITL
|
|
|
|
### "sim_vehicle.py not found"
|
|
|
|
```bash
|
|
source ~/.ardupilot_env
|
|
# OR
|
|
export PATH=$PATH:~/ardupilot/Tools/autotest
|
|
```
|
|
|
|
### Gazebo crashes / slow
|
|
|
|
```bash
|
|
# Check GPU
|
|
glxinfo | grep "OpenGL renderer"
|
|
|
|
# Try software rendering (slow but works)
|
|
export LIBGL_ALWAYS_SOFTWARE=1
|
|
gz sim -v4 -r ~/ardupilot_gazebo/worlds/iris_runway.sdf
|
|
```
|
|
|
|
### WSL: Display not working
|
|
|
|
```bash
|
|
# Check WSLg
|
|
ls /mnt/wslg
|
|
|
|
# If missing, update WSL
|
|
wsl --update
|
|
```
|