Files
simulation/docs/usage.md
2026-02-09 03:39:49 +00:00

152 lines
2.7 KiB
Markdown

# Usage Guide
## Quick Start
```bash
# 1. Navigate to project
cd ~/ros2_ws/src/uav_ugv_simulation
# 2. Activate environment
source activate_venv.sh
# 3. Run simulation
bash scripts/run_simulation.sh
```
## Launch Options
### Full Simulation (UAV + UGV)
```bash
ros2 launch uav_ugv_simulation full_simulation.launch.py
```
### UAV Only
```bash
ros2 launch uav_ugv_simulation uav_only.launch.py
```
### UGV Only
```bash
ros2 launch uav_ugv_simulation ugv_only.launch.py
```
### Different Worlds
```bash
# Indoor warehouse (GPS-denied)
bash scripts/run_simulation.sh worlds/indoor_warehouse.world
# Urban canyon (GPS-degraded)
bash scripts/run_simulation.sh worlds/urban_canyon.world
```
## Interacting with Vehicles
### UAV Commands
```bash
# Arm the vehicle
ros2 topic pub /uav/controller/command std_msgs/String "data: 'arm'"
# Takeoff
ros2 topic pub /uav/controller/command std_msgs/String "data: 'takeoff'"
# Go to waypoint (local coordinates)
ros2 topic pub /uav/setpoint_position geometry_msgs/PoseStamped \
"{header: {frame_id: 'odom'}, pose: {position: {x: 10.0, y: 5.0, z: 5.0}}}"
# Land
ros2 topic pub /uav/controller/command std_msgs/String "data: 'land'"
```
### UGV Commands
```bash
# Go to goal (local coordinates)
ros2 topic pub /ugv/goal_pose geometry_msgs/PoseStamped \
"{header: {frame_id: 'odom'}, pose: {position: {x: 5.0, y: 3.0, z: 0.0}}}"
# Stop
ros2 topic pub /ugv/controller/command std_msgs/String "data: 'stop'"
```
## Mission Planner
### Load Demo Mission
```bash
ros2 topic pub /mission/command std_msgs/String "data: 'load'"
```
### Start Mission
```bash
ros2 topic pub /mission/command std_msgs/String "data: 'start'"
```
### Pause/Resume
```bash
ros2 topic pub /mission/command std_msgs/String "data: 'pause'"
ros2 topic pub /mission/command std_msgs/String "data: 'resume'"
```
## Monitoring
### View Topics
```bash
# List all topics
ros2 topic list
# UAV status
ros2 topic echo /uav/controller/status
# Visual odometry pose
ros2 topic echo /uav/visual_odometry/pose
# Geofence status
ros2 topic echo /geofence/status
```
### View Camera Feeds
```bash
# Using rqt_image_view
ros2 run rqt_image_view rqt_image_view
# Select topics:
# /uav/camera/forward/image_raw
# /uav/camera/downward/image_raw
```
### Visualization
```bash
# RViz
rviz2
# Add displays for:
# - TF
# - Camera
# - Path
# - Marker (geofence)
```
## Configuration
### Modify Parameters
Edit YAML files in `config/` directory:
- `uav_params.yaml` - UAV settings
- `geofence_params.yaml` - Safety boundaries
- `mavros_params.yaml` - MAVROS connection
### Runtime Parameter Changes
```bash
ros2 param set /uav/visual_odom_node max_features 500
```
## Stopping the Simulation
```bash
# Graceful shutdown
Ctrl+C
# Force kill all processes
bash scripts/kill_simulation.sh
```