Scripts Update
This commit is contained in:
211
docs/usage.md
211
docs/usage.md
@@ -1,151 +1,136 @@
|
||||
# Usage Guide
|
||||
|
||||
## Quick Start
|
||||
How to run and control the simulation.
|
||||
|
||||
## Starting the Simulation
|
||||
|
||||
```bash
|
||||
# 1. Navigate to project
|
||||
cd ~/ros2_ws/src/uav_ugv_simulation
|
||||
|
||||
# 2. Activate environment
|
||||
cd ~/simulation
|
||||
source activate_venv.sh
|
||||
|
||||
# 3. Run simulation
|
||||
bash scripts/run_simulation.sh
|
||||
```
|
||||
|
||||
## Launch Options
|
||||
This launches:
|
||||
1. Gazebo with the drone model
|
||||
2. ArduPilot SITL (flight controller)
|
||||
3. MAVProxy console (for commands)
|
||||
|
||||
## Simulation Options
|
||||
|
||||
### Full Simulation (UAV + UGV)
|
||||
```bash
|
||||
ros2 launch uav_ugv_simulation full_simulation.launch.py
|
||||
# Default (iris_runway world)
|
||||
bash scripts/run_simulation.sh
|
||||
|
||||
# Specific world
|
||||
bash scripts/run_simulation.sh --world iris_runway
|
||||
|
||||
# Rover instead of copter
|
||||
bash scripts/run_simulation.sh --vehicle Rover
|
||||
|
||||
# Software rendering (for WSL or no GPU)
|
||||
bash scripts/run_simulation.sh --software-render
|
||||
|
||||
# Show available options
|
||||
bash scripts/run_simulation.sh --help
|
||||
```
|
||||
|
||||
### UAV Only
|
||||
```bash
|
||||
ros2 launch uav_ugv_simulation uav_only.launch.py
|
||||
## Controlling the UAV
|
||||
|
||||
### MAVProxy Console
|
||||
|
||||
The simulation opens a MAVProxy console. Commands:
|
||||
|
||||
```
|
||||
mode guided # Switch to GUIDED mode (required for commands)
|
||||
arm throttle # Arm motors
|
||||
takeoff 5 # Takeoff to 5 meters altitude
|
||||
|
||||
# Fly to position (North, East, Down in meters)
|
||||
guided 10 0 -5 # 10m north, 0m east, 5m altitude
|
||||
guided 10 10 -5 # 10m north, 10m east, 5m altitude
|
||||
guided 0 0 -5 # Return to origin at 5m altitude
|
||||
|
||||
rtl # Return to launch
|
||||
land # Land at current position
|
||||
disarm # Disarm motors (after landing)
|
||||
```
|
||||
|
||||
### UGV Only
|
||||
### ROS 2 Interface
|
||||
|
||||
If MAVROS is running, control via ROS 2:
|
||||
|
||||
```bash
|
||||
ros2 launch uav_ugv_simulation ugv_only.launch.py
|
||||
```
|
||||
# Arm
|
||||
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
|
||||
|
||||
### 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'"
|
||||
# Set GUIDED mode
|
||||
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: 'GUIDED'}"
|
||||
|
||||
# Takeoff
|
||||
ros2 topic pub /uav/controller/command std_msgs/String "data: 'takeoff'"
|
||||
ros2 service call /mavros/cmd/takeoff mavros_msgs/srv/CommandTOL "{altitude: 5}"
|
||||
|
||||
# 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}}}"
|
||||
# Fly to position (local frame, meters)
|
||||
ros2 topic pub /mavros/setpoint_position/local geometry_msgs/PoseStamped \
|
||||
"{header: {frame_id: 'map'}, pose: {position: {x: 10, y: 5, z: 5}}}"
|
||||
|
||||
# Land
|
||||
ros2 topic pub /uav/controller/command std_msgs/String "data: 'land'"
|
||||
ros2 service call /mavros/cmd/land mavros_msgs/srv/CommandTOL "{}"
|
||||
```
|
||||
|
||||
### UGV Commands
|
||||
### Monitoring
|
||||
|
||||
```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
|
||||
# List topics
|
||||
ros2 topic list
|
||||
|
||||
# UAV status
|
||||
ros2 topic echo /uav/controller/status
|
||||
# View position
|
||||
ros2 topic echo /mavros/local_position/pose
|
||||
|
||||
# Visual odometry pose
|
||||
ros2 topic echo /uav/visual_odometry/pose
|
||||
# View velocity
|
||||
ros2 topic echo /mavros/local_position/velocity_local
|
||||
|
||||
# Geofence status
|
||||
ros2 topic echo /geofence/status
|
||||
# View IMU
|
||||
ros2 topic echo /mavros/imu/data
|
||||
```
|
||||
|
||||
### View Camera Feeds
|
||||
```bash
|
||||
# Using rqt_image_view
|
||||
ros2 run rqt_image_view rqt_image_view
|
||||
## Flight Modes
|
||||
|
||||
# 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
|
||||
```
|
||||
| Mode | Description |
|
||||
|------|-------------|
|
||||
| STABILIZE | Manual control with attitude stabilization |
|
||||
| ALT_HOLD | Maintain altitude, manual position |
|
||||
| LOITER | Hold position and altitude |
|
||||
| GUIDED | Accept position commands |
|
||||
| AUTO | Follow pre-planned mission |
|
||||
| RTL | Return to launch point |
|
||||
| LAND | Controlled descent and landing |
|
||||
|
||||
## Stopping the Simulation
|
||||
|
||||
```bash
|
||||
# Graceful shutdown
|
||||
Ctrl+C
|
||||
Press `Ctrl+C` in the terminal running the simulation.
|
||||
|
||||
# Force kill all processes
|
||||
Or run:
|
||||
```bash
|
||||
bash scripts/kill_simulation.sh
|
||||
```
|
||||
|
||||
## Camera Topics
|
||||
|
||||
The UAV has two cameras:
|
||||
|
||||
```bash
|
||||
# Forward camera (visual odometry)
|
||||
ros2 topic echo /uav/camera/forward/image_raw
|
||||
|
||||
# Downward camera (optical flow)
|
||||
ros2 topic echo /uav/camera/downward/image_raw
|
||||
```
|
||||
|
||||
## GPS-Denied Navigation
|
||||
|
||||
All position commands use local coordinates (meters from takeoff point):
|
||||
- X: North
|
||||
- Y: East
|
||||
- Z: Up (or Down for NED frame)
|
||||
|
||||
GPS is only used for geofencing boundaries, not for navigation.
|
||||
|
||||
Reference in New Issue
Block a user