Scripts Update
This commit is contained in:
@@ -1,178 +1,236 @@
|
||||
# Troubleshooting Guide
|
||||
# Troubleshooting
|
||||
|
||||
## Common Issues
|
||||
Common issues and solutions.
|
||||
|
||||
### 1. Gazebo Won't Start
|
||||
## Installation Issues
|
||||
|
||||
**Symptoms**: Gazebo window doesn't open, or crashes immediately
|
||||
### ROS 2 packages not found
|
||||
|
||||
**Solutions**:
|
||||
```
|
||||
E: Unable to locate package ros-humble-ros-base
|
||||
```
|
||||
|
||||
Check Ubuntu version matches ROS distro:
|
||||
- Ubuntu 22.04 → ROS 2 Humble
|
||||
- Ubuntu 24.04 → ROS 2 Jazzy
|
||||
|
||||
Re-run setup:
|
||||
```bash
|
||||
# Kill any existing Gazebo processes
|
||||
killall gzserver gzclient
|
||||
bash setup.sh
|
||||
```
|
||||
|
||||
# Check for port conflicts
|
||||
lsof -i :11345
|
||||
### Gazebo cmake error (gz-cmake3 not found)
|
||||
|
||||
# Try software rendering
|
||||
```
|
||||
Could not find a package configuration file provided by "gz-cmake3"
|
||||
```
|
||||
|
||||
Install Gazebo development packages:
|
||||
```bash
|
||||
sudo apt install libgz-cmake3-dev libgz-sim8-dev libgz-plugin2-dev
|
||||
```
|
||||
|
||||
### ArduPilot build fails
|
||||
|
||||
```bash
|
||||
cd ~/ardupilot
|
||||
./waf clean
|
||||
./waf configure --board sitl
|
||||
./waf copter
|
||||
```
|
||||
|
||||
### ardupilot_gazebo build fails
|
||||
|
||||
Ensure Gazebo dev packages are installed:
|
||||
```bash
|
||||
sudo apt install gz-harmonic libgz-cmake3-dev libgz-sim8-dev \
|
||||
libgz-plugin2-dev libgz-common5-dev libgz-physics7-dev \
|
||||
libgz-sensors8-dev rapidjson-dev
|
||||
```
|
||||
|
||||
Rebuild:
|
||||
```bash
|
||||
cd ~/ardupilot_gazebo
|
||||
rm -rf build
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make -j$(nproc)
|
||||
```
|
||||
|
||||
## Runtime Issues
|
||||
|
||||
### Gazebo won't start
|
||||
|
||||
Check Gazebo installation:
|
||||
```bash
|
||||
gz sim --version
|
||||
```
|
||||
|
||||
Check plugin path:
|
||||
```bash
|
||||
echo $GZ_SIM_SYSTEM_PLUGIN_PATH
|
||||
ls ~/ardupilot_gazebo/build/libArduPilotPlugin.so
|
||||
```
|
||||
|
||||
### Black screen in Gazebo (WSL)
|
||||
|
||||
Use software rendering:
|
||||
```bash
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
gazebo
|
||||
bash scripts/run_simulation.sh
|
||||
```
|
||||
|
||||
### 2. ArduPilot SITL Connection Failed
|
||||
|
||||
**Symptoms**: MAVROS can't connect to ArduPilot
|
||||
|
||||
**Solutions**:
|
||||
Or use the flag:
|
||||
```bash
|
||||
# Check if SITL is running
|
||||
ps aux | grep ArduCopter
|
||||
|
||||
# Check port availability
|
||||
lsof -i :14550
|
||||
|
||||
# Start SITL manually first
|
||||
cd ~/ardupilot/ArduCopter
|
||||
sim_vehicle.py -v ArduCopter -f gazebo-iris --console
|
||||
|
||||
# Then start MAVROS
|
||||
ros2 run mavros mavros_node --ros-args -p fcu_url:=udp://:14550@127.0.0.1:14555
|
||||
bash scripts/run_simulation.sh --software-render
|
||||
```
|
||||
|
||||
### 3. Visual Odometry Not Working
|
||||
### Gazebo crashes with OpenGL error
|
||||
|
||||
**Symptoms**: No pose output, high drift
|
||||
|
||||
**Solutions**:
|
||||
- Ensure camera is publishing:
|
||||
```bash
|
||||
ros2 topic hz /uav/camera/forward/image_raw
|
||||
```
|
||||
- Check for sufficient visual features in scene
|
||||
- Adjust feature detection parameters in `config/uav_params.yaml`
|
||||
- Add visual markers to the world
|
||||
|
||||
### 4. Vehicle Won't Arm
|
||||
|
||||
**Symptoms**: Arm command fails
|
||||
|
||||
**Solutions**:
|
||||
```bash
|
||||
# Check MAVROS state
|
||||
ros2 topic echo /uav/mavros/state
|
||||
|
||||
# Check for prearm errors
|
||||
ros2 topic echo /uav/mavros/statustext/recv
|
||||
|
||||
# Force arm (use with caution)
|
||||
ros2 service call /uav/mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
|
||||
export MESA_GL_VERSION_OVERRIDE=3.3
|
||||
export MESA_GLSL_VERSION_OVERRIDE=330
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
```
|
||||
|
||||
### 5. Geofence Immediately Triggers
|
||||
### sim_vehicle.py not found
|
||||
|
||||
**Symptoms**: Vehicle triggers geofence breach on startup
|
||||
|
||||
**Solutions**:
|
||||
- Check GPS coordinates in `config/geofence_params.yaml`
|
||||
- Ensure Gazebo world has correct `spherical_coordinates`
|
||||
- Verify MAVROS is receiving GPS:
|
||||
```bash
|
||||
ros2 topic echo /uav/mavros/global_position/global
|
||||
```
|
||||
|
||||
### 6. High CPU/Memory Usage
|
||||
|
||||
**Symptoms**: System becomes slow during simulation
|
||||
|
||||
**Solutions**:
|
||||
- Reduce camera resolution in model SDF files
|
||||
- Lower Gazebo real-time factor
|
||||
- Disable unnecessary visualizations
|
||||
- Use headless mode:
|
||||
```bash
|
||||
gazebo --headless
|
||||
```
|
||||
|
||||
### 7. ROS 2 Package Not Found
|
||||
|
||||
**Symptoms**: `Package 'uav_ugv_simulation' not found`
|
||||
|
||||
**Solutions**:
|
||||
```bash
|
||||
# Rebuild the package
|
||||
cd ~/ros2_ws
|
||||
colcon build --packages-select uav_ugv_simulation
|
||||
|
||||
# Source the workspace
|
||||
source install/setup.bash
|
||||
|
||||
# Verify installation
|
||||
ros2 pkg list | grep uav_ugv
|
||||
export PATH=$PATH:$HOME/ardupilot/Tools/autotest
|
||||
```
|
||||
|
||||
### 8. Python Import Errors
|
||||
|
||||
**Symptoms**: `ModuleNotFoundError: No module named 'xxx'`
|
||||
|
||||
**Solutions**:
|
||||
Or source the activation script:
|
||||
```bash
|
||||
# Activate virtual environment
|
||||
source activate_venv.sh
|
||||
|
||||
# Reinstall requirements
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### 9. Camera Images Are Black
|
||||
|
||||
**Symptoms**: Camera topic publishes but images are empty
|
||||
|
||||
**Solutions**:
|
||||
- Check lighting in Gazebo world
|
||||
- Verify camera plugin is loaded:
|
||||
```bash
|
||||
ros2 topic info /uav/camera/forward/image_raw
|
||||
```
|
||||
- Check camera is within clip range
|
||||
|
||||
### 10. Vehicle Drifts Excessively
|
||||
|
||||
**Symptoms**: Position estimate diverges from actual position
|
||||
|
||||
**Solutions**:
|
||||
- Increase visual features in environment
|
||||
- Add ArUco markers for landmark tracking
|
||||
- Tune EKF covariances in `config/uav_params.yaml`
|
||||
- Check optical flow height compensation
|
||||
|
||||
## Debug Commands
|
||||
### MAVProxy not found
|
||||
|
||||
```bash
|
||||
# View all ROS nodes
|
||||
ros2 node list
|
||||
|
||||
# Check topic connections
|
||||
ros2 topic info /topic_name
|
||||
|
||||
# View parameter values
|
||||
ros2 param dump /node_name
|
||||
|
||||
# Echo topic data
|
||||
ros2 topic echo /topic_name --once
|
||||
|
||||
# View TF tree
|
||||
ros2 run tf2_tools view_frames
|
||||
pip3 install --user mavproxy pymavlink
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
```
|
||||
|
||||
## Log Files
|
||||
### Drone doesn't respond to commands
|
||||
|
||||
- Gazebo: `~/.gazebo/log/`
|
||||
- ROS 2: `~/.ros/log/`
|
||||
- ArduPilot: Check console window
|
||||
1. Check ArduPilot is running:
|
||||
```bash
|
||||
ps aux | grep arducopter
|
||||
```
|
||||
|
||||
## Getting Help
|
||||
2. Check connection:
|
||||
```
|
||||
# In MAVProxy console
|
||||
status
|
||||
```
|
||||
|
||||
1. Check ROS 2 logs: `ros2 launch --debug ...`
|
||||
2. Enable verbose Gazebo: `gazebo --verbose`
|
||||
3. Check ArduPilot parameters: Use MAVProxy console
|
||||
3. Ensure GUIDED mode:
|
||||
```
|
||||
mode guided
|
||||
```
|
||||
|
||||
4. Arm the drone:
|
||||
```
|
||||
arm throttle
|
||||
```
|
||||
|
||||
### Drone immediately disarms
|
||||
|
||||
Usually means pre-arm checks failing:
|
||||
```
|
||||
# In MAVProxy console
|
||||
arm check
|
||||
```
|
||||
|
||||
Common fixes:
|
||||
```
|
||||
# Disable GPS check for GPS-denied operation
|
||||
param set ARMING_CHECK 0
|
||||
```
|
||||
|
||||
### Drone drifts or flips on takeoff
|
||||
|
||||
Check EKF is using vision/external nav:
|
||||
```
|
||||
# In MAVProxy console
|
||||
param show EK3_SRC*
|
||||
```
|
||||
|
||||
## WSL-Specific Issues
|
||||
|
||||
### DISPLAY not set
|
||||
|
||||
For WSLg (Windows 11):
|
||||
```bash
|
||||
export DISPLAY=:0
|
||||
```
|
||||
|
||||
For VcXsrv (Windows 10):
|
||||
```bash
|
||||
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
|
||||
```
|
||||
|
||||
### VcXsrv connection refused
|
||||
|
||||
1. Ensure XLaunch is running
|
||||
2. Disable access control in XLaunch
|
||||
3. Check Windows Firewall allows VcXsrv
|
||||
|
||||
### Slow graphics performance
|
||||
|
||||
```bash
|
||||
# Use software rendering
|
||||
bash scripts/run_simulation.sh --software-render
|
||||
|
||||
# Or set environment
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
```
|
||||
|
||||
## Logs and Debugging
|
||||
|
||||
### Gazebo verbose output
|
||||
|
||||
```bash
|
||||
gz sim -v4 ~/ardupilot_gazebo/worlds/iris_runway.sdf
|
||||
```
|
||||
|
||||
### ArduPilot logs
|
||||
|
||||
Logs are saved in:
|
||||
```
|
||||
~/ardupilot/logs/
|
||||
```
|
||||
|
||||
### Check ROS topics
|
||||
|
||||
```bash
|
||||
source activate_venv.sh
|
||||
ros2 topic list
|
||||
ros2 topic echo /mavros/state
|
||||
```
|
||||
|
||||
## Reset Everything
|
||||
|
||||
```bash
|
||||
# Stop all processes
|
||||
bash scripts/kill_simulation.sh
|
||||
|
||||
# Clean rebuild of ArduPilot
|
||||
cd ~/ardupilot
|
||||
./waf clean
|
||||
./waf copter
|
||||
|
||||
# Clean rebuild of plugin
|
||||
cd ~/ardupilot_gazebo
|
||||
rm -rf build
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
make -j$(nproc)
|
||||
```
|
||||
|
||||
## Full Reinstall
|
||||
|
||||
```bash
|
||||
bash scripts/uninstall.sh
|
||||
bash setup.sh
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user