enhance installation guides, add environment setup, and expand troubleshooting for all platforms.
This commit is contained in:
69
README.md
69
README.md
@@ -6,18 +6,20 @@ ArduPilot + ROS 2 + Gazebo (ARG) simulation for landing on a moving platform.
|
|||||||
|
|
||||||
**Terminal 1 - Gazebo:**
|
**Terminal 1 - Gazebo:**
|
||||||
```bash
|
```bash
|
||||||
|
source activate.sh
|
||||||
./scripts/run_ardupilot_sim.sh runway
|
./scripts/run_ardupilot_sim.sh runway
|
||||||
```
|
```
|
||||||
|
|
||||||
**Terminal 2 - Controller:**
|
**Terminal 2 - Controller:**
|
||||||
```bash
|
```bash
|
||||||
|
source activate.sh
|
||||||
./scripts/run_ardupilot_controller.sh
|
./scripts/run_ardupilot_controller.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## World Options
|
## World Options
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_ardupilot_sim.sh runway # Default
|
./scripts/run_ardupilot_sim.sh runway # Default (outdoor)
|
||||||
./scripts/run_ardupilot_sim.sh warehouse # Indoor
|
./scripts/run_ardupilot_sim.sh warehouse # Indoor
|
||||||
./scripts/run_ardupilot_sim.sh custom # Custom landing pad
|
./scripts/run_ardupilot_sim.sh custom # Custom landing pad
|
||||||
./scripts/run_ardupilot_sim.sh my_world # gazebo/worlds/my_world.sdf
|
./scripts/run_ardupilot_sim.sh my_world # gazebo/worlds/my_world.sdf
|
||||||
@@ -25,12 +27,32 @@ ArduPilot + ROS 2 + Gazebo (ARG) simulation for landing on a moving platform.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### Ubuntu (Native or WSL2)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./setup/install_ubuntu.sh
|
./setup/install_ubuntu.sh
|
||||||
./setup/install_ardupilot.sh
|
./setup/install_ardupilot.sh
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Windows (via WSL2)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# PowerShell as Administrator
|
||||||
|
wsl --install -d Ubuntu-24.04
|
||||||
|
# Restart, then in Ubuntu terminal:
|
||||||
|
./setup/install_ubuntu.sh --with-ardupilot
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./setup/install_macos.sh
|
||||||
|
python standalone_simulation.py # Gazebo not supported
|
||||||
|
```
|
||||||
|
|
||||||
|
See [Installation Guide](docs/installation.md) for detailed platform instructions.
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -56,11 +78,44 @@ simulation/
|
|||||||
| COMMAND | Send commands to rover |
|
| COMMAND | Send commands to rover |
|
||||||
| LAND | Land on rover |
|
| LAND | Land on rover |
|
||||||
|
|
||||||
|
## Environment Setup
|
||||||
|
|
||||||
|
Always activate the environment before running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source activate.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This sets up:
|
||||||
|
- ROS 2 environment
|
||||||
|
- ArduPilot venv (with empy, pymavlink, etc.)
|
||||||
|
- Gazebo resource paths
|
||||||
|
- ArduPilot tools path
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
**sim_vehicle.py not found:**
|
||||||
|
```bash
|
||||||
|
source ~/.ardupilot_env
|
||||||
|
```
|
||||||
|
|
||||||
|
**empy not found:**
|
||||||
|
```bash
|
||||||
|
source ~/venv-ardupilot/bin/activate
|
||||||
|
pip install empy==3.3.4
|
||||||
|
```
|
||||||
|
|
||||||
|
**Gazebo slow (software rendering):**
|
||||||
|
```bash
|
||||||
|
glxinfo | grep "OpenGL renderer"
|
||||||
|
# Should show GPU, not "llvmpipe"
|
||||||
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- [Installation](docs/installation.md)
|
- [Installation](docs/installation.md) - Full setup for all platforms + WSL
|
||||||
- [ArduPilot Guide](docs/ardupilot.md)
|
- [ArduPilot Guide](docs/ardupilot.md) - SITL setup and troubleshooting
|
||||||
- [Drone Controller](docs/drone_guide.md)
|
- [Drone Controller](docs/drone_guide.md) - Landing algorithm
|
||||||
- [Custom Worlds](docs/gazebo_worlds.md)
|
- [Custom Worlds](docs/gazebo_worlds.md) - Create Gazebo environments
|
||||||
- [Blender Models](docs/blender_models.md)
|
- [Blender Models](docs/blender_models.md) - 3D model workflow
|
||||||
- [Architecture](docs/architecture.md)
|
- [Architecture](docs/architecture.md) - System design
|
||||||
@@ -1,13 +1,23 @@
|
|||||||
# ArduPilot + Gazebo Simulation
|
# ArduPilot + Gazebo Simulation
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before running, ensure your environment is set up:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source activate.sh
|
||||||
|
# or
|
||||||
|
source ~/.ardupilot_env && source ~/venv-ardupilot/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
## Quick Start (2 Terminals)
|
## Quick Start (2 Terminals)
|
||||||
|
|
||||||
**Terminal 1:**
|
**Terminal 1 - Start Gazebo:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_ardupilot_sim.sh runway
|
./scripts/run_ardupilot_sim.sh runway
|
||||||
```
|
```
|
||||||
|
|
||||||
**Terminal 2:**
|
**Terminal 2 - Start Controller:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_ardupilot_controller.sh
|
./scripts/run_ardupilot_controller.sh
|
||||||
```
|
```
|
||||||
@@ -21,33 +31,41 @@
|
|||||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Communication:**
|
||||||
|
- Gazebo ↔ SITL: JSON sensor data over UDP (port 9002)
|
||||||
|
- SITL ↔ Your Code: MAVLink over TCP (port 5760)
|
||||||
|
|
||||||
## World Options
|
## World Options
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_ardupilot_sim.sh runway # Default
|
./scripts/run_ardupilot_sim.sh runway # Default (outdoor runway)
|
||||||
./scripts/run_ardupilot_sim.sh warehouse # Indoor
|
./scripts/run_ardupilot_sim.sh warehouse # Indoor warehouse
|
||||||
./scripts/run_ardupilot_sim.sh zephyr # Fixed-wing
|
./scripts/run_ardupilot_sim.sh gimbal # With camera gimbal
|
||||||
|
./scripts/run_ardupilot_sim.sh zephyr # Fixed-wing aircraft
|
||||||
|
./scripts/run_ardupilot_sim.sh custom # Your custom world
|
||||||
|
./scripts/run_ardupilot_sim.sh my_world # gazebo/worlds/my_world.sdf
|
||||||
```
|
```
|
||||||
|
|
||||||
## GPS-Denied Mode
|
## GPS-Denied Mode
|
||||||
|
|
||||||
The simulation runs in GPS-denied mode by default.
|
The simulation runs in GPS-denied mode by default. The controller disables GPS checks and uses visual navigation.
|
||||||
|
|
||||||
For manual debugging with MAVProxy:
|
For manual debugging with MAVProxy:
|
||||||
```bash
|
```bash
|
||||||
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
||||||
|
|
||||||
# In MAVProxy:
|
# In MAVProxy console:
|
||||||
param set ARMING_CHECK 0
|
param set ARMING_CHECK 0
|
||||||
mode stabilize
|
mode stabilize
|
||||||
arm throttle force
|
arm throttle force
|
||||||
|
rc 3 1500 # Throttle up
|
||||||
```
|
```
|
||||||
|
|
||||||
## Controller Options
|
## Controller Options
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_ardupilot_controller.sh # Auto takeoff
|
./scripts/run_ardupilot_controller.sh # Auto takeoff
|
||||||
./scripts/run_ardupilot_controller.sh --no-takeoff # Manual
|
./scripts/run_ardupilot_controller.sh --no-takeoff # Manual control
|
||||||
./scripts/run_ardupilot_controller.sh -a 10 # 10m altitude
|
./scripts/run_ardupilot_controller.sh -a 10 # 10m altitude
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -55,18 +73,130 @@ arm throttle force
|
|||||||
|
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|------|---------|
|
|------|---------|
|
||||||
| `scripts/run_ardupilot_sim.sh` | Gazebo + GPU detection |
|
| `scripts/run_ardupilot_sim.sh` | Gazebo launcher with GPU detection |
|
||||||
| `scripts/run_ardupilot_controller.sh` | SITL + Controller |
|
| `scripts/run_ardupilot_controller.sh` | SITL + Controller launcher |
|
||||||
| `scripts/run_ardupilot.py` | MAVLink interface |
|
| `scripts/run_ardupilot.py` | MAVLink interface script |
|
||||||
| `src/drone_controller.py` | Your algorithm |
|
| `src/drone_controller.py` | Your landing algorithm |
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
The scripts automatically set these, but for manual runs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# ArduPilot tools
|
||||||
|
export PATH=$PATH:~/ardupilot/Tools/autotest
|
||||||
|
|
||||||
|
# ArduPilot venv (has empy, pymavlink, etc.)
|
||||||
|
source ~/venv-ardupilot/bin/activate
|
||||||
|
|
||||||
|
# Gazebo plugin paths
|
||||||
|
export GZ_SIM_SYSTEM_PLUGIN_PATH=~/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH
|
||||||
|
export GZ_SIM_RESOURCE_PATH=~/ardupilot_gazebo/models:~/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### "No JSON sensor message"
|
### "No JSON sensor message" or "No heartbeat"
|
||||||
Start Gazebo (Terminal 1) before the controller.
|
|
||||||
|
|
||||||
### Drone doesn't respond
|
**Cause:** Gazebo isn't running or ArduPilot plugin isn't loaded.
|
||||||
Check mode is GUIDED in MAVProxy.
|
|
||||||
|
|
||||||
### Simulation laggy
|
**Fix:**
|
||||||
Check GPU: `glxinfo | grep "OpenGL renderer"`
|
1. Start Gazebo first (Terminal 1)
|
||||||
|
2. Wait for world to fully load
|
||||||
|
3. Then start controller (Terminal 2)
|
||||||
|
|
||||||
|
### "sim_vehicle.py not found"
|
||||||
|
|
||||||
|
**Cause:** ArduPilot tools not in PATH.
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
```bash
|
||||||
|
source ~/.ardupilot_env
|
||||||
|
# or
|
||||||
|
export PATH=$PATH:~/ardupilot/Tools/autotest
|
||||||
|
```
|
||||||
|
|
||||||
|
### "empy not found" during waf build
|
||||||
|
|
||||||
|
**Cause:** Wrong Python environment.
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
```bash
|
||||||
|
source ~/venv-ardupilot/bin/activate
|
||||||
|
pip install empy==3.3.4
|
||||||
|
cd ~/ardupilot
|
||||||
|
./waf configure --board sitl
|
||||||
|
./waf copter
|
||||||
|
```
|
||||||
|
|
||||||
|
### Drone doesn't respond to commands
|
||||||
|
|
||||||
|
**Possible causes:**
|
||||||
|
1. Not in GUIDED mode - check MAVProxy: `mode`
|
||||||
|
2. Not armed - run: `arm throttle force`
|
||||||
|
3. Pre-arm checks failing - run: `param set ARMING_CHECK 0`
|
||||||
|
|
||||||
|
### Drone immediately crashes in Gazebo
|
||||||
|
|
||||||
|
**Cause:** Usually a physics/plugin issue.
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
```bash
|
||||||
|
# Rebuild the ArduPilot Gazebo plugin
|
||||||
|
cd ~/ardupilot_gazebo/build
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||||
|
make -j4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Simulation is laggy
|
||||||
|
|
||||||
|
**Cause:** Software rendering or GPU not detected.
|
||||||
|
|
||||||
|
**Check:**
|
||||||
|
```bash
|
||||||
|
glxinfo | grep "OpenGL renderer"
|
||||||
|
```
|
||||||
|
|
||||||
|
Should show your GPU name, not "llvmpipe" or "software".
|
||||||
|
|
||||||
|
**Fix for WSL:**
|
||||||
|
- Install NVIDIA drivers for WSL: https://developer.nvidia.com/cuda/wsl
|
||||||
|
- Ensure WSLg is enabled (Windows 11)
|
||||||
|
|
||||||
|
### MAVProxy console not opening
|
||||||
|
|
||||||
|
**Cause:** Missing `--console` flag or display issues.
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
```bash
|
||||||
|
# Run directly
|
||||||
|
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --map
|
||||||
|
|
||||||
|
# If display errors:
|
||||||
|
export DISPLAY=:0 # Linux/WSL with X server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Advanced: Custom Takeoff
|
||||||
|
|
||||||
|
To customize the takeoff behavior, edit `scripts/run_ardupilot.py`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Change altitude
|
||||||
|
TAKEOFF_ALTITUDE = 15 # meters
|
||||||
|
|
||||||
|
# Change timeout
|
||||||
|
CONNECTION_TIMEOUT = 60 # seconds
|
||||||
|
```
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
|
||||||
|
ArduPilot logs are saved to:
|
||||||
|
```
|
||||||
|
~/ardupilot/logs/
|
||||||
|
~/ardupilot/build/sitl/logs/
|
||||||
|
```
|
||||||
|
|
||||||
|
View with:
|
||||||
|
```bash
|
||||||
|
mavlogdump.py --types GPS,ATT ~/ardupilot/logs/LASTLOG.BIN
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
## Quick Install
|
## Quick Install (Ubuntu/WSL)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./setup/install_ubuntu.sh
|
./setup/install_ubuntu.sh
|
||||||
@@ -13,11 +13,101 @@ source ~/.bashrc
|
|||||||
| Component | Location |
|
| Component | Location |
|
||||||
|-----------|----------|
|
|-----------|----------|
|
||||||
| ArduPilot SITL | `~/ardupilot` |
|
| ArduPilot SITL | `~/ardupilot` |
|
||||||
|
| ArduPilot venv | `~/venv-ardupilot` |
|
||||||
| ardupilot_gazebo | `~/ardupilot_gazebo` |
|
| ardupilot_gazebo | `~/ardupilot_gazebo` |
|
||||||
| Gazebo Harmonic | System |
|
| Gazebo Harmonic | System |
|
||||||
| ROS 2 | System |
|
| ROS 2 | System |
|
||||||
| MAVProxy | `~/.local/bin` |
|
| 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
|
## Dependencies
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -34,29 +124,107 @@ pip install -r requirements.txt
|
|||||||
## Verify Installation
|
## Verify Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Source the environment
|
||||||
|
source activate.sh
|
||||||
|
|
||||||
|
# Check ArduPilot tools
|
||||||
sim_vehicle.py --help
|
sim_vehicle.py --help
|
||||||
|
which mavproxy.py
|
||||||
|
|
||||||
|
# Check Gazebo
|
||||||
gz sim --help
|
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
|
## Troubleshooting
|
||||||
|
|
||||||
### sim_vehicle.py not found
|
### "empy not found" or waf configure fails
|
||||||
|
|
||||||
|
The ArduPilot venv isn't activated. Run:
|
||||||
```bash
|
```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
|
export PATH=$PATH:~/ardupilot/Tools/autotest
|
||||||
```
|
```
|
||||||
|
|
||||||
### mavproxy.py not found
|
### mavproxy.py not found
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export PATH=$PATH:~/.local/bin
|
export PATH=$PATH:~/.local/bin
|
||||||
```
|
```
|
||||||
|
|
||||||
### pexpect error
|
### pexpect error
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pexpect
|
pip install pexpect
|
||||||
```
|
```
|
||||||
|
|
||||||
### Gazebo slow
|
### Gazebo slow / Software rendering
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
glxinfo | grep "OpenGL renderer"
|
glxinfo | grep "OpenGL renderer"
|
||||||
```
|
```
|
||||||
Should show GPU, not "llvmpipe".
|
|
||||||
|
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`
|
||||||
|
|||||||
@@ -123,8 +123,18 @@ else
|
|||||||
echo "[INFO] ROS 2 not found - standalone mode available"
|
echo "[INFO] ROS 2 not found - standalone mode available"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate Python venv
|
# Source ArduPilot environment (if installed)
|
||||||
if [ -f "$SCRIPT_DIR/venv/bin/activate" ]; then
|
if [ -f "$HOME/.ardupilot_env" ]; then
|
||||||
|
source "$HOME/.ardupilot_env"
|
||||||
|
echo "[OK] ArduPilot environment"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate ArduPilot venv (has empy and other dependencies)
|
||||||
|
if [ -f "$HOME/venv-ardupilot/bin/activate" ]; then
|
||||||
|
source "$HOME/venv-ardupilot/bin/activate"
|
||||||
|
echo "[OK] ArduPilot venv"
|
||||||
|
# Fallback to project venv
|
||||||
|
elif [ -f "$SCRIPT_DIR/venv/bin/activate" ]; then
|
||||||
source "$SCRIPT_DIR/venv/bin/activate"
|
source "$SCRIPT_DIR/venv/bin/activate"
|
||||||
echo "[OK] Python venv activated"
|
echo "[OK] Python venv activated"
|
||||||
fi
|
fi
|
||||||
@@ -132,6 +142,16 @@ fi
|
|||||||
# Set Gazebo model path if available
|
# Set Gazebo model path if available
|
||||||
export GZ_SIM_RESOURCE_PATH="$SCRIPT_DIR/gazebo/models:$GZ_SIM_RESOURCE_PATH"
|
export GZ_SIM_RESOURCE_PATH="$SCRIPT_DIR/gazebo/models:$GZ_SIM_RESOURCE_PATH"
|
||||||
|
|
||||||
|
# Add paths for ArduPilot tools
|
||||||
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
|
export PATH="$PATH:$HOME/ardupilot/Tools/autotest"
|
||||||
|
|
||||||
|
# ArduPilot Gazebo plugin
|
||||||
|
if [ -d "$HOME/ardupilot_gazebo/build" ]; then
|
||||||
|
export GZ_SIM_SYSTEM_PLUGIN_PATH="$HOME/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH"
|
||||||
|
export GZ_SIM_RESOURCE_PATH="$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Environment ready! Run:"
|
echo "Environment ready! Run:"
|
||||||
echo " python standalone_simulation.py"
|
echo " python standalone_simulation.py"
|
||||||
|
|||||||
@@ -177,8 +177,18 @@ elif [ -f "/opt/ros/humble/setup.bash" ]; then
|
|||||||
echo "[OK] ROS 2 humble"
|
echo "[OK] ROS 2 humble"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate Python venv
|
# Source ArduPilot environment (if installed)
|
||||||
if [ -f "$SCRIPT_DIR/venv/bin/activate" ]; then
|
if [ -f "$HOME/.ardupilot_env" ]; then
|
||||||
|
source "$HOME/.ardupilot_env"
|
||||||
|
echo "[OK] ArduPilot environment"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate ArduPilot venv (has empy and other dependencies)
|
||||||
|
if [ -f "$HOME/venv-ardupilot/bin/activate" ]; then
|
||||||
|
source "$HOME/venv-ardupilot/bin/activate"
|
||||||
|
echo "[OK] ArduPilot venv"
|
||||||
|
# Fallback to project venv
|
||||||
|
elif [ -f "$SCRIPT_DIR/venv/bin/activate" ]; then
|
||||||
source "$SCRIPT_DIR/venv/bin/activate"
|
source "$SCRIPT_DIR/venv/bin/activate"
|
||||||
echo "[OK] Python venv"
|
echo "[OK] Python venv"
|
||||||
fi
|
fi
|
||||||
@@ -186,13 +196,14 @@ fi
|
|||||||
# Set Gazebo paths
|
# Set Gazebo paths
|
||||||
export GZ_SIM_RESOURCE_PATH="$SCRIPT_DIR/gazebo/models:$GZ_SIM_RESOURCE_PATH"
|
export GZ_SIM_RESOURCE_PATH="$SCRIPT_DIR/gazebo/models:$GZ_SIM_RESOURCE_PATH"
|
||||||
|
|
||||||
# Add ~/.local/bin to PATH (for mavproxy.py)
|
# Add paths for ArduPilot tools and MAVProxy
|
||||||
export PATH="$PATH:$HOME/.local/bin"
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
|
export PATH="$PATH:$HOME/ardupilot/Tools/autotest"
|
||||||
|
|
||||||
# ArduPilot workspace
|
# ArduPilot Gazebo plugin
|
||||||
if [ -f "$HOME/ardu_ws/install/setup.bash" ]; then
|
if [ -d "$HOME/ardupilot_gazebo/build" ]; then
|
||||||
source "$HOME/ardu_ws/install/setup.bash"
|
export GZ_SIM_SYSTEM_PLUGIN_PATH="$HOME/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH"
|
||||||
echo "[OK] ArduPilot workspace"
|
export GZ_SIM_RESOURCE_PATH="$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -221,12 +221,34 @@ Write-Host ""
|
|||||||
Write-Host "With moving rover:" -ForegroundColor Yellow
|
Write-Host "With moving rover:" -ForegroundColor Yellow
|
||||||
Write-Host " python standalone_simulation.py --pattern circular --speed 0.3" -ForegroundColor White
|
Write-Host " python standalone_simulation.py --pattern circular --speed 0.3" -ForegroundColor White
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "==============================================" -ForegroundColor Cyan
|
Write-Host "======================================================" -ForegroundColor Cyan
|
||||||
Write-Host " Want ROS 2 + Gazebo? Use WSL2" -ForegroundColor Cyan
|
Write-Host " Want ROS 2 + Gazebo + ArduPilot? Use WSL2" -ForegroundColor Cyan
|
||||||
Write-Host "==============================================" -ForegroundColor Cyan
|
Write-Host "======================================================" -ForegroundColor Cyan
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "For the full experience with ROS 2 and Gazebo:" -ForegroundColor Gray
|
Write-Host "For the full simulation with Gazebo and ArduPilot:" -ForegroundColor Gray
|
||||||
Write-Host " 1. Install WSL2: wsl --install -d Ubuntu-22.04" -ForegroundColor White
|
Write-Host ""
|
||||||
Write-Host " 2. Open Ubuntu and run: ./setup/install_ubuntu.sh" -ForegroundColor White
|
Write-Host "Step 1: Install WSL2" -ForegroundColor Yellow
|
||||||
Write-Host " 3. See docs/installation.md for details" -ForegroundColor White
|
Write-Host " wsl --install -d Ubuntu-24.04" -ForegroundColor White
|
||||||
|
Write-Host " # Restart your computer when prompted" -ForegroundColor DarkGray
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Step 2: Open Ubuntu and install" -ForegroundColor Yellow
|
||||||
|
Write-Host " cd /mnt/c/path/to/RDC_Simulation" -ForegroundColor White
|
||||||
|
Write-Host " ./setup/install_ubuntu.sh --with-ardupilot" -ForegroundColor White
|
||||||
|
Write-Host " source ~/.bashrc" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Step 3: Run simulation (2 terminals)" -ForegroundColor Yellow
|
||||||
|
Write-Host " Terminal 1: ./scripts/run_ardupilot_sim.sh runway" -ForegroundColor White
|
||||||
|
Write-Host " Terminal 2: ./scripts/run_ardupilot_controller.sh" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "GPU Acceleration in WSL:" -ForegroundColor Yellow
|
||||||
|
Write-Host " - Windows 11: WSLg auto-enabled (no setup needed)" -ForegroundColor DarkGray
|
||||||
|
Write-Host " - NVIDIA GPU: Install WSL driver from nvidia.com/cuda/wsl" -ForegroundColor DarkGray
|
||||||
|
Write-Host " - Check: glxinfo | grep 'OpenGL renderer'" -ForegroundColor DarkGray
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "WSL Tips:" -ForegroundColor Yellow
|
||||||
|
Write-Host " - Access Windows files: /mnt/c/Users/YourName/" -ForegroundColor DarkGray
|
||||||
|
Write-Host " - Open folder in Explorer: explorer.exe ." -ForegroundColor DarkGray
|
||||||
|
Write-Host " - Increase memory: Create %UserProfile%\.wslconfig" -ForegroundColor DarkGray
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "See docs/installation.md for detailed instructions." -ForegroundColor Gray
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|||||||
Reference in New Issue
Block a user