1、配置MNT_MODE_IN参数后重启飞控,释放出mount的设置参数
控制信号输入为RC 则接收机必须连接对应的通道至AUX辅助通道,并通过MNT_MAN_*参数设置pitch/roll/yaw对应的AUX通道
(遥控器摇杆 → 接收机通道输出 → 飞控AUX通道输入 → AUX通道输出至云台)
如果参数值为MAVLINK_ROI,则可以通过mavlink命令实现控制;如果参数值为AUTO,则控制方式取决于上一次控制的模式。
MNT_MODE_IN输入使能后,MNT_MODE_OUT参数设置为AUX后会默认占用AUX端口1-4,此时通过AUX通道1-4输出PWM控制信号至云台,对应的RC通道映射功能失效。MNT_MODE_OUT参数设置为MAVLINK则通过MAVLINK信号控制云台,不影响AUX通道的RC通道映射功能。
PX4云台控制组合方式
1、RC控制输入 → mavlink云台控制输出
2、mavlink云台控制输入 → mavlink云台控制输出
3、RC控制输入 → PWM云台控制输出
配置方法:MNT_MODE_IN配置为AUTO或RC,MNT_MODE_OUT配置为AUX,MNT_MAN_PITCH、MNT_MAN_ROLL、MNT_MAN_YAW分别对应AUX4、AUX5、AUX6,RC_MAP_AUX4~6分别对应RC的空余三个控制channel。
4、mavlink云台控制输入 → PWM云台控制输出
配置方法:MNT_MODE_IN配置为AUTO或MAVLINK,MNT_MODE_OUT配置为AUX,MNT_MAN_PITCH、MNT_MAN_ROLL、MNT_MAN_YAW恢复默认设置,RC_MAP_AUX1~6恢复默认设置。
订阅云台实际角度:/mavros/mount_control/orientation
发布云台控制角度:/mavros/mount_control/command
通过mavros控制云台
订阅云台实际角度:/mavros/mount_control/orientation
发布云台控制角度:/mavros/mount_control/command
How it works
The mount control interface can be controlled using the mavros_msgs::MountControl message. The message sends the MAV_CMD_DO_MOUNT_CONTROL to the flight controller to control the gimbal. The message is defined as below.
# MAVLink message: DO_MOUNT_CONTROL
# https://mavlink.io/en/messages/common.html#MAV_CMD_DO_MOUNT_CONTROL
std_msgs/Header header
uint8 mode # See enum MAV_MOUNT_MODE.
uint8 MAV_MOUNT_MODE_RETRACT = 0
uint8 MAV_MOUNT_MODE_NEUTRAL = 1
uint8 MAV_MOUNT_MODE_MAVLINK_TARGETING = 2
uint8 MAV_MOUNT_MODE_RC_TARGETING = 3
uint8 MAV_MOUNT_MODE_GPS_POINT = 4
float32 pitch # roll degrees or degrees/second depending on mount mode.
float32 roll # roll degrees or degrees/second depending on mount mode.
float32 yaw # roll degrees or degrees/second depending on mount mode.
float32 altitude # altitude depending on mount mode.
float32 latitude # latitude in degrees * 1E7, set if appropriate mount mode.
float32 longitude # longitude in degrees * 1E7, set if appropriate mount mode.
The vmount mode is configured using the mavros_msgs::MountConfigure message. This message is mapped into the MAV_CMD_DO_MOUNT_CONFIGURE
# MAVLink message: DO_MOUNT_CONTROL
# https://mavlink.io/en/messages/common.html#MAV_CMD_DO_MOUNT_CONFIGURE
std_msgs/Header header
uint8 mode # See enum MAV_MOUNT_MODE.
#MAV_MOUNT_MODE
uint8 MODE_RETRACT = 0
uint8 MODE_NEUTRAL = 1
uint8 MODE_MAVLINK_TARGETING = 2
uint8 MODE_RC_TARGETING = 3
uint8 MODE_GPS_POINT = 4
bool stabilize_roll # stabilize roll? (1 = yes, 0 = no)
bool stabilize_pitch # stabilize pitch? (1 = yes, 0 = no)
bool stabilize_yaw # stabilize yaw? (1 = yes, 0 = no)
uint8 roll_input # roll input (See enum MOUNT_INPUT)
uint8 pitch_input # pitch input (See enum MOUNT_INPUT)
uint8 yaw_input # yaw input (See enum MOUNT_INPUT)
#MOUNT_INPUT
uint8 INPUT_ANGLE_BODY_FRAME = 0
uint8 INPUT_ANGULAR_RATE = 1
uint8 INPUT_ANGLE_ABSOLUTE_FRAME = 2
---
bool success
# raw result returned by COMMAND_ACK
uint8 result
云台控制插件是mount_control,运行mavros启动文件的时候需要注意该插件是否正常启动,需要在px4_pluginlists.yaml配置文件中将mount_control从blacklisted中移除后才可启动