云台管理
宏定义
定义云台管理旋转属性:
typedef struct {
E_UAVGimbalRotationMode rotationMode; /*!< Rotation gimbal mode. */
float pitch; /*!< Pitch angle in degree, unit: deg */
float roll; /*!< Roll angle in degree, unit: deg */
float yaw; /*!< Yaw angle in degree, unit: deg */
int64_t time; /*!< Expect execution time of gimbal rotation, unit: second. */
} T_UAVGimbalManagerRotation;
函数原型
UAV_GimbalManager_Init
- 功能: 初始化云台管理模块。
注意:
- 请在
UAV_Core_Init()
之后初始化次接口。
- 请在
T_UAVReturnCode UAV_GimbalManager_Init(void)
UAV_GimbalManager_Deinit
- 功能: 反初始化云台管理模块。
T_UAVReturnCode UAV_GimbalManager_Deinit(void)
UAV_GimbalManager_SetMode
- 功能: 设置云台工作模式。
T_UAVReturnCode UAV_GimbalManager_SetMode(E_UAVGimbalMode mode)
- 参数
mode
:云台工作模式,输入限制参见E_UAVGimbalMode
。
UAV_GimbalManager_Reset
- 功能: 重置云台的俯仰和偏航角。
T_UAVReturnCode UAV_GimbalManager_Reset(E_UAVGimbalResetMode resetMode)
- 参数
mode
:重置模式,输入限制参见E_UAVGimbalResetMode
。
UAV_GimbalManager_Rotate
- 功能: 旋转云台角度。
T_UAVReturnCode UAV_GimbalManager_Rotate(T_UAVGimbalManagerRotation rotation)
- 参数
rotation
:执行目标云台上的旋转参数,包括旋转模式、目标角度值和执行时间,参见T_UAVGimbalManagerRotation
。mountPosition
:云台安装位置,输入限制参见E_UAVMountPosition
。
UAV_GimbalManager_SetPitchRangeExtensionEnabled
- 功能: 设置云台控制器的最大速度百分比。
T_UAVReturnCode UAV_GimbalManager_SetPitchRangeExtensionEnabled(bool enabledFlag)
- 参数
enabledFlag
:指定是否启用或禁用云台俯仰限位扩展。
UAV_GimbalManager_SetControllerMaxSpeedPercentage
- 功能: 设置云台控制器的最大速度百分比。
T_UAVReturnCode UAV_GimbalManager_SetControllerMaxSpeedPercentage(E_UAVGimbalAxis axis, uint8_t maxSpeedPercentage)
- 参数
maxSpeedPercentage
:最大速度值,建议计算公式为 "spd = default_max_spd * x / 100",x 为默认最大速度值。范围从 1 到 100。axis
:要设置的轴。
UAV_GimbalManager_SetControllerSmoothFactor
- 功能: 设置云台控制器的平滑因子。
T_UAVReturnCode UAV_GimbalManager_SetControllerSmoothFactor(E_UAVGimbalAxis axis, uint8_t smoothingFactor)
- 参数
smoothingFactor
:平滑因子,值越大,云台转动加速度越小。建议计算公式为 "acc = 10000 * (0.8 ^ (1 + x)) deg/s^2", x 为平滑因子,范围从 1 到 30。axis
:要设置的轴。
UAV_GimbalManager_RestoreFactorySettings
- 功能: 恢复云台的出厂设置。
T_UAVReturnCode UAV_GimbalManager_RestoreFactorySettings()