ardupilot开发 ---测试mav_cmd篇

参考

https://ardupilot.org/dev/docs/mavlink-commands.html

通过 COMMAND_LONG 和 COMMAND_INT 发送 MAV_CMD

COMMAND_LONG消息格式:
ardupilot开发 ---测试mav_cmd篇_第1张图片
COMMAND_INT消息格式:
ardupilot开发 ---测试mav_cmd篇_第2张图片
https://mavlink.io/en/messages/common.html#COMMAND_LONG

响应:
ardupilot开发 ---测试mav_cmd篇_第3张图片

测试

格式

message COMMAND_LONG target_system(uint8_t) target_component(uint8_t) command(MAV_CMD) confirmation(uint8_t) param1(float) param2(float) param3(float) param4(float) param5(float) param6(float) param7(float)

Requesting Data From The Autopilot

目的:获取所有参数;
使用REQUEST_MESSAGE命令,通过COMMAND_LONG发送;
message COMMAND_LONG 1 0 512 0 33 0 0 0 0 0 0

Getting and Setting Parameters

Getting Parameters

Retrieving All Parameters
???
Retrieving a Parameter
???
Setting a Parameter
???

Copter Commands in Guided Mode

  • 必须要在 Guided ;
  • Movement massage
  • 基于 COMMAND_LONG 或 COMMAND_INT 的 MAV_CMDs

Movement massage

直接发送下面的massage就可以move the vehicle

  • SET_POSITION_TARGET_LOCAL_NED
  • SET_POSITION_TARGET_GLOBAL_INT
  • SET_ATTITUDE_TARGET (supported in Guided and Guided_NoGPS modes)

基于 COMMAND_LONG 或 COMMAND_INT 的 MAV_CMDs

These MAV_CMDs can be processed if packaged within a COMMAND_LONG message.
MAV_CMD_CONDITION_YAW
MAV_CMD_DO_CHANGE_SPEED
MAV_CMD_DO_FLIGHTTERMINATION - disarms motors immediately (Copter falls!).
MAV_CMD_DO_PARACHUTE
MAV_CMD_DO_SET_ROI
MAV_CMD_NAV_TAKEOFF
MAV_CMD_NAV_LOITER_UNLIM
MAV_CMD_NAV_RETURN_TO_LAUNCH
MAV_CMD_NAV_LAND
MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN
These MAV_CMDs can be processed if packaged within a COMMAND_INT message
MAV_CMD_DO_REPOSITION

步骤

  • 启动仿真器,进入guided模式并起飞;
    sim_vehicle.py -v ArduCopter --console --map --no-mavproxy
    module load message
    GUIDED
    arm throttle
    message COMMAND_LONG 1 0 22 0 0 0 0 180 -35.3631735 149.1719341 150
  • 移动到指定位置;
    message SET_POSITION_TARGET_LOCAL_NED 0 0 0 1 3576 100 0 -10 0 0 0 0 0 0 0 0

https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html

你可能感兴趣的:(Ardupilot)