Scripts Update

This commit is contained in:
2026-02-09 04:52:32 +00:00
parent 2d3b795d82
commit 79f748d35d
10 changed files with 861 additions and 1376 deletions

182
README.md
View File

@@ -1,185 +1,103 @@
# UAV-UGV Gazebo SITL Simulation
## GPS-Denied Navigation with Geofencing
# UAV-UGV Simulation
A production-ready simulation environment for UAV (drone) and UGV (ground vehicle) development using **GPS-denied navigation** with vision-based localization, while maintaining GPS-based geofencing for safety.
GPS-Denied Navigation with Geofencing
## Key Feature: GPS-Denied Navigation
A simulation environment for UAV and UGV development using GPS-denied navigation with vision-based localization, while maintaining GPS-based geofencing for safety.
**Navigation Mode**: All vehicles navigate using **relative positioning** only:
## GPS-Denied Navigation
**Navigation**: All vehicles navigate using relative positioning only:
- Visual odometry from cameras
- Optical flow sensors
- IMU integration
- Visual landmark tracking
- Local coordinate frames
**GPS Usage**: GPS is ONLY used for:
- Geofencing (safety boundaries)
- NOT used for waypoint navigation
- NOT used for position control
**GPS Usage**: GPS is ONLY used for geofencing (safety boundaries), NOT for navigation or position control.
## System Requirements
## Requirements
- **Ubuntu 22.04 LTS** (or 24.04)
- **16GB RAM** recommended (8GB minimum)
- **50GB disk space** (for ArduPilot + Gazebo)
- NVIDIA GPU recommended but not required
- Ubuntu 22.04 or 24.04 (WSL2 supported)
- 16GB RAM recommended
- 50GB disk space
### Supported Platforms
- Native Ubuntu Linux
- Windows WSL2 with Ubuntu 22.04
## Installation (One Command)
## Installation
```bash
# Clone the repository
git clone https://git.sirblob.co/SirBlob/simulation.git
cd simulation
# Run the complete setup (installs everything)
bash setup.sh
```
The setup script installs:
- ROS 2 Humble
- Gazebo 11
- ArduPilot SITL
- ardupilot_gazebo plugin
- MAVROS
- Python dependencies
**Note**: Full installation takes 20-40 minutes depending on your internet speed.
Installation takes 20-40 minutes (builds ArduPilot from source).
## Quick Start
```bash
# Navigate to project
cd ~/simulation # or wherever you cloned it
# Activate environment (sets up ROS 2, Gazebo, ArduPilot, Python)
cd ~/simulation
source activate_venv.sh
# Run simulation
bash scripts/run_simulation.sh
```
# For WSL (if graphics issues):
For WSL with graphics issues:
```bash
bash scripts/run_simulation.sh --software-render
```
## Controlling the UAV
Once the simulation is running, control via ROS 2:
Once the simulation is running, use MAVProxy commands in the console:
```
mode guided # Switch to GUIDED mode
arm throttle # Arm the drone
takeoff 5 # Takeoff to 5 meters
guided 10 5 -10 # Fly to position (North, East, Down)
rtl # Return to launch
land # Land
```
Or via ROS 2:
```bash
# Arm the drone
# Arm
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
# Set GUIDED mode (allows position control)
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: 'GUIDED'}"
# Takeoff to 5 meters
# Takeoff
ros2 service call /mavros/cmd/takeoff mavros_msgs/srv/CommandTOL "{altitude: 5}"
# Fly to position (LOCAL coordinates - no GPS!)
# Fly to position (local coordinates)
ros2 topic pub /mavros/setpoint_position/local geometry_msgs/PoseStamped \
"{header: {frame_id: 'map'}, pose: {position: {x: 10, y: 5, z: 5}}}"
# Land
ros2 service call /mavros/cmd/land mavros_msgs/srv/CommandTOL "{}"
```
## Features
- **Iris quadcopter** with dual cameras (forward + downward)
- **Ground vehicle (UGV)** with vision sensors
- **Visual odometry** - camera-based position estimation
- **Optical flow** - velocity estimation from downward camera
- **GPS geofencing** - safety boundaries only
- **ArduPilot SITL** - real flight controller firmware
- **MAVROS** - ROS 2 interface for MAVLink
- **Multiple worlds** - indoor warehouse, urban canyon
## GPS-Denied Navigation Architecture
```
┌─────────────────────────────────────────────────────┐
│ Vision Sensors │
│ Forward Camera + Downward Camera + Optical Flow │
└─────────────────┬───────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ Visual Odometry & Feature Tracking │
│ Estimates relative position from camera motion │
└─────────────────┬───────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ Position Estimator (EKF Fusion) │
│ Fuses: Visual Odom + Optical Flow + IMU │
│ Output: Local position estimate (relative) │
└─────────────────┬───────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ ArduPilot Flight Controller │
│ Receives position via MAVROS (external nav) │
│ Controls motors based on local setpoints │
└─────────────────────────────────────────────────────┘
```
## Project Structure
```
simulation/
├── setup.sh # One-command installation
├── activate_venv.sh # Environment activation
├── scripts/
│ ├── run_simulation.sh # Launch full simulation
│ └── kill_simulation.sh # Stop all processes
├── worlds/ # Gazebo world files
├── models/ # UAV and UGV models
├── src/
│ ├── vision/ # Visual odometry, optical flow
│ ├── localization/ # EKF sensor fusion
│ ├── navigation/ # Path planning
│ ├── control/ # UAV/UGV controllers
│ └── safety/ # Geofencing
├── config/ # Configuration files
└── docs/ # Documentation
```
## Documentation
- [Setup Guide](docs/setup_guide.md) - Detailed installation
- [WSL Setup Guide](docs/wsl_setup_guide.md) - Windows WSL2
- [Usage Guide](docs/usage.md) - How to use
- [Architecture](docs/architecture.md) - System design
- [GPS-Denied Navigation](docs/gps_denied_navigation.md) - Navigation approach
- [Troubleshooting](docs/troubleshooting.md) - Common issues
## Simulation Options
```bash
# Default (ArduPilot Iris world)
# Default
bash scripts/run_simulation.sh
# Custom world
bash scripts/run_simulation.sh --world worlds/indoor_warehouse.world
bash scripts/run_simulation.sh --world iris_runway
# Rover instead of copter
bash scripts/run_simulation.sh --vehicle rover
bash scripts/run_simulation.sh --vehicle Rover
# Software rendering (WSL/no GPU)
# Software rendering (WSL)
bash scripts/run_simulation.sh --software-render
```
## Key Differences from GPS Navigation
## Uninstall
| Aspect | GPS Navigation | This Project (GPS-Denied) |
|--------|---------------|---------------------------|
| Position Source | GPS satellites | Visual odometry + sensors |
| Waypoint Type | GPS coordinates | Relative coordinates (x,y,z) |
| Reference Frame | Global (lat/lon) | Local (relative to start) |
| Indoor Capability | No | Yes |
| Drift | Minimal | Accumulates over time |
| Geofencing | GPS-based | GPS-based (safety only) |
```bash
bash scripts/uninstall.sh # Remove ArduPilot and plugin
bash scripts/uninstall.sh --all # Remove everything
```
## Documentation
- [Setup Guide](docs/setup_guide.md)
- [WSL Setup Guide](docs/wsl_setup_guide.md)
- [Usage Guide](docs/usage.md)
- [Architecture](docs/architecture.md)
- [GPS-Denied Navigation](docs/gps_denied_navigation.md)
- [Troubleshooting](docs/troubleshooting.md)