102 lines
1.5 KiB
Markdown
102 lines
1.5 KiB
Markdown
# ArduPilot SITL Integration
|
|
|
|
Run the simulation with a realistic ArduPilot flight controller.
|
|
|
|
## Quick Start
|
|
|
|
**Terminal 1 - Simulation:**
|
|
```bash
|
|
source ~/ardu_ws/install/setup.bash
|
|
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
|
|
```
|
|
|
|
**Terminal 2 - Control:**
|
|
```bash
|
|
mavproxy.py --console --map --master=:14550
|
|
```
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
./setup/install_ardupilot.sh
|
|
source ~/.bashrc
|
|
```
|
|
|
|
This installs:
|
|
- ArduPilot SITL with DDS
|
|
- Gazebo with ardupilot_gz
|
|
- MAVProxy
|
|
|
|
## MAVProxy Commands
|
|
|
|
```bash
|
|
# Set mode
|
|
mode guided
|
|
|
|
# Arm
|
|
arm throttle
|
|
|
|
# Takeoff
|
|
takeoff 5
|
|
|
|
# Land
|
|
mode land
|
|
```
|
|
|
|
## ROS 2 Topics
|
|
|
|
ArduPilot publishes native ROS 2 topics:
|
|
|
|
```bash
|
|
# List topics
|
|
ros2 topic list
|
|
|
|
# View position
|
|
ros2 topic echo /ap/geopose/filtered
|
|
|
|
# View battery
|
|
ros2 topic echo /ap/battery
|
|
```
|
|
|
|
| Topic | Type |
|
|
|-------|------|
|
|
| `/ap/pose/filtered` | PoseStamped |
|
|
| `/ap/twist/filtered` | TwistStamped |
|
|
| `/ap/imu/filtered` | Imu |
|
|
| `/ap/battery` | BatteryState |
|
|
|
|
## Available Worlds
|
|
|
|
```bash
|
|
# Iris on runway
|
|
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
|
|
|
|
# Iris in maze
|
|
ros2 launch ardupilot_gz_bringup iris_maze.launch.py
|
|
|
|
# Rover
|
|
ros2 launch ardupilot_gz_bringup wildthumper_playpen.launch.py
|
|
```
|
|
|
|
## Using the Launcher
|
|
|
|
```bash
|
|
python run_ardupilot.py --world runway
|
|
python run_ardupilot.py --world maze
|
|
python run_ardupilot.py --vehicle rover
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
**No ROS 2 topics:**
|
|
```bash
|
|
# Check DDS is enabled
|
|
param set DDS_ENABLE 1
|
|
```
|
|
|
|
**Can't arm:**
|
|
```bash
|
|
# Disable pre-arm checks (simulation only)
|
|
param set ARMING_CHECK 0
|
|
```
|