mavlink id 11 SET_MODE
执行任务功能:确保已上传任务内容后,将此消息将custom_mode设为任务模式并发送给无人机。
python测试脚本
import time
import sys
from pymavlink import mavutil
mode_map = {
"MANUAL": 0x00010000,
"POSCTL": 0x00030000,
"AUTO_RTL": 0x05040000,
"AUTO_MISSION": 0x04040000,
}# 仅列举部分模式
connection = mavutil.mavlink_connection('udp:127.0.0.1:14550')
connection .wait_heartbeat()
target_system = 1
target_component = 1
custom_mode = mode_map["AUTO_MISSION"] # 任务模式
# 发送SET_MODE消息
connection.mav.set_mode_send(
target_system,
target_component,
0,
custom_mode
)作者:sfd 创建时间:2026-03-10 14:41
最后编辑:sfd 更新时间:2026-03-10 17:13
最后编辑:sfd 更新时间:2026-03-10 17:13