152 lines
6.8 KiB
C
152 lines
6.8 KiB
C
|
|
#ifndef GIMBALINFO_H
|
|||
|
|
#define GIMBALINFO_H
|
|||
|
|
|
|||
|
|
#include <QObject>
|
|||
|
|
#include "GDUModule/glink/glink_m/glink_m.h"
|
|||
|
|
#include "GDUModule/glink/glink_np/glink_np.h"
|
|||
|
|
/******************************************************************************************
|
|||
|
|
* @Copyright: Copyright (c) 2015 GDU Technology(Shenzhen) Co., Ltd. All rights reserved.
|
|||
|
|
* @ProjName: qgroundcontrol
|
|||
|
|
* @FileName: Gimbalinfo.h
|
|||
|
|
* @Description: 云台控制协议,周期上报消息云台状态消息及云台姿态消息
|
|||
|
|
* @Author: xutie
|
|||
|
|
* @Date: 2021-12-14
|
|||
|
|
*******************************************************************************************/
|
|||
|
|
|
|||
|
|
class GimbalInfo : public QObject
|
|||
|
|
{
|
|||
|
|
Q_OBJECT
|
|||
|
|
public:
|
|||
|
|
explicit GimbalInfo(QObject *parent = nullptr);
|
|||
|
|
//云台状态消息
|
|||
|
|
//1.byte1云台状态:低4位:0正常;1 堵转;2自检异常;高4位:0:相机连接正常,1.相机连接异常。
|
|||
|
|
Q_PROPERTY(uchar gimbal_status READ gimbal_status NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar gimbal_status(){
|
|||
|
|
return m_statusInfo->pod_state;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//2.byte2云台的当前横滚校正值:返回uint8_t型范围0-60,默认中值30。
|
|||
|
|
Q_PROPERTY(uchar correction_value READ correction_value NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar correction_value(){
|
|||
|
|
return m_statusInfo->correction_value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//3.byte3云台最大波轮速度范围5~100
|
|||
|
|
Q_PROPERTY(uchar wheel_speed_range READ correction_value NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar wheel_speed_range(){
|
|||
|
|
return m_statusInfo->wheel_speed_range;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//4.byte4校飘状态反馈,默认状态0,1-校漂中;2-校漂成功;3-校漂失败;4-校漂被终止
|
|||
|
|
Q_PROPERTY(uchar gyro_drift_correct READ gyro_drift_correct NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar gyro_drift_correct(){
|
|||
|
|
return m_statusInfo->Gyro_drift_correct;
|
|||
|
|
}
|
|||
|
|
//5.byte5自检结果 Bit0:红外机芯 1-正常;0-异常 Bit1:可见光机芯:1-正常;0-异常Bit2:陀螺仪数据:1-正常;0-异常 Bit3:角度传感器:1-正常;0-异常 Bit4:电机:1-正常;0-异常 Bit5:压缩存储:1-正常;0-异常 Bit6:综合处理:1-正常;0-异常 Bit7:吊舱准备状态:1-准备好;0-未准备好
|
|||
|
|
Q_PROPERTY(uchar self_check_result READ self_check_result NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar self_check_result(){
|
|||
|
|
return m_statusInfo->Self_check_result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//6.byte6-7 方位震动频率*100 低位在前
|
|||
|
|
Q_PROPERTY(unsigned short azimuth_frequency READ azimuth_frequency NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short azimuth_frequency(){
|
|||
|
|
return m_statusInfo->Azimuth_frequency;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//7.byte8-9 方位震动幅值*100低位在前
|
|||
|
|
Q_PROPERTY(unsigned short azimuth_value READ azimuth_value NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short azimuth_value(){
|
|||
|
|
return m_statusInfo->azimuth_value;
|
|||
|
|
}
|
|||
|
|
//8.byte10-11 俯仰震动频率*100低位在前
|
|||
|
|
Q_PROPERTY(unsigned short pitch_frequency READ pitch_frequency NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short pitch_frequency(){
|
|||
|
|
return m_statusInfo->pitch_frequency;
|
|||
|
|
}
|
|||
|
|
//9.byte12-13 俯仰震动幅值*100低位在前
|
|||
|
|
Q_PROPERTY(unsigned short pitch_value READ pitch_value NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short pitch_value(){
|
|||
|
|
return m_statusInfo->pitch_value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//10.byte14-15 横滚震动频率*100低位在前
|
|||
|
|
Q_PROPERTY(unsigned short roll_frequency READ roll_frequency NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short roll_frequency(){
|
|||
|
|
return m_statusInfo->roll_frequency;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//11.byte16-17 横滚震动幅值*100低位在前
|
|||
|
|
Q_PROPERTY(unsigned short roll_value READ roll_value NOTIFY gimbalStateNotiChanged)
|
|||
|
|
unsigned short roll_value(){
|
|||
|
|
return m_statusInfo->roll_value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//12.byte18 5公斤吊舱伺服状态(0异常,1整除)Bit0 通信状态Bit1方位旋变状态Bit2陀螺数据状态Bit3 方位电机状态Bit4 方位电流采集状态Bit5 俯仰电流采集状态Bit6 俯仰电机状态Bit7 俯仰旋变状态
|
|||
|
|
Q_PROPERTY(uchar fivepod_state READ fivepod_state NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar fivepod_state(){
|
|||
|
|
return m_statusInfo->fivepod_state;
|
|||
|
|
}
|
|||
|
|
//13.byte19 相机状态(0异常,1整除)Bit0 方位堵转状态Bit1 俯仰堵转状态Bit2 方位飞转状态Bit3俯仰飞转状态Bit4方位共振状态Bit5俯仰共振状态
|
|||
|
|
Q_PROPERTY(uchar camera_state READ camera_state NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar camera_state(){
|
|||
|
|
return m_statusInfo->camera_state;
|
|||
|
|
}
|
|||
|
|
//14.byte20 大吊舱伺服状态: Bit0-4:0x02:手动,0x04锁定,0x05:归中,0x09自动矫漂
|
|||
|
|
Q_PROPERTY(uchar servo_state READ servo_state NOTIFY gimbalStateNotiChanged)
|
|||
|
|
uchar servo_state(){
|
|||
|
|
return m_statusInfo->Servo_state;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//云台姿态信息
|
|||
|
|
//1.byte1-2 方位姿态角,无符号整型,低位在前;单位:度*100
|
|||
|
|
Q_PROPERTY(unsigned short position READ position NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
unsigned short position(){
|
|||
|
|
m_attitudeInfo->position;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//2.byte3-4 横滚姿态角,无符号整型,低位在前;单位:度*100
|
|||
|
|
Q_PROPERTY(unsigned short roll_over READ roll_over NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
unsigned short roll_over(){
|
|||
|
|
m_attitudeInfo->roll_over;
|
|||
|
|
}
|
|||
|
|
//3.byte5-6 俯仰姿态角,无符号整型,低位在前;单位:度*100
|
|||
|
|
Q_PROPERTY(unsigned short pitch READ pitch NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
unsigned short pitch(){
|
|||
|
|
m_attitudeInfo->pitch;
|
|||
|
|
}
|
|||
|
|
//4.byte7-8 云台方位角速度 int16 ±300,x100倍,精度0.01°/s
|
|||
|
|
Q_PROPERTY(short azimuth_speed READ azimuth_speed NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
short azimuth_speed(){
|
|||
|
|
m_attitudeInfo->azimuth_speed;
|
|||
|
|
}
|
|||
|
|
//5.byte9-10 云台俯仰角速度 int16 ±300,x100倍,精度0.01°/s
|
|||
|
|
Q_PROPERTY(short pitch_speed READ pitch_speed NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
short pitch_speed(){
|
|||
|
|
m_attitudeInfo->pitch_speed;
|
|||
|
|
}
|
|||
|
|
//6.byte11-12 云台横滚角速度 int16 ±300,x100倍,精度0.01°/s
|
|||
|
|
Q_PROPERTY(short roll_over READ roll_over NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
short roll_speed(){
|
|||
|
|
m_attitudeInfo->roll_over;
|
|||
|
|
}
|
|||
|
|
//7.byte13图像模式
|
|||
|
|
Q_PROPERTY(uchar imgMode READ imgMode NOTIFY gimbalAttiudeNotiChanged)
|
|||
|
|
uchar imgMode(){
|
|||
|
|
return m_attitudeInfo->imgMode;
|
|||
|
|
}
|
|||
|
|
signals:
|
|||
|
|
void gimbalStateNotiChanged();//更新云台状态值时发射信号
|
|||
|
|
void gimbalAttiudeNotiChanged();//更新云台姿态信息时发射信号
|
|||
|
|
|
|||
|
|
public slots:
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
//云台上报状态信息
|
|||
|
|
glink_m_pods_generality_pod_status_t *m_statusInfo = glink_m_pods_generality_pod_status_createEmptyInfo();
|
|||
|
|
//云台上报姿态信息
|
|||
|
|
glink_m_pods_generality_attitude_t *m_attitudeInfo = glink_m_pods_generality_attitude_createEmptyInfo();
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // GIMBALINFO_H
|