231 lines
4.1 KiB
Markdown
231 lines
4.1 KiB
Markdown
# Installation
|
|
|
|
## Quick Install (Ubuntu/WSL)
|
|
|
|
```bash
|
|
./setup/install_ubuntu.sh
|
|
./setup/install_ardupilot.sh
|
|
source ~/.bashrc
|
|
```
|
|
|
|
## What Gets Installed
|
|
|
|
| Component | Location |
|
|
|-----------|----------|
|
|
| ArduPilot SITL | `~/ardupilot` |
|
|
| ArduPilot venv | `~/venv-ardupilot` |
|
|
| ardupilot_gazebo | `~/ardupilot_gazebo` |
|
|
| Gazebo Harmonic | System |
|
|
| ROS 2 | System |
|
|
| MAVProxy | `~/.local/bin` |
|
|
|
|
## Platform-Specific Installation
|
|
|
|
### Ubuntu (Native)
|
|
|
|
```bash
|
|
./setup/install_ubuntu.sh --with-ardupilot
|
|
```
|
|
|
|
### Windows (via WSL2)
|
|
|
|
WSL2 (Windows Subsystem for Linux) is the recommended way to run this simulation on Windows.
|
|
|
|
#### Step 1: Install WSL2
|
|
|
|
Open PowerShell as Administrator:
|
|
```powershell
|
|
wsl --install -d Ubuntu-24.04
|
|
```
|
|
|
|
Restart your computer when prompted.
|
|
|
|
#### Step 2: Configure WSL2 for GUI Apps
|
|
|
|
WSL2 on Windows 11 has built-in GUI support (WSLg). For Windows 10, you may need an X server:
|
|
|
|
```powershell
|
|
# Windows 11 - WSLg is automatic, no extra setup needed
|
|
|
|
# Windows 10 - Install VcXsrv or X410 from Microsoft Store
|
|
```
|
|
|
|
#### Step 3: Install in WSL
|
|
|
|
Open Ubuntu from Start menu:
|
|
```bash
|
|
# Clone the project (or copy from Windows)
|
|
git clone https://github.com/your-repo/RDC_Simulation.git
|
|
cd RDC_Simulation
|
|
|
|
# Run installation
|
|
./setup/install_ubuntu.sh
|
|
./setup/install_ardupilot.sh
|
|
source ~/.bashrc
|
|
```
|
|
|
|
#### Step 4: GPU Acceleration in WSL
|
|
|
|
For best performance with Gazebo:
|
|
|
|
```bash
|
|
# Check GPU availability
|
|
glxinfo | grep "OpenGL renderer"
|
|
|
|
# Should show your GPU, not "llvmpipe"
|
|
# If using NVIDIA, install NVIDIA GPU driver for WSL:
|
|
# https://developer.nvidia.com/cuda/wsl
|
|
```
|
|
|
|
#### WSL Tips
|
|
|
|
- **Access Windows files:** `/mnt/c/Users/YourName/`
|
|
- **Open file explorer:** `explorer.exe .`
|
|
- **Copy to clipboard:** `cat file | clip.exe`
|
|
- **Memory limit:** Create `%UserProfile%\.wslconfig`:
|
|
```ini
|
|
[wsl2]
|
|
memory=8GB
|
|
processors=4
|
|
```
|
|
|
|
### macOS
|
|
|
|
Gazebo is not officially supported on macOS. Use standalone mode:
|
|
|
|
```bash
|
|
./setup/install_macos.sh
|
|
python standalone_simulation.py
|
|
```
|
|
|
|
For full simulation, use a Linux VM (UTM for Apple Silicon) or Docker.
|
|
|
|
### Arch Linux
|
|
|
|
```bash
|
|
./setup/install_arch.sh
|
|
```
|
|
|
|
ROS 2 and Gazebo are available via AUR - see script output for details.
|
|
|
|
## Dependencies
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
- pybullet
|
|
- numpy
|
|
- pillow
|
|
- opencv-python
|
|
- pymavlink
|
|
- pexpect
|
|
|
|
## Verify Installation
|
|
|
|
```bash
|
|
# Source the environment
|
|
source activate.sh
|
|
|
|
# Check ArduPilot tools
|
|
sim_vehicle.py --help
|
|
which mavproxy.py
|
|
|
|
# Check Gazebo
|
|
gz sim --help
|
|
```
|
|
|
|
## Environment Setup
|
|
|
|
After installation, always source the environment before running:
|
|
|
|
```bash
|
|
source activate.sh
|
|
# or
|
|
source ~/.bashrc # if ArduPilot was installed
|
|
```
|
|
|
|
The activation script sets up:
|
|
- ROS 2 environment
|
|
- ArduPilot Python venv (with empy, pymavlink, etc.)
|
|
- Gazebo resource paths
|
|
- ArduPilot tools path
|
|
|
|
## Troubleshooting
|
|
|
|
### "empy not found" or waf configure fails
|
|
|
|
The ArduPilot venv isn't activated. Run:
|
|
```bash
|
|
source ~/venv-ardupilot/bin/activate
|
|
pip install empy==3.3.4
|
|
```
|
|
|
|
### sim_vehicle.py not found
|
|
|
|
```bash
|
|
source ~/.ardupilot_env
|
|
# or
|
|
export PATH=$PATH:~/ardupilot/Tools/autotest
|
|
```
|
|
|
|
### mavproxy.py not found
|
|
|
|
```bash
|
|
export PATH=$PATH:~/.local/bin
|
|
```
|
|
|
|
### pexpect error
|
|
|
|
```bash
|
|
pip install pexpect
|
|
```
|
|
|
|
### Gazebo slow / Software rendering
|
|
|
|
```bash
|
|
glxinfo | grep "OpenGL renderer"
|
|
```
|
|
|
|
Should show your GPU, not "llvmpipe". Install proper GPU drivers:
|
|
|
|
- **NVIDIA:** `sudo apt install nvidia-driver-XXX`
|
|
- **AMD:** `sudo apt install mesa-vulkan-drivers`
|
|
- **Intel:** Usually works out of box
|
|
- **WSL:** Install NVIDIA WSL driver from nvidia.com
|
|
|
|
### Wrong Python environment
|
|
|
|
If you see errors about missing packages that should be installed:
|
|
|
|
```bash
|
|
# Check which Python is being used
|
|
which python3
|
|
|
|
# Should be: ~/venv-ardupilot/bin/python3
|
|
# If not, activate the correct venv:
|
|
source ~/venv-ardupilot/bin/activate
|
|
```
|
|
|
|
### WSL: Display not working
|
|
|
|
```bash
|
|
# Check DISPLAY variable
|
|
echo $DISPLAY
|
|
|
|
# For WSLg (Windows 11), should be auto-set
|
|
# For Windows 10 with X server:
|
|
export DISPLAY=:0
|
|
```
|
|
|
|
### WSL: Out of memory
|
|
|
|
Create `%UserProfile%\.wslconfig`:
|
|
```ini
|
|
[wsl2]
|
|
memory=8GB
|
|
swap=4GB
|
|
```
|
|
|
|
Then restart WSL: `wsl --shutdown`
|