Ardupilot Install Script Fix 2
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
|
||||
## Operation Modes
|
||||
|
||||
### 1. Standalone (Any Platform)
|
||||
|
||||
Single process, no ROS 2 required:
|
||||
### 1. Standalone (Any Platform, 1 Terminal)
|
||||
|
||||
```bash
|
||||
python standalone_simulation.py --pattern circular
|
||||
@@ -13,11 +11,7 @@ python standalone_simulation.py --pattern circular
|
||||
```
|
||||
┌────────────────────────────────────────┐
|
||||
│ standalone_simulation.py │
|
||||
│ ┌──────────────────────────────────┐ │
|
||||
│ │ PyBullet Physics + Camera │ │
|
||||
│ │ Built-in Controller │ │
|
||||
│ │ Rover Movement │ │
|
||||
│ └──────────────────────────────────┘ │
|
||||
│ PyBullet Physics + Camera + Controllers│
|
||||
└────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
@@ -41,54 +35,55 @@ Terminal 1 Terminal 2
|
||||
└───────────────────┘ └───────────────────┘
|
||||
```
|
||||
|
||||
### 3. ArduPilot SITL (2 Terminals)
|
||||
### 3. ArduPilot SITL + Gazebo (2 Terminals)
|
||||
|
||||
**Terminal 1:**
|
||||
```bash
|
||||
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
|
||||
gz sim -v4 -r ~/ardupilot_gazebo/worlds/iris_runway.sdf
|
||||
```
|
||||
|
||||
**Terminal 2:**
|
||||
```bash
|
||||
mavproxy.py --console --map --master=:14550
|
||||
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
|
||||
```
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ Single Launch Command │
|
||||
│ (Starts SITL + Gazebo + RViz) │
|
||||
├─────────────────────────────────────────────┤
|
||||
│ ArduPilot SITL ◄──► Gazebo ◄──► ROS 2 │
|
||||
│ ▲ │
|
||||
│ │ /ap/* topics │
|
||||
│ ▼ │
|
||||
│ MAVProxy (GCS) │
|
||||
└─────────────────────────────────────────────┘
|
||||
Terminal 1 Terminal 2
|
||||
┌───────────────────┐ ┌───────────────────┐
|
||||
│ Gazebo + │◄──────►│ ArduPilot SITL │
|
||||
│ ArduPilot Plugin │ JSON │ + MAVProxy │
|
||||
└───────────────────┘ UDP └───────────────────┘
|
||||
```
|
||||
|
||||
**Key features:**
|
||||
- Full ArduPilot flight controller
|
||||
- EKF, stabilization, failsafes
|
||||
- MAVLink protocol
|
||||
- Compatible with QGroundControl, Mission Planner
|
||||
|
||||
## Key Components
|
||||
|
||||
| Component | Description |
|
||||
|-----------|-------------|
|
||||
| `standalone_simulation.py` | All-in-one PyBullet simulation |
|
||||
| `run_gazebo.py` | Gazebo bridge + controllers |
|
||||
| `drone_controller.py` | Your landing algorithm |
|
||||
| `gazebo_bridge.py` | Gazebo ↔ ROS bridge |
|
||||
| `mavlink_bridge.py` | MAVLink commands |
|
||||
| `camera_viewer.py` | Camera display |
|
||||
| `camera_viewer.py` | Camera display window |
|
||||
|
||||
## ROS 2 Topics
|
||||
## ROS 2 Topics (Gazebo Mode)
|
||||
|
||||
| Topic | Direction | Description |
|
||||
|-------|-----------|-------------|
|
||||
| `/drone/telemetry` | ← | Sensor data (JSON) |
|
||||
| `/cmd_vel` | → | Velocity commands |
|
||||
| `/drone/camera` | ← | Camera images |
|
||||
| `/rover/telemetry` | ← | Landing pad position |
|
||||
|
||||
## ArduPilot Topics
|
||||
## Sensors
|
||||
|
||||
| Topic | Type |
|
||||
|-------|------|
|
||||
| `/ap/pose/filtered` | Position |
|
||||
| `/ap/twist/filtered` | Velocity |
|
||||
| `/ap/imu/filtered` | IMU |
|
||||
| `/ap/battery` | Battery |
|
||||
| Sensor | Data |
|
||||
|--------|------|
|
||||
| IMU | orientation, angular_velocity |
|
||||
| Altimeter | altitude, vertical_velocity |
|
||||
| Velocity | x, y, z (m/s) |
|
||||
| Camera | 320x240 image |
|
||||
| Landing Pad | relative_x, relative_y (when visible) |
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user