← 返回 Skills 市场
luweiliao

ArduPilot Drone Control

作者 LuweiLiao · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
663
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ardupilot
功能描述
通过 pymavlink 连接并控制 ArduPilot 无人机。使用此 skill 来操作无人机起飞、降落、移动等。
使用说明 (SKILL.md)

ArduPilot 无人机控制 Skill

通过 pymavlink 连接并控制 ArduPilot 无人机 (如 CubeOrange 等)。

⚠️ 重要:起飞核心流程

起飞必须连续发送命令,不要等待!

# 1. 等待飞控稳定 (status=3)
while True:
    msg = master.wait_heartbeat(timeout=3)
    if msg and msg.system_status == 3:
        break

# 2. 连续发送:ARM → GUIDED → TAKEOFF (不要等待!)
master.mav.command_long_send(1, 1, 400, 0, 1, 21196, 0, 0, 0, 0, 0)  # ARM (force=21196)
mode_map = master.mode_mapping()
master.set_mode(mode_map['GUIDED'])  # GUIDED
master.mav.command_long_send(1, 1, 22, 0, 0, 0, 0, 0, 0, 0, 5)  # TAKEOFF 5m

# 3. 监控高度
for i in range(40):
    msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=0.5)
    if msg:
        alt = msg.relative_alt / 1000
        if alt >= 4.5:
            print('✅ 到达目标高度!')
            break

关键点

  • 发送 ARM 后立即发送 GUIDED 和 TAKEOFF,不要等待
  • 如果等待,飞控会重新上锁
  • force=21196 是 ArduPilot 的 magic value

连接

from pymavlink import mavutil

master = mavutil.mavlink_connection('tcp:localhost:5762')
master.wait_heartbeat(timeout=10)

system_id = master.target_system  # 通常是 1
component_id = master.target_component

1. 检查状态

# 获取飞控状态
msg = master.wait_heartbeat(timeout=5)
print(f'status: {msg.system_status}')  # 0=boot, 3=standby, 4=armed

# 获取高度
msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=1)
print(f'高度: {msg.relative_alt / 1000}m')

# 获取 GPS
msg = master.recv_match(type='GPS_RAW_INT', timeout=1)
print(f'GPS: {msg.satellites_visible}颗, fix={msg.fix_type}')

# 获取电池
msg = master.recv_match(type='SYS_STATUS', timeout=1)
print(f'电池: {msg.voltage_battery / 1000}V')

2. 起飞 (关键流程)

# ⚠️ 必须等待飞控稳定 (status=3)
while True:
    msg = master.wait_heartbeat(timeout=3)
    if msg and msg.system_status == 3:
        break

# ⚠️ 连续发送命令,不要等待!
master.mav.command_long_send(1, 1, 400, 0, 1, 21196, 0, 0, 0, 0, 0)  # ARM
mode_map = master.mode_mapping()
master.set_mode(mode_map['GUIDED'])  # GUIDED
master.mav.command_long_send(1, 1, 22, 0, 0, 0, 0, 0, 0, 0, 8)  # TAKEOFF 8m

# 闭环监控
for i in range(40):
    msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=0.5)
    if msg:
        alt = msg.relative_alt / 1000
        print(f'{i*0.5:.1f}s → {alt:.2f}m')
        if alt >= 7.2:  # 90% 目标
            print('✅ 到达!')
            break

3. 降落

# 切换到 LAND 模式
mode_map = master.mode_mapping()
master.set_mode(mode_map['LAND'])

# ⚠️ 必须持续发送 LAND 命令
for i in range(60):
    master.mav.command_long_send(1, 1, 21, 0, 0, 0, 0, 0, 0, 0, 0)
    import time
    time.sleep(0.5)
    
    msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=0.3)
    if msg:
        alt = msg.relative_alt / 1000
        if alt \x3C 0.3:
            print('✅ 降落完成!')
            break

4. 相对移动 (LOCAL_POSITION_NED)

# 获取当前位置
local = master.recv_match(type='LOCAL_POSITION_NED', timeout=1)

# X轴前进2米 (NED: X=北)
master.mav.set_position_target_local_ned_send(
    0, system_id, component_id,
    mavutil.mavlink.MAV_FRAME_LOCAL_NED,
    0b0000111111111000,
    local.x + 2, local.y, local.z,
    0, 0, 0, 0, 0, 0, 0, 0
)

坐标系 (NED)

  • X轴: 北 (正=北)
  • Y轴: 东 (正=东)
  • Z轴: 向下 (负值=向上=高度)

完整示例

from pymavlink import mavutil
import time

master = mavutil.mavlink_connection('tcp:localhost:5762')
master.wait_heartbeat(timeout=10)

print('=== 起飞到 5m ===')

# 1. 等待飞控稳定
while True:
    msg = master.wait_heartbeat(timeout=3)
    if msg and msg.system_status == 3:
        break
print('飞控就绪')

# 2. 连续发送: ARM → GUIDED → TAKEOFF
master.mav.command_long_send(1, 1, 400, 0, 1, 21196, 0, 0, 0, 0, 0)
mode_map = master.mode_mapping()
master.set_mode(mode_map['GUIDED'])
master.mav.command_long_send(1, 1, 22, 0, 0, 0, 0, 0, 0, 0, 5)
print('ARM + GUIDED + TAKEOFF')

# 3. 闭环监控
for i in range(40):
    msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=0.5)
    if msg:
        alt = msg.relative_alt / 1000
        print(f'{i*0.5:.1f}s → {alt:.2f}m')
        if alt >= 4.5:
            print('✅ 5m!')
            break
# === 降落 ===
mode_map = master.mode_mapping()
master.set_mode(mode_map['LAND'])

for i in range(60):
    master.mav.command_long_send(1, 1, 21, 0, 0, 0, 0, 0, 0, 0, 0)
    time.sleep(0.5)
    
    msg = master.recv_match(type='GLOBAL_POSITION_INT', timeout=0.3)
    if msg:
        alt = msg.relative_alt / 1000
        if alt \x3C 0.3:
            print('✅ 降落完成!')
            break

注意事项

  1. 起飞:连续发送命令,不要等待
  2. 降落:持续发送 LAND 命令
  3. 闭环检查:每次操作前后获取状态
  4. GUIDED 模式:自主飞行必须用 GUIDED
  5. GPS:确保 fix_type >= 3
  6. 端口:常用 TCP 5762

依赖

pip install pymavlink
安全使用建议
This skill appears to do what it says: direct control of an ArduPilot vehicle via pymavlink. Before installing or using it: 1) only use it in a safe test environment or simulator first — the instructions explicitly require immediate, repeated control commands and a hard-coded 'force' value that could be unsafe on a live drone; 2) ensure the runtime has access to the local MAVLink endpoint (TCP/serial) and that you trust the source (no homepage/source provided); 3) manually install and verify pymavlink in an isolated environment rather than auto-running unknown code; 4) review and understand each MAVLink command (ARM/TAKEOFF/LAND) and the implications of the '21196' value; and 5) don't run this against a real aircraft until you verify behavior in simulation and have safety cutoffs (kill switch, geofence, spotter).
功能分析
Type: OpenClaw Skill Name: ardupilot Version: 1.0.0 The skill bundle is designed for controlling ArduPilot drones via pymavlink. The `SKILL.md` provides clear instructions and Python code snippets for connecting to a local MAVLink instance (`tcp:localhost:5762`), checking drone status, arming, taking off, landing, and performing relative movements. There is no evidence of prompt injection against the AI agent, data exfiltration, malicious execution, persistence mechanisms, or any other harmful behavior. All actions described are consistent with the stated purpose of drone control.
能力评估
Purpose & Capability
Name/description say it controls ArduPilot via pymavlink and the SKILL.md contains only pymavlink-based MAVLink commands and connection details — these are coherent with the stated purpose.
Instruction Scope
Instructions focus on connecting to a local MAVLink endpoint (tcp:localhost:5762), sending ARM/GUIDED/TAKEOFF/LAND and monitoring telemetry; they do not read unrelated files or exfiltrate data. Notes of caution: the guide mandates continuous immediate command sending and uses a hard-coded 'magic' force value (21196), which is operationally significant and potentially unsafe if used on a real vehicle without understanding implications. The SKILL.md also tells the user to run 'pip install pymavlink' even though no install spec is declared in metadata.
Install Mechanism
This is instruction-only (no install spec, no code files) which is low risk from an installation perspective. The README requests pip installing pymavlink, but the skill metadata does not declare this dependency — a minor mismatch to be aware of but not itself malicious.
Credentials
The skill declares no environment variables or credentials, which is appropriate. It does implicitly require network/host access to connect to local MAVLink endpoints (TCP or serial) and permission to install Python packages if the operator follows the instructions.
Persistence & Privilege
always is false and the skill does not request persistent/system-wide privileges or modify other skills. The skill can be invoked autonomously (platform default), which is expected for an actionable control skill.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ardupilot
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ardupilot 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the ardupilot skill. - Provides step-by-step instructions for connecting and controlling ArduPilot drones via pymavlink. - Covers essential operations: drone status checking, arming, takeoff, relative movement, and landing. - Emphasizes critical points for reliable takeoff and landing command sequences. - Includes full usage examples and key safety notes.
元数据
Slug ardupilot
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

ArduPilot Drone Control 是什么?

通过 pymavlink 连接并控制 ArduPilot 无人机。使用此 skill 来操作无人机起飞、降落、移动等。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 663 次。

如何安装 ArduPilot Drone Control?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ardupilot」即可一键安装,无需额外配置。

ArduPilot Drone Control 是免费的吗?

是的,ArduPilot Drone Control 完全免费(开源免费),可自由下载、安装和使用。

ArduPilot Drone Control 支持哪些平台?

ArduPilot Drone Control 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 ArduPilot Drone Control?

由 LuweiLiao(@luweiliao)开发并维护,当前版本 v1.0.0。

💬 留言讨论