Controller Update
This commit is contained in:
@@ -1,129 +1,187 @@
|
||||
# WSL Setup Guide
|
||||
|
||||
Setup guide for Windows Subsystem for Linux (WSL2).
|
||||
## Overview
|
||||
|
||||
## Prerequisites
|
||||
This guide covers running the UAV-UGV simulation on Windows Subsystem for Linux (WSL2).
|
||||
|
||||
- Windows 10 (version 21H2+) or Windows 11
|
||||
## Requirements
|
||||
|
||||
- Windows 10 (21H2+) or Windows 11
|
||||
- WSL2 with Ubuntu 22.04
|
||||
- 16GB RAM minimum
|
||||
- Optional: NVIDIA GPU with WSL drivers
|
||||
|
||||
### Install WSL2
|
||||
## WSL2 Installation
|
||||
|
||||
### 1. Enable WSL2
|
||||
|
||||
Open PowerShell as Administrator:
|
||||
|
||||
```powershell
|
||||
wsl --install
|
||||
```
|
||||
|
||||
### 2. Install Ubuntu
|
||||
|
||||
```powershell
|
||||
wsl --install -d Ubuntu-22.04
|
||||
```
|
||||
|
||||
Restart your computer, then open Ubuntu from the Start menu.
|
||||
### 3. Set WSL2 as Default
|
||||
|
||||
## GUI Support
|
||||
```powershell
|
||||
wsl --set-default-version 2
|
||||
```
|
||||
|
||||
### Windows 11 (WSLg)
|
||||
## Graphics Setup
|
||||
|
||||
GUI works automatically. No additional setup needed.
|
||||
### Option A: WSLg (Windows 11 - Recommended)
|
||||
|
||||
### Windows 10 (VcXsrv)
|
||||
WSLg is built into Windows 11 and works automatically.
|
||||
|
||||
1. Download and install [VcXsrv](https://sourceforge.net/projects/vcxsrv/)
|
||||
2. Run XLaunch with these settings:
|
||||
- Multiple windows
|
||||
- Start no client
|
||||
- Disable access control (checked)
|
||||
3. In WSL, set DISPLAY:
|
||||
Verify:
|
||||
```bash
|
||||
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
|
||||
echo $DISPLAY
|
||||
# Should show something like :0
|
||||
```
|
||||
|
||||
### Option B: VcXsrv (Windows 10)
|
||||
|
||||
1. Download VcXsrv: https://sourceforge.net/projects/vcxsrv/
|
||||
2. Launch with "Disable access control" checked
|
||||
3. In WSL:
|
||||
|
||||
```bash
|
||||
export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0
|
||||
echo "export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0" >> ~/.bashrc
|
||||
```
|
||||
|
||||
## GPU Support
|
||||
|
||||
### NVIDIA GPU (Optional)
|
||||
|
||||
1. Install NVIDIA drivers for WSL: https://developer.nvidia.com/cuda/wsl
|
||||
2. Verify in WSL:
|
||||
|
||||
```bash
|
||||
nvidia-smi
|
||||
```
|
||||
|
||||
If working, you can use hardware acceleration.
|
||||
|
||||
### Software Rendering (No GPU)
|
||||
|
||||
Most reliable for WSL:
|
||||
|
||||
```bash
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
export GALLIUM_DRIVER=llvmpipe
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Same as native Ubuntu:
|
||||
|
||||
```bash
|
||||
git clone https://git.sirblob.co/SirBlob/simulation.git
|
||||
cd simulation
|
||||
cd ~/sim/uav_ugv_simulation
|
||||
bash setup.sh
|
||||
```
|
||||
|
||||
The setup script automatically:
|
||||
- Detects WSL environment
|
||||
- Installs GUI support packages
|
||||
- Creates WSL environment file
|
||||
- Configures DISPLAY variable
|
||||
## Running Simulation
|
||||
|
||||
## Running the Simulation
|
||||
**Always use software rendering on WSL:**
|
||||
|
||||
```bash
|
||||
cd ~/simulation
|
||||
source activate_venv.sh
|
||||
bash scripts/run_simulation.sh
|
||||
bash scripts/run_autonomous.sh --software-render --mission hover
|
||||
```
|
||||
|
||||
If graphics are slow or Gazebo crashes:
|
||||
```bash
|
||||
bash scripts/run_simulation.sh --software-render
|
||||
## Performance Tips
|
||||
|
||||
### 1. Allocate More Memory
|
||||
|
||||
Create/edit `%USERPROFILE%\.wslconfig`:
|
||||
|
||||
```ini
|
||||
[wsl2]
|
||||
memory=12GB
|
||||
processors=4
|
||||
swap=8GB
|
||||
```
|
||||
|
||||
Restart WSL:
|
||||
```powershell
|
||||
wsl --shutdown
|
||||
```
|
||||
|
||||
### 2. Use Fast Storage
|
||||
|
||||
Run simulation from Windows filesystem only if needed:
|
||||
```bash
|
||||
# Faster (Linux filesystem)
|
||||
cd ~/sim/uav_ugv_simulation
|
||||
|
||||
# Slower (Windows filesystem)
|
||||
cd /mnt/c/Projects/simulation
|
||||
```
|
||||
|
||||
### 3. Disable Unnecessary Visuals
|
||||
|
||||
In software rendering mode, Gazebo is slower. Consider:
|
||||
- Running headless: `--headless` flag
|
||||
- Reducing physics rate
|
||||
- Simpler world files
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Black screen or no display
|
||||
### "cannot open display"
|
||||
|
||||
Check DISPLAY variable:
|
||||
```bash
|
||||
echo $DISPLAY
|
||||
# For WSLg
|
||||
export DISPLAY=:0
|
||||
|
||||
# For VcXsrv
|
||||
export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0
|
||||
```
|
||||
|
||||
For WSLg (Windows 11), should be `:0`
|
||||
For VcXsrv (Windows 10), should be `<IP>:0`
|
||||
### Graphics freeze/crash
|
||||
|
||||
Test with:
|
||||
```bash
|
||||
xcalc
|
||||
```
|
||||
|
||||
### Gazebo crashes immediately
|
||||
|
||||
Use software rendering:
|
||||
```bash
|
||||
# Always use software rendering
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
bash scripts/run_simulation.sh
|
||||
export GALLIUM_DRIVER=llvmpipe
|
||||
bash scripts/run_autonomous.sh --software-render
|
||||
```
|
||||
|
||||
### OpenGL errors
|
||||
|
||||
```bash
|
||||
export MESA_GL_VERSION_OVERRIDE=3.3
|
||||
export MESA_GLSL_VERSION_OVERRIDE=330
|
||||
```
|
||||
|
||||
### VcXsrv connection refused
|
||||
|
||||
1. Check Windows Firewall allows VcXsrv
|
||||
2. Ensure XLaunch is running
|
||||
3. Disable access control in XLaunch settings
|
||||
|
||||
### Slow performance
|
||||
|
||||
- Close unnecessary Windows applications
|
||||
- Allocate more RAM to WSL in `.wslconfig`:
|
||||
```ini
|
||||
[wsl2]
|
||||
memory=8GB
|
||||
processors=4
|
||||
```
|
||||
- Increase WSL memory (see Performance Tips)
|
||||
- Use software rendering
|
||||
- Close other applications
|
||||
|
||||
- Use software rendering flag
|
||||
|
||||
## Environment Variables
|
||||
|
||||
The `activate_venv.sh` script sets these automatically:
|
||||
### Network issues
|
||||
|
||||
```bash
|
||||
export DISPLAY=:0 # or IP:0 for VcXsrv
|
||||
export LIBGL_ALWAYS_INDIRECT=0
|
||||
export MESA_GL_VERSION_OVERRIDE=3.3
|
||||
# If MAVLink connection fails
|
||||
# Check Windows firewall allows WSL traffic
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
## Quick Start Commands
|
||||
|
||||
```bash
|
||||
bash scripts/uninstall.sh --all
|
||||
# 1. Open Ubuntu terminal
|
||||
|
||||
# 2. Navigate to project
|
||||
cd ~/sim/uav_ugv_simulation
|
||||
|
||||
# 3. Activate environment
|
||||
source activate_venv.sh
|
||||
|
||||
# 4. Run with software rendering
|
||||
bash scripts/run_autonomous.sh --software-render --mission hover
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [Setup Guide](setup_guide.md)
|
||||
- [Troubleshooting](troubleshooting.md)
|
||||
|
||||
Reference in New Issue
Block a user