Ardupilot Install Script Fix 2

This commit is contained in:
2026-01-04 00:49:28 +00:00
parent 23c619c4dd
commit 40286fa90c
4 changed files with 170 additions and 260 deletions

View File

@@ -2,17 +2,16 @@
Run the simulation with a realistic ArduPilot flight controller.
## Quick Start
## Quick Start (2 Terminals)
**Terminal 1 - Simulation:**
**Terminal 1 - Gazebo:**
```bash
source ~/ardu_ws/install/setup.bash
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
gz sim -v4 -r ~/ardupilot_gazebo/worlds/iris_runway.sdf
```
**Terminal 2 - Control:**
**Terminal 2 - SITL + MAVProxy:**
```bash
mavproxy.py --console --map --master=:14550
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
```
## Installation
@@ -23,79 +22,81 @@ source ~/.bashrc
```
This installs:
- ArduPilot SITL with DDS
- Gazebo with ardupilot_gz
- ArduPilot SITL
- Gazebo Harmonic
- ardupilot_gazebo plugin
- MAVProxy
## MAVProxy Commands
Once `sim_vehicle.py` is running:
```bash
# Set mode
# Set GUIDED mode
mode guided
# Arm
arm throttle
# Takeoff
# Takeoff to 5m
takeoff 5
# Land
mode land
# Disarm
disarm
```
## 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
gz sim -v4 -r ~/ardupilot_gazebo/worlds/iris_runway.sdf
# Iris in maze
ros2 launch ardupilot_gz_bringup iris_maze.launch.py
# Rover
ros2 launch ardupilot_gz_bringup wildthumper_playpen.launch.py
# Zephyr plane
gz sim -v4 -r ~/ardupilot_gazebo/worlds/zephyr_runway.sdf
```
## Using the Launcher
## Standalone SITL (No Gazebo)
```bash
python run_ardupilot.py --world runway
python run_ardupilot.py --world maze
python run_ardupilot.py --vehicle rover
sim_vehicle.py -v ArduCopter --console --map
```
This opens a 2D map view for testing without Gazebo.
## How It Works
```
Gazebo ArduPilot SITL
┌─────────────────┐ ┌─────────────────┐
│ iris_runway.sdf │◄────►│ sim_vehicle.py │
│ + ArduPilot │ JSON │ + MAVProxy │
│ Plugin │ UDP │ │
└─────────────────┘ └─────────────────┘
▼ MAVLink
Your Controller
```
The ArduPilot Gazebo plugin communicates with SITL via JSON over UDP.
## Troubleshooting
**No ROS 2 topics:**
**sim_vehicle.py not found:**
```bash
# Check DDS is enabled
param set DDS_ENABLE 1
export PATH=$PATH:~/ardupilot/Tools/autotest
```
**Plugin not loading:**
```bash
export GZ_SIM_SYSTEM_PLUGIN_PATH=~/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH
export GZ_SIM_RESOURCE_PATH=~/ardupilot_gazebo/models:~/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH
```
**Can't arm:**
```bash
# Disable pre-arm checks (simulation only)
# In MAVProxy, disable pre-arm checks
param set ARMING_CHECK 0
```