369 lines
13 KiB
C
369 lines
13 KiB
C
#ifndef _SENSOR_GNSS_H_
|
||
#define _SENSOR_GNSS_H_
|
||
|
||
#include <stdint.h>
|
||
|
||
#define GPS_Hk_FRAME_LENGTH 372
|
||
|
||
typedef union {
|
||
uint8_t data;
|
||
struct{
|
||
uint8_t post_staus : 1;//定位状态
|
||
uint8_t orbit_staus : 2;//定轨状态
|
||
uint8_t resolve_staus:3;//解算状态
|
||
uint8_t work_staus:2; //工作状态
|
||
};
|
||
} PostionStatus;//定位状态
|
||
|
||
typedef union {
|
||
uint16_t data;
|
||
struct{
|
||
uint8_t gps_available_num:4; //GPS可用星数
|
||
uint8_t gps_catch_num:4; // GPS捕获星数
|
||
uint8_t bd_available_num:4; //bd可用星数
|
||
uint8_t bd_catch_num:4; // bd捕获星数
|
||
};
|
||
}GNSS_Star_Num;//星星
|
||
|
||
typedef union {
|
||
uint8_t data;
|
||
struct{
|
||
uint8_t A_B_flag:1; //A/B机标识
|
||
uint8_t master_slave_flag:2; //主从核通信状态
|
||
uint8_t Tmark_flag:1; //Tmark状态
|
||
uint8_t Orbit_enable_flag:2; //定轨输出使能标记
|
||
uint8_t pulse_enable_flag:2; //秒脉冲输出使能标记
|
||
|
||
};
|
||
}GNSSSReceiverStatus;//监控状态
|
||
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t rs422_init_couse:4; //422总线初始化原因
|
||
uint8_t rs422_init_num:4; //422总线初始化计数(总线需求类型1),初始化一次+1
|
||
};
|
||
}RS422_Status;//RS422状态
|
||
|
||
|
||
typedef union
|
||
{
|
||
uint16_t data;
|
||
struct
|
||
{
|
||
uint8_t gps_carrier_noise_46:4; //载噪比大于46的GPS星数;
|
||
uint8_t gps_carrier_noise_less40:4; //载噪比40~46的GPS星数
|
||
uint8_t bd_carrier_noise_46:4; //载噪比大于46的bd星数;
|
||
uint8_t bd_carrier_noise_less40:4; //载噪比40~46的bd星数
|
||
};
|
||
}GNSS_CarrierNoise;//载噪比分布
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t cpusoft_reset_num:4; //导航信息处理软件复位次数
|
||
uint8_t orbitsoft_reset_num:4; //定轨接口软件复位次数
|
||
};
|
||
}GNSS_Reset;//GNSS接收机复位计数
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t not_posi_reason:4; //非定位原因
|
||
uint8_t reset_reason_core:4; //从核复位原因
|
||
};
|
||
}GNSS_CPUSoft_Status;//航信息处理软件状态
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data[12];
|
||
struct
|
||
{
|
||
uint8_t thoroughfare0:4; //通道0
|
||
uint8_t thoroughfare1:4; //通道1
|
||
uint8_t thoroughfare2:4; //通道2
|
||
uint8_t thoroughfare3:4; //通道3
|
||
uint8_t thoroughfare4:4; //通道4
|
||
uint8_t thoroughfare5:4; //通道5
|
||
uint8_t thoroughfare6:4; //通道6
|
||
uint8_t thoroughfare7:4; //通道7
|
||
uint8_t thoroughfare8:4; //通道8
|
||
uint8_t thoroughfare9:4; //通道9
|
||
uint8_t thoroughfare10:4; //通道10
|
||
uint8_t thoroughfare11:4; //通道11
|
||
uint8_t thoroughfare12:4; //通道12
|
||
uint8_t thoroughfare13:4; //通道13
|
||
uint8_t thoroughfare14:4; //通道14
|
||
uint8_t thoroughfare15:4; //通道15
|
||
uint8_t thoroughfare16:4; //通道16
|
||
uint8_t thoroughfare17:4; //通道17
|
||
uint8_t thoroughfare18:4; //通道18
|
||
uint8_t thoroughfare19:4; //通道19
|
||
uint8_t thoroughfare20:4; //通道20
|
||
uint8_t thoroughfare21:4; //通道21
|
||
uint8_t thoroughfare22:4; //通道22
|
||
uint8_t thoroughfare23:4; //通道23
|
||
};
|
||
}GNSS_Orbit_Reject_Reason;//定轨剔除原因
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t filter_conver_flag:2; //滤波器收敛标志
|
||
uint8_t Orbit_init_flag:2; //定轨初始化标记
|
||
uint8_t reset_reason_master_core:4; //主核复位原因
|
||
};
|
||
}GNSS_OrbitSoft_Status;//定轨接口软件状态
|
||
|
||
|
||
//该结构体中使用2字节的增量数据长度导致memcpy时数据丢失,暂不使用
|
||
typedef union
|
||
{
|
||
uint32_t data;
|
||
struct
|
||
{
|
||
uint16_t data_length:15;//增量数据长度
|
||
uint8_t soft_version:8;//程序版本号
|
||
uint8_t inject_cmd:2;//上注命令
|
||
uint8_t crc_return_value:3;//校验返回值
|
||
uint8_t program_inject_logo:3; //程序上注标识
|
||
uint8_t boot:1; //boot引导区
|
||
};
|
||
}GNSS_Soft_Injection_Status;//上注状态
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t param_type:2; //上注参数类型
|
||
uint8_t param_flash_flag:2; //上注参数写FLASH标识
|
||
uint8_t track_parameter_source:2; //轨道参数来源
|
||
uint8_t eop_param_source:2; //EOP参数来源
|
||
|
||
};
|
||
}GNSS_Param_Injection_Status;//参数上注信息
|
||
|
||
typedef union
|
||
{
|
||
uint16_t data;
|
||
struct
|
||
{
|
||
uint8_t channel_reject:8; //通道剔除原因
|
||
uint8_t reserve:2; //保留
|
||
uint8_t track_param:4; //跟踪参数
|
||
uint8_t track_status:2; //跟踪状态
|
||
|
||
};
|
||
}Satellite_Channel_Status;//通道卫星状态
|
||
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint8_t satellite_num; //卫星号
|
||
uint8_t Signal_noise_ratio;//信噪比
|
||
Satellite_Channel_Status sat_channel_status;//通道卫星状态
|
||
uint8_t channel_orbit_status;//通道定轨状态
|
||
uint32_t pseudo_range_integer; //伪距整数部分
|
||
uint16_t pseudo_range_decimal; //伪距小数部分
|
||
uint32_t signal_carrier_integer; //载波相位整数部分
|
||
uint32_t signal_carrier_decimal; //载波相位小数部分
|
||
}GPS_Channel_Observe_with_pseu; //带伪距伪距率输出的GPS卫星信息
|
||
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint8_t satellite_num; //卫星号
|
||
uint8_t Signal_noise_ratio;//信噪比
|
||
Satellite_Channel_Status sat_channel_status;//通道卫星状态
|
||
uint8_t channel_orbit_status;//通道定轨状态
|
||
}GPS_Channel_Observe_without_pseu; //带伪距伪距率输出的卫星信息
|
||
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint8_t satellite_num; //卫星号
|
||
uint8_t Signal_noise_ratio;//信噪比
|
||
Satellite_Channel_Status satellite_channel_status;//通道卫星状态
|
||
uint8_t channel_orbit_status;//通道定轨状态
|
||
uint32_t pseudo_range_integer; //伪距整数部分
|
||
uint16_t pseudo_range_decimal; //伪距小数部分
|
||
}BD_Channel_Observe_with_pseu; //带伪距伪距率输出的BD卫星信息
|
||
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint8_t satellite_num; //卫星号
|
||
uint8_t Signal_noise_ratio;//信噪比
|
||
Satellite_Channel_Status satellite_channel_status;//通道卫星状态
|
||
uint8_t channel_orbit_status;//通道定轨状态
|
||
}BD_Channel_Observe_without_pseu; //带伪距伪距率输出的BD卫星信息
|
||
|
||
typedef union
|
||
{
|
||
uint8_t data;
|
||
struct
|
||
{
|
||
uint8_t time_top_param_type:1; //上注参数类型:(time参数上注状态)
|
||
uint8_t time_param_source:1; //参数来源(time参数上注状态)
|
||
uint8_t time_write_flash_flag:2; //写FLASH标识(time参数上注状态)
|
||
uint8_t bd_top_param_type:1; //上注参数类型:(BD参数上注状态)
|
||
uint8_t bd_param_source:1; //参数标识(BD参数上注状态)
|
||
uint8_t bd_write_flash_flag:2; //写FLASH标识(BD参数上注状态)
|
||
|
||
};
|
||
}BD_Time_Param_Status; //BD及时间基准参数上注状态
|
||
|
||
|
||
|
||
/******基本遥测数据******/
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint8_t header[2];
|
||
uint16_t length;
|
||
uint8_t datatype;
|
||
uint8_t telemetry_cnt; //遥测请求计数
|
||
uint8_t rec_cmd_cnt; //接收指令计数
|
||
uint8_t error_cmd_cnt; //错误指令计数
|
||
uint8_t recent_cmd; //最近执行指令码
|
||
|
||
|
||
//PostionStatus posi_status; //状态
|
||
uint8_t posi_status;
|
||
uint16_t bds_week; //BDS周
|
||
uint8_t bds_second[3]; //BDS秒
|
||
uint32_t bds_microsecond; //bds纳秒
|
||
|
||
uint16_t gps_week; //gps周
|
||
uint8_t gps_second[3]; //gps秒
|
||
uint32_t gps_microsecond; //gps纳秒
|
||
|
||
|
||
uint32_t rx_star_broadcast_second; //收到星上秒值
|
||
uint32_t rx_star_broadcast_microsecond; //收到星上毫秒值
|
||
int8_t diff_seconds; //GNSS与星务时间差秒
|
||
int16_t diff_m_seconds; //GNSS与星务时间差毫秒
|
||
|
||
int32_t GNSS_X_POS_inJ2000; //J2000坐标系,X轴位置;不定位时输出AAH
|
||
int32_t GNSS_Y_POS_inJ2000; //J2000坐标系,Y轴位置;不定位时输出AAH
|
||
int32_t GNSS_Z_POS_inJ2000; //J2000坐标系,Z轴位置;不定位时输出AAH
|
||
int32_t GNSS_X_SPEED_inJ2000; //J2000坐标系,X轴速度;不定位时输出AAH
|
||
int32_t GNSS_Y_SPEED_inJ2000; //J2000坐标系,Y轴速度;不定位时输出AAH
|
||
int32_t GNSS_Z_SPEED_inJ2000; //J2000坐标系,Z轴速度;不定位时输出AAH
|
||
|
||
int32_t GNSS_X_POS_inWGS84; //WGS-84坐标系,X轴位置;不定位时输出AAH
|
||
int32_t GNSS_Y_POS_inWGS84; //WGS-84坐标系,Y轴位置;不定位时输出AAH
|
||
int32_t GNSS_Z_POS_inWGS84; //WGS-84坐标系,Z轴位置;不定位时输出AAH
|
||
int32_t GNSS_X_SPEED_inWGS84; //WGS-84坐标系,X轴速度;不定位时输出AAH
|
||
int32_t GNSS_Y_SPEED_inWGS84; //WGS-84坐标系,Y轴速度;不定位时输出AAH
|
||
int32_t GNSS_Z_SPEED_inWGS84; //WGS-84坐标系,Z轴速度;不定位时输出AAH
|
||
|
||
int32_t GNSS_X_ORBIT_POS_inJ2000; //GNSS定轨X位置,J2000坐标系
|
||
int32_t GNSS_Y_ORBIT_POS_inJ2000; //GNSS定轨Y位置,J2000坐标系
|
||
int32_t GNSS_Z_ORBIT_POS_inJ2000; //GNSS定轨Z位置,J2000坐标系
|
||
int32_t GNSS_X_ORBIT_SPEED_inJ2000; //GNSS定轨X速度,J2000坐标系
|
||
int32_t GNSS_Y_ORBIT_SPEED_inJ2000; //GNSS定轨Y速度,J2000坐标系
|
||
int32_t GNSS_Z_ORBIT_SPEED_inJ2000; //GNSS定轨Z速度,J2000坐标系
|
||
|
||
int32_t GNSS_X_ORBIT_POS_inWGS84; //GNSS定轨X位置,WGS-84坐标系
|
||
int32_t GNSS_Y_ORBIT_POS_inWGS84; //GNSS定轨Y位置,WGS-84坐标系
|
||
int32_t GNSS_Z_ORBIT_POS_inWGS84; //GNSS定轨Z位置,WGS-84坐标系
|
||
int32_t GNSS_X_ORBIT_SPEED_inWGS84; //GNSS定轨X速度,WGS-84坐标系
|
||
int32_t GNSS_Y_ORBIT_SPEED_inWGS84; //GNSS定轨Y速度,WGS-84坐标系
|
||
int32_t GNSS_Z_ORBIT_SPEED_inWGS84; //GNSS定轨Z速度,WGS-84坐标系
|
||
|
||
GNSS_Star_Num gnss_star_num;
|
||
|
||
uint32_t utc_time; //UTC累计秒整数
|
||
uint32_t tic_time; //tic计数
|
||
|
||
uint8_t gps_leap_seconds; //GPS定位计算结果当前使用的跳秒值
|
||
uint8_t bd2_leap_seconds; //BDS定位计算结果当前使用的跳秒值
|
||
|
||
uint16_t GDOP_value; //GNSS定位计算结果GDOP值
|
||
int32_t gps_solve_clock_diff; //GPS定位计算结果时钟偏差量
|
||
int32_t BD_solve_clock_diff; //BDS定位计算结果时钟偏差量
|
||
int32_t GNSS_drift; //GNSS定位计算结果时钟漂移值
|
||
|
||
GNSSSReceiverStatus receiver_status; //监控状态标识
|
||
RS422_Status rs422_status; //422总线初始化原因及计数(总线需求类型1)
|
||
uint8_t reserve; //保留
|
||
|
||
GNSS_CarrierNoise gnss_carrier_noise; //载噪比分布
|
||
GNSS_Reset gnss_reset_num; //GNSS接收机复位计数
|
||
|
||
GNSS_CPUSoft_Status navigation_status; //导航信息处理软件状态
|
||
GNSS_OrbitSoft_Status orbitsoft_status; //定轨接口软件状态
|
||
|
||
uint8_t slave_core_sram_err_num; //从核SRAM监控错误计数
|
||
uint8_t mater_core_sram_err_num; //主核SRAM监控错误计数
|
||
|
||
uint8_t Single_point_use_star ; //单点定位使用星数
|
||
uint8_t filter_point_use_star ; //滤波使用星数
|
||
|
||
uint8_t orbit_param_PDOP ; //定轨参数PDOP
|
||
uint8_t orbit_param_pos_residual; //定轨参数位置残差
|
||
uint8_t orbit_param_speed_residual; //定轨参数速度残差
|
||
uint8_t orbit_convergence_value; //定轨收敛值
|
||
uint8_t orbit_infor_standard_deviation; //定轨先验信息的标准差
|
||
|
||
uint8_t measure_update_standard_deviation; //量测更新后的标准差
|
||
uint32_t orbit_module_run_flag; //定轨模块运行标记
|
||
|
||
GNSS_Orbit_Reject_Reason orbit_reject_reasion; //定轨剔除原因
|
||
uint8_t orbit_health[3]; //当前定轨健康字
|
||
|
||
//GNSS_Soft_Injection_Status soft_injection_Status;//上注状态
|
||
uint32_t soft_injection_Status;//上注状态
|
||
GNSS_Param_Injection_Status param_injection_Status;//参数上注信息
|
||
uint8_t reserve2; //保留
|
||
|
||
GPS_Channel_Observe_with_pseu gps_channel_1_observe_amount;//GPS第1通道卫星观测量
|
||
GPS_Channel_Observe_with_pseu gps_channel_2_observe_amount;//GPS第2通道卫星观测量
|
||
GPS_Channel_Observe_with_pseu gps_channel_3_observe_amount;//GPS第3通道卫星观测量
|
||
GPS_Channel_Observe_without_pseu gps_channel_4_observe_amount;//GPS第4通道卫星观测量
|
||
GPS_Channel_Observe_without_pseu gps_channel_5_observe_amount;//GPS第5通道卫星观测量
|
||
GPS_Channel_Observe_without_pseu gps_channel_6_observe_amount;//GPS第6通道卫星观测量
|
||
GPS_Channel_Observe_without_pseu gps_channel_7_observe_amount;//GPS第7通道卫星观测量
|
||
GPS_Channel_Observe_without_pseu gps_channel_8_observe_amount;//GPS第8通道卫星观测量
|
||
BD_Channel_Observe_with_pseu bd_channel_1_observe_amount;//bd第1通道卫星观测量
|
||
BD_Channel_Observe_with_pseu bd_channel_2_observe_amount;//bd第2通道卫星观测量
|
||
BD_Channel_Observe_with_pseu bd_channel_3_observe_amount;//bd第3通道卫星观测量
|
||
BD_Channel_Observe_without_pseu bd_channel_4_observe_amount;//bd第4通道卫星观测量
|
||
BD_Channel_Observe_without_pseu bd_channel_5_observe_amount;//bd第5通道卫星观测量
|
||
BD_Channel_Observe_without_pseu bd_channel_6_observe_amount;//bd第6通道卫星观测量
|
||
BD_Channel_Observe_without_pseu bd_channel_7_observe_amount;//bd第7通道卫星观测量
|
||
BD_Channel_Observe_without_pseu bd_channel_8_observe_amount;//bd第8通道卫星观测量
|
||
|
||
BD_Time_Param_Status bd_time_param_status;
|
||
uint8_t navigation_frame_number; //导航星历帧序号
|
||
uint8_t navigation_frame_data[20]; //导航星历数据
|
||
uint16_t navigation_frame_checksum; //导航星历校验和
|
||
|
||
uint16_t checksum; //数据长度和有效数据字段的校验和
|
||
uint16_t tail; //桢尾
|
||
|
||
|
||
} GNSS_Base_t;
|
||
|
||
|
||
typedef struct __attribute__((packed))
|
||
{
|
||
uint16_t header; //桢头
|
||
uint16_t data_length; //数据长度
|
||
uint8_t type; //数据类型
|
||
uint8_t cmd[6];
|
||
uint16_t checksum;//校验和
|
||
uint16_t tail;//桢尾
|
||
}GNSS_Cmd;
|
||
|
||
|
||
|
||
|
||
uint8_t generate_gnss_frame(uint8_t *frame, double PosVelECIReal[6], double mjd, double Epoch_J2000);
|
||
|
||
#endif |