UAV 类型定义
类型定义的头文件为 uav_typedef.h
,本文档描述了 uav_typedef.h
文件中宏定义和结构体的关键信息和使用方法。
宏定义
- 圆周率
#define UAV_PI (3.14159265358979323846f)
类型
- 双精度浮点类型
typedef double uav_f64_t;
- 单精度浮点类型
typedef float uav_f32_t;
- 返回值类型 可以取 UAV 错误码中的任意值。
typedef uint64_t T_UAVReturnCode;
枚举值
typedef enum E_UAVMountPositionType
- 安装位置类型
typedef enum {
UAV_MOUNT_POSITION_TYPE_UNKNOWN = 0,
UAV_MOUNT_POSITION_TYPE_PAYLOAD_PORT = 1,
UAV_MOUNT_POSITION_TYPE_EXTENSION_PORT = 2,
UAV_MOUNT_POSITION_TYPE_EXTENSION_LITE_PORT = 3
} E_UAVMountPositionType;
typedef enum E_UAVMountPosition
- 安装位置
typedef enum {
UAV_MOUNT_POSITION_UNKNOWN = 0,
UAV_MOUNT_POSITION_PAYLOAD_PORT_NO1 = 1,
UAV_MOUNT_POSITION_PAYLOAD_PORT_NO2 = 2,
UAV_MOUNT_POSITION_PAYLOAD_PORT_NO3 = 3,
} E_UAVMountPosition;
typedef enum E_UAVDataSubscriptionTopicFrequency
- 订阅频率类型
typedef enum {
UAV_DATA_SUBSCRIPTION_TOPIC_1_HZ = 1, /*!< 1Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_5_HZ = 5, /*!< 5Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_10_HZ = 10, /*!< 10Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_20_HZ = 20, /*!< 20Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_50_HZ = 50, /*!< 50Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_100_HZ = 100, /*!< 100Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_200_HZ = 200, /*!< 200Hz */
UAV_DATA_SUBSCRIPTION_TOPIC_400_HZ = 400, /*!< 400Hz */
}E_UAVDataSubscriptionTopicFrequency;
typedef enum E_UAVGimbalMode
- 云台模式
typedef enum {
UAV_GIMBAL_MODE_FREE = 0, /*!< Free mode, fix gimbal attitude in the ground coordinate, ignoring movement of aircraft. */
UAV_GIMBAL_MODE_FPV = 1, /*!< FPV (First Person View) mode, only control roll and yaw angle of gimbal in the ground coordinate to follow aircraft. */
UAV_GIMBAL_MODE_YAW_FOLLOW = 2, /*!< Yaw follow mode, only control yaw angle of gimbal in the ground coordinate to follow aircraft. */
} E_UAVGimbalMode;
typedef enum E_UAVGimbalRotationMode
- 云台旋转模式
typedef enum {
UAV_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE = 0, /*!< Relative angle rotation mode, represents rotating gimbal specified angles based on current angles. */
UAV_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE = 1, /*!< Absolute angle rotation mode, represents rotating gimbal to specified angles in the ground coordinate. */
UAV_GIMBAL_ROTATION_MODE_SPEED = 2, /*!< Speed rotation mode, specifies rotation speed of gimbal in the ground coordinate. */
} E_UAVGimbalRotationMode;
typedef enum E_UAVCameraType
- 相机类型
typedef enum {
UAV_CAMERA_TYPE_UNKNOWN = 0, /*!< Camera type is unknown. */
UAV_CAMERA_TYPE_XL801 = 1, /*!< Camera type is XL801. */
UAV_CAMERA_TYPE_XL802 = 2, /*!< Camera type is XL802. */
UAV_CAMERA_TYPE_XL806 = 6, /*!< Camera type is XL806. */
UAV_CAMERA_TYPE_XL807 = 7, /*!< Camera type is XL807. */
UAV_CAMERA_TYPE_XL809 = 9, /*!< Camera type is XL809. */
UAV_CAMERA_TYPE_XL811 = 11, /*!< Camera type is XL811. */
UAV_CAMERA_TYPE_XL813 = 13, /*!< Camera type is XL813. */
UAV_CAMERA_TYPE_Z30 = 20, /*!< Camera type is Z30. */
UAV_CAMERA_TYPE_XT2 = 26, /*!< Camera type is XT2. */
UAV_CAMERA_TYPE_PSDK = 31, /*!< Camera type is third party camera based on Payload SDK. */
UAV_CAMERA_TYPE_XTS = 41, /*!< Camera type is XT S. */
UAV_CAMERA_TYPE_H20 = 42, /*!< Camera type is H20. */
UAV_CAMERA_TYPE_H20T = 43, /*!< Camera type is H20T. */
UAV_CAMERA_TYPE_H20N = 61, /*!< Camera type is H20N. */
UAV_CAMERA_TYPE_P1 = 50, /*!< Camera type is P1. */
UAV_CAMERA_TYPE_L1, /*!< Camera type is L1. */
UAV_CAMERA_TYPE_L2, /*!< Camera type is L2. */
UAV_CAMERA_TYPE_M30, /*!< Camera type is M30. */
UAV_CAMERA_TYPE_M30T, /*!< Camera type is M30T. */
UAV_CAMERA_TYPE_M3E, /*!< Camera type is M3E. */
UAV_CAMERA_TYPE_M3T, /*!< Camera type is M3T. */
UAV_CAMERA_TYPE_M3D, /*!< Camera type is Matrice 3D. */
UAV_CAMERA_TYPE_M3TD, /*!< Camera type is Matrice 3TD. */
UAV_CAMERA_TYPE_XL865 = 65, /*!< Camera type is XL865. */
UAV_CAMERA_TYPE_XL866 = 66, /*!< Camera type is XL866. */
UAV_CAMERA_TYPE_DH901 = 101, /*!< Camera type is DH901. */
UAV_CAMERA_TYPE_XT701 = 201, /*!< Camera type is XT701. */
UAV_CAMERA_TYPE_XT705 = 205, /*!< Camera type is XT705. */
UAV_CAMERA_TYPE_XT706 = 206, /*!< Camera type is XT706. */
UAV_CAMERA_TYPE_XT709 = 209, /*!< Camera type is XT709. */
UAV_CAMERA_TYPE_XT729 = 229, /*!< Camera type is XT729. */
UAV_CAMERA_TYPE_XL719 = 319, /*!< Camera type is XL719. */
UAV_CAMERA_TYPE_XL720 = 320, /*!< Camera type is XL720. */
UAV_CAMERA_TYPE_XL723 = 323, /*!< Camera type is XL723. */
UAV_CAMERA_TYPE_XL724 = 324, /*!< Camera type is XL724. */
UAV_CAMERA_TYPE_XL709 = 409, /*!< Camera type is XL709. */
UAV_CAMERA_TYPE_XL705 = 405, /*!< Camera type is XL705. */
UAV_CAMERA_TYPE_XL725 = 425, /*!< Camera type is XL725. */
UAV_CAMERA_TYPE_XL726 = 426, /*!< Camera type is XL726. */
UAV_CAMERA_TYPE_XL729 = 429, /*!< Camera type is XL729. */
UAV_CAMERA_TYPE_XL730 = 530, /*!< Camera type is XL730. */
UAV_CAMERA_TYPE_XL735 = 535, /*!< Camera type is XL735. */
UAV_CAMERA_TYPE_XL750 = 650, /*!< Camera type is XL750. */
UAV_CAMERA_TYPE_XL751 = 651, /*!< Camera type is XL751. */
UAV_CAMERA_TYPE_XL752 = 652, /*!< Camera type is XL752. */
UAV_CAMERA_TYPE_XL753 = 653, /*!< Camera type is XL753. */
UAV_CAMERA_TYPE_XL715 = 715, /*!< Camera type is XL715. */
UAV_CAMERA_TYPE_XL731 = 731, /*!< Camera type is XL731. */
UAV_CAMERA_TYPE_XL732 = 832, /*!< Camera type is XL732. */
UAV_CAMERA_TYPE_XL736 = 836, /*!< Camera type is XL736. */
UAV_CAMERA_TYPE_XT708 = 908, /*!< Camera type is XL708. */
UAV_CAMERA_TYPE_XT711 = 911, /*!< Camera type is XL711. */
UAV_CAMERA_TYPE_XT713 = 913, /*!< Camera type is XL713. */
UAV_CAMERA_TYPE_XT714 = 914, /*!< Camera type is XL714. */
UAV_CAMERA_TYPE_XT717 = 917, /*!< Camera type is XL717. */
UAV_CAMERA_TYPE_XL718 = 918, /*!< Camera type is XL718. */
UAV_CAMERA_TYPE_DF725 = 1025, /*!< Camera type is DF725. */
} E_UAVCameraType;
typedef enum E_UAVCameraMediaFileType
- 相机媒体文件类型
typedef enum {
UAV_CAMERA_FILE_TYPE_JPEG = 0, /*!< Media file JPEG type. */
UAV_CAMERA_FILE_TYPE_DNG = 1, /*!< Media file DNG type. */
UAV_CAMERA_FILE_TYPE_MOV = 2, /*!< Media file MOV type. */
UAV_CAMERA_FILE_TYPE_MP4 = 3, /*!< Media file MP4 type. */
UAV_CAMERA_FILE_TYPE_TIFF = 5, /*!< Media file TIFF type. */
UAV_CAMERA_FILE_TYPE_PCD = 24, /*!< Media file point cloud type. */
UAV_CAMERA_FILE_TYPE_UNKNOWN = 255, /*!< Media file unknown type. */
} E_UAVCameraMediaFileType;
typedef enum E_UAVCameraZoomSpeed
- 相机变焦速度
typedef enum {
UAV_CAMERA_ZOOM_SPEED_SLOWEST = 72, /*!< Lens zooms in slowest speed. */
UAV_CAMERA_ZOOM_SPEED_SLOW = 73, /*!< Lens zooms in slow speed. */
UAV_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, /*!< Lens zooms in speed slightly slower than normal speed. */
UAV_CAMERA_ZOOM_SPEED_NORMAL = 75, /*!< Lens zooms in normal speed. */
UAV_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, /*!< Lens zooms very in speed slightly faster than normal speed. */
UAV_CAMERA_ZOOM_SPEED_FAST = 77, /*!< Lens zooms very in fast speed. */
UAV_CAMERA_ZOOM_SPEED_FASTEST = 78, /*!< Lens zooms very in fastest speed. */
} E_UAVCameraZoomSpeed;
typedef enum E_UAVCameraBurstCount
- 相机连拍计数
typedef enum {
/*! The number of pictures to continuously take each time in BURST mode is 2
*/
UAV_CAMERA_BURST_COUNT_2 = 2,
/*! The number of pictures to continuously take each time in BURST mode is 3
*/
UAV_CAMERA_BURST_COUNT_3 = 3,
/*! The number of pictures to continuously take each time in BURST mode is 5
*/
UAV_CAMERA_BURST_COUNT_5 = 5,
/*! The number of pictures to continuously take each time in BURST mode is 7
*/
UAV_CAMERA_BURST_COUNT_7 = 7,
/*! The number of pictures to continuously take at one time in BURST mode is
* 10, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera.
*/
UAV_CAMERA_BURST_COUNT_10 = 10,
/*! The number of pictures to continuously take at one time in BURST mode is
* 14, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera.
*/
UAV_CAMERA_BURST_COUNT_14 = 14,
/*! The camera burst shoot count value is unknown.
*/
UAV_CAMERA_BURST_COUNT_KNOWN = 0xFF,
} E_UAVCameraBurstCount;
typedef enum E_UAVCameraZoomDirection
- 相机变焦方向
typedef enum {
UAV_CAMERA_ZOOM_DIRECTION_OUT = 0, /*!< The lens moves in the far direction, the zoom factor becomes smaller. */
UAV_CAMERA_ZOOM_DIRECTION_IN = 1, /*!< The lens moves in the near direction, the zoom factor becomes larger. */
} E_UAVCameraZoomDirection;
结构体
typedef struct T_UAVCameraOpticalZoomSpec
- 相机变焦速度
typedef struct {
uint16_t maxFocalLength; /*!< The maximum focal length of the lens, unit: 0.1mm. */
uint16_t minFocalLength; /*!< The minimum focal length of the lens, unit: 0.1mm. */
uint16_t focalLengthStep; /*!< The minimum interval of focal length change, unit: 0.1mm. */
} T_UAVCameraOpticalZoomSpec;
typedef struct T_UAVCameraPointInScreen
- 对焦模式下的相机对焦目标点
typedef struct {
uav_f32_t focusX; /*!< Specifies horizontal zone coordinate. This parameter is between 0 and 1.
The point [0.0, 0.0] represents the top-left angle of the screen.*/
uav_f32_t focusY; /*!< Specifies vertical zone coordinate. This parameter is between 0 and 1. */
} T_UAVCameraPointInScreen;
typedef struct T_UAVCameraPhotoTimeIntervalSettings
- 在间隔拍照模式下的相机时间间隔设置
typedef struct {
uint8_t captureCount; /*!< Specifies the total capture count of interval settings.
* 0:reserve 1~254:number 255:keep capturing till stop */
uint16_t timeIntervalSeconds; /*!< Specifies the interval time between two captures, unit: s*/
} T_UAVCameraPhotoTimeIntervalSettings;
typedef struct T_UAVDataChannelState
- 数据通道状态
typedef struct {
/*! Realtime bandwidth limitation, varying with link status of aircraft system for some channels, such as data
* stream, video stream and download stream. Must ensure actual bandwidth of data transmission is less than
* realtime bandwidth limitation, unit: byte/s. */
int32_t realtimeBandwidthLimit;
/*! Realtime actual transmission bandwidth of data transmission channel calculated before flow controller, unit: byte/s. */
int32_t realtimeBandwidthBeforeFlowController;
/*! Realtime actual transmission bandwidth of data transmission channel calculated after flow controller, unit:
* byte/s. If specified channel without flow controller. the value is equal to
* ::realtimeBandwidthBeforeFlowController. */
int32_t realtimeBandwidthAfterFlowController;
/*! State specified whether the channel is busy or not. When data can not be sent to the endpoint directly, instead be
* sent to buffer of flow controller or discarded, the busy state will be set. At this time, the user should stop
* transmitting data or decrease the amount of data to be transmitted via this channel. When data bandwidth restore to
* normal, this state will be clear again. */
bool busyState;
} T_UAVDataChannelState;
typedef struct T_UAVVector3d
- 定义空间向量的数据类型
typedef struct Vector3d {
int32_t x; /*!< Specifies int32 value of x for vector. */
int32_t y; /*!< Specifies int32 value of y for vector. */
int32_t z; /*!< Specifies int32 value of z for vector. */
}T_UAVVector3d;
typedef struct T_UAVVector3f
typedef struct Vector3f {
float x; /*!< Specifies float value of x for vector. */
float y; /*!< Specifies float value of y for vector. */
float z; /*!< Specifies float value of z for vector. */
}T_UAVVector3f;
typedef struct T_UAVAttitude3d
typedef struct {
int32_t pitch; /*!< Specifies int32 value of pitch for attitude. */
int32_t roll; /*!< Specifies int32 value of roll for attitude. */
int32_t yaw; /*!< Specifies int32 value of yaw for attitude. */
}T_UAVAttitude3d;
typedef struct T_UAVAttitude3d
typedef struct {
int32_t pitch; /*!< Specifies int32 value of pitch for attitude. */
int32_t roll; /*!< Specifies int32 value of roll for attitude. */
int32_t yaw; /*!< Specifies int32 value of yaw for attitude. */
}T_UAVAttitude3d;
typedef struct T_UAVAttitude3f
typedef struct {
float pitch; /*!< Specifies float value of pitch for attitude. */
float roll; /*!< Specifies float value of roll for attitude. */
float yaw; /*!< Specifies float value of yaw for attitude. */
}T_UAVAttitude3f;
typedef struct T_UAVQuaternion4f
- 四元数数据结构
typedef struct {
float q0; /*!< w, when converted to a rotation matrix or Euler angles. */
float q1; /*!< x, when converted to a rotation matrix or Euler angles. */
float q2; /*!< y, when converted to a rotation matrix or Euler angles. */
float q3; /*!< z, when converted to a rotation matrix or Euler angles. */
}T_UAVQuaternion4f;
typedef struct T_UAVDataTimestamp
- 时间戳数据结构
typedef struct {
int64_t millisecond; /*!< Specifies the milli seconds part of the timestamp. */
int32_t microsecond; /*!< Specifies the micro seconds part of the timestamp. */
}T_UAVDataTimestamp;
typedef struct T_UAVFirmwareVersion
- 版本号数据结构
typedef struct {
uint8_t majorVersion; /*!< The major version of firmware, the range is 0 ~ 99. */
uint8_t minorVersion; /*!< The minor version of firmware, the range is 0 ~ 99. */
uint8_t modifyVersion; /*!< The modify version of firmware, the range is 0 ~ 99. */
uint8_t debugVersion; /*!< The debug version of firmware, the range is 0 ~ 99. */
char *boot_version; /*!< The bootload version of fimware. rtos*/
char *hw_version; /*!< The hardware version of payload. rtos*/
} T_UAVFirmwareVersion;