Initial commit from DCSP - 2026/1/15 15:11:58
This commit is contained in:
49
sensor/include/orbit_info.h
Normal file
49
sensor/include/orbit_info.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _SENSOR_ORBIT_INFO_H_
|
||||
#define _SENSOR_ORBIT_INFO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/// @brief 步进指令和步进反馈指令中的公共部分
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
uint8_t pack_id; //节点编号
|
||||
double posi_x_J2000; //X轴位置
|
||||
double posi_y_J2000; //Y轴位置
|
||||
double posi_z_J2000; //Z轴位置
|
||||
double velo_x_J2000; //X轴速度
|
||||
double velo_y_J2000; //Y轴速度
|
||||
double velo_z_J2000; //Z轴速度
|
||||
double q0_J2000; //惯性系四元数
|
||||
double q1_J2000;
|
||||
double q2_J2000;
|
||||
double q3_J2000;
|
||||
} BASIC_CMDER;
|
||||
|
||||
/// @brief 步进反馈指令
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
double Epoch; //历元时间
|
||||
BASIC_CMDER resCmder;
|
||||
} STEP_CMDER_RES;
|
||||
|
||||
uint8_t orbit_info_initz(string path);
|
||||
uint8_t set_orbit_info(uint8_t *frame,double AttiVelECI[3], double EulerVVLH[3], double AttiMtxVVLH[3][3], double MtxECI2VVLH[3][3]);
|
||||
uint8_t get_orbit_info(uint8_t *frame,uint8_t id);
|
||||
|
||||
uint8_t generate_orbit_info(double orbInfo[6], double Tar_orbInfo[6], double AttiVelECI[3],
|
||||
double EulerVVLH[3], double AttiMtxVVLH[3][3], double MtxECI2VVLH[3][3],
|
||||
double* mjd, double* Epoch2017,
|
||||
double SatMass, double SatMtxI[3][3], double ThrustForce[3], double Tq[3], double WheelAM[3]);
|
||||
|
||||
uint8_t get_orbit_epoic(double *Epoch);
|
||||
uint8_t get_orbit_posi(double *posi);
|
||||
uint8_t get_orbit_velo(double *velo);
|
||||
uint8_t get_orbit_Q(double *Q);
|
||||
uint8_t get_orbit_flag(void);
|
||||
//double get_orbit_mjd(void);
|
||||
|
||||
uint8_t get_orbit_source_flag(void);
|
||||
#endif
|
||||
369
sensor/include/sensor_gnss.h
Normal file
369
sensor/include/sensor_gnss.h
Normal file
@@ -0,0 +1,369 @@
|
||||
#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
|
||||
25
sensor/include/sensor_gyro.h
Normal file
25
sensor/include/sensor_gyro.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _SENSOR_GYRO_H_
|
||||
#define _SENSOR_GYRO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define GYRO_FRAME_LENGTH 27
|
||||
|
||||
//光纤陀螺通信协议帧格式
|
||||
typedef struct __attribute__((packed)){
|
||||
uint8_t header;
|
||||
uint8_t x_angle_delta[3]; //陀螺X输出角度增量
|
||||
uint16_t x_integral_time; //陀螺X积分时间
|
||||
uint8_t y_angle_delta[3]; //陀螺Y输出角度增量
|
||||
uint16_t y_integral_time; //陀螺Y积分时间
|
||||
uint8_t z_angle_delta[3]; //陀螺Z输出角度增量
|
||||
uint16_t z_integral_time; //陀螺Z积分时间
|
||||
uint8_t rsvd[10];
|
||||
uint8_t checksum;
|
||||
}Gyro_Frame;
|
||||
|
||||
|
||||
uint8_t generate_gyro_frame(uint8_t *frame, double AttiVelECI[3]);
|
||||
|
||||
#endif
|
||||
33
sensor/include/sensor_mems.h
Normal file
33
sensor/include/sensor_mems.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _SENSOR_MEMS_H_
|
||||
#define _SENSOR_MEMS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MEMS_FRAME_LENGTH 44
|
||||
|
||||
typedef struct __attribute__((packed)){
|
||||
uint8_t header;
|
||||
uint8_t x_angle_delta[3];
|
||||
uint16_t x_mems_integral_Cnt;
|
||||
uint8_t y_angle_delta[3];
|
||||
uint16_t y_mems_integral_Cnt;
|
||||
uint8_t z_angle_delta[3];
|
||||
uint16_t z_mems_integral_Cnt;
|
||||
uint8_t x_acc_v_delta[3];
|
||||
uint16_t x_acc_integral_time;
|
||||
uint8_t y_acc_v_delta[3];
|
||||
uint16_t y_acc_integral_time;
|
||||
uint8_t z_acc_v_delta[3];
|
||||
uint16_t z_acc_integral_time;
|
||||
uint16_t x_gyro_temp;
|
||||
uint16_t y_gyro_temp;
|
||||
uint16_t z_gyro_temp;
|
||||
uint16_t x_acc_temp;
|
||||
uint16_t y_acc_temp;
|
||||
uint16_t z_acc_temp;
|
||||
uint8_t checksum;
|
||||
}MEMS_Frame;
|
||||
|
||||
uint8_t generate_mems_frame(uint8_t *frame, double AttiVelECI[3]);
|
||||
|
||||
#endif
|
||||
54
sensor/include/sensor_optical.h
Normal file
54
sensor/include/sensor_optical.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef _SENSOR_OPTICAL_H_
|
||||
#define _SENSOR_OPTICAL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define OPTIC_FRAME_LENGTH 60+164+4
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
uint16_t FRAME_HEAD ; //帧头
|
||||
uint8_t length;
|
||||
float AI01; //远距离测距(m),精度0.1m
|
||||
float AI02; //近距离测距(m),精度0.02m
|
||||
int16_t AI03; //远距离摆镜水平角(角秒)
|
||||
int16_t AI04; //近距离摆镜俯仰角(角秒)
|
||||
uint8_t AI05; //远距离测距3.3V电源遥测
|
||||
uint8_t AI06; //近距离测距5V电源遥测
|
||||
uint16_t AI07; //远距离激光测量计数
|
||||
uint16_t AI08; //近距离激光测量计数
|
||||
uint8_t AI09; //接收指令计数
|
||||
uint8_t AI10; //遥测计数
|
||||
int32_t AI11; //遥测时间戳
|
||||
uint16_t AI12; //远距离相机工作状态
|
||||
int32_t AI13; //远距离相机曝光时间参数,单位:us
|
||||
uint8_t AI14; //远距离相机增益设置参数
|
||||
uint8_t AI15; //远距离相机输出图像帧计数
|
||||
uint8_t AI16; //远距离相机3.3V电压遥测1
|
||||
uint8_t AI17; //远距离相机5V电压遥测1
|
||||
uint16_t AI18; //近距离相机工作状态
|
||||
int32_t AI19; //近距离相机曝光时间参数,单位:us
|
||||
uint8_t AI20; //近距离相机增益设置参数
|
||||
uint8_t AI21; //近距离相机输出图像帧计数
|
||||
uint8_t AI22; //近距离相机3.3V电压遥测
|
||||
uint8_t AI23; //近距离相机5V电压遥测
|
||||
uint8_t AI_far; //远距激光测量有效标志
|
||||
uint8_t AI_close; //近距激光测量有效标志
|
||||
uint8_t AI25; //图像处理3.3V电压遥测
|
||||
uint8_t AI26; //图像处理5V电压遥测
|
||||
int32_t AI27; //综合控制板工作状态
|
||||
uint8_t AI28; //综合控制板3.3V电压遥测
|
||||
uint8_t AI29; //综合控制板5V电压遥测
|
||||
uint32_t AI_time_s;
|
||||
uint16_t AI_time_ms;
|
||||
uint8_t resvd[164];
|
||||
uint8_t Check_sum; //校验和
|
||||
} OPTICAL_TLM_STR; //OPTICAL遥测数据包
|
||||
|
||||
|
||||
|
||||
void generate_xgd_frame(uint8_t *frame, double TarRVECI[6], double ChaRVECI[6], double MtxECI2VVLH[3][3], double MtxVVLH2Body[3][3], double LOS_Remote[9], double Euler[3], double R_Plane[2], int TargetFLAG);
|
||||
void generate_photo_frame(uint8_t *frame);
|
||||
|
||||
#endif
|
||||
89
sensor/include/sensor_star.h
Normal file
89
sensor/include/sensor_star.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#ifndef _SENSOR_STAR_H_
|
||||
#define _SENSOR_STAR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CAK_TLM_1_Info_Length 64
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint8_t ext;
|
||||
struct
|
||||
{
|
||||
unsigned int str_state1_data4 : 1; // 1(默认)
|
||||
unsigned int str_state1_data3 : 1; // 0:光信号激励(默认)1:电信号激励
|
||||
unsigned int str_state1_data2 : 2; //01:数据有效(姿态测量更新)
|
||||
//10:数据无效
|
||||
//00:数据有效(姿态滤波更新)
|
||||
unsigned int str_state1_data1 : 4; //0001:星跟踪模式
|
||||
//0010:全天识别模式
|
||||
//0100:测试模式
|
||||
//1000:星图成像及数据下传模式
|
||||
//1010:启动模式
|
||||
//1111:待机模式
|
||||
unsigned int str_state2_data5 : 1; //0:在轨标定关(默认)1:在轨标定开
|
||||
unsigned int str_state2_data4 : 1; //0:PPS校时使能开1:PPS信号使能关
|
||||
unsigned int str_state2_data3 : 1; //0:UTC校时有1:UTC校时无
|
||||
unsigned int str_state2_data2 : 2; //001:执行Flash第一份用户程序(默认)
|
||||
// 010:执行Flash第二份用户程序
|
||||
//011:执行Flash第三份用户程序
|
||||
unsigned int str_state2_data1 : 2; //01:执行第一份BOOT程序(默认)
|
||||
//10:执行第二份BOOT程序
|
||||
//11:执行第三份BOOT程序
|
||||
unsigned int pro_state_data8 : 1; // APP3程序校验状态。1:正确,0:错误
|
||||
unsigned int pro_state_data7 : 1; // APP2程序校验状态。1:正确,0:错误
|
||||
unsigned int pro_state_data6 : 1; // APP1程序校验状态。1:正确,0:错误
|
||||
unsigned int pro_state_data5 : 1; // 默认0
|
||||
unsigned int pro_state_data4 : 1; // BOOT3程序校验状态,1:正确,0:错误
|
||||
unsigned int pro_state_data3 : 1; // BOOT2程序校验状态,1:正确,0:错误
|
||||
unsigned int pro_state_data2 : 1; // BOOT1程序校验状态,1:正确,0:错误
|
||||
unsigned int pro_state_data1 : 1; // Loader程序校验状态,1:正确,0:错误
|
||||
|
||||
};
|
||||
|
||||
} Bitpara_State;
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
uint16_t FRAME_HEAD ; //帧头
|
||||
uint16_t TLM_FRAME_ID; //帧标识
|
||||
int32_t q0; //四元数q0
|
||||
int32_t q1; //四元数q1
|
||||
int32_t q2; //四元数q2
|
||||
int32_t q3; //四元数q3
|
||||
//Bitpara_State Bitpara_State_data; //星敏感器状态字
|
||||
uint8_t para1;
|
||||
uint8_t para2;
|
||||
|
||||
uint8_t UTC[5]; //曝光中点时刻UTC时间
|
||||
uint16_t GRAY_MEAN; // 图像灰度均值
|
||||
uint16_t PPS_CNT; // ETR脉冲计数
|
||||
int16_t PPS_DT; // 曝光时差
|
||||
uint8_t STAR_NUM_S; // 探测星数
|
||||
uint8_t STAR_NUM_G; // 导航星数
|
||||
uint8_t STAR_NUM_D; // 定姿星数
|
||||
uint8_t THR_OFST; // 星点提取阈值偏移量
|
||||
uint8_t TEMP_SEN; // 探测器温度
|
||||
uint8_t TEMP_SHL; // 处理器温度
|
||||
uint8_t EXP_TIME; // 曝光时间
|
||||
uint8_t CAK_BYTE[3]; // 命令应答字
|
||||
uint16_t STRLT_FLAG; // 杂散光标志字
|
||||
int16_t OMIGA_X; // 角速率ωx
|
||||
int16_t OMIGA_Y; // 角速率ωy
|
||||
int16_t OMIGA_Z; // 角速率ωz
|
||||
int16_t L3G_OMIG_X; //片上MEMS陀螺角速率X
|
||||
uint16_t FOCAL_L; // 焦距值
|
||||
uint8_t STAR_NUM_T; // 跟踪星数
|
||||
uint8_t REC_NUM_PRO; // 处理波门数
|
||||
int16_t L3G_OMIG_Y; // 片上MEMS陀螺角速率Y
|
||||
int16_t L3G_OMIG_Z; // 片上MEMS陀螺角速率Z
|
||||
uint8_t Bitpara_STATE; //软件健康状态字
|
||||
uint8_t WD_CNT; // 看门狗复位次数
|
||||
uint8_t SUM; // 累加和
|
||||
} CAK_TLM_1_STRUCT; //遥测数据包1(CAK_TLM_1)
|
||||
|
||||
|
||||
uint8_t generate_star_1_frame(uint8_t *frame, double QuatECI[4], double AttiVelECI[3]);
|
||||
uint8_t generate_star_2_frame(uint8_t *frame, double QuatECI[4], double AttiVelECI[3]);
|
||||
|
||||
#endif
|
||||
8
sensor/include/sensor_thrust.h
Normal file
8
sensor/include/sensor_thrust.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _SENSOR_THRUST_H_
|
||||
#define _SENSOR_THRUST_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void sensor_ThrustMeas(double ThrustForce[3], double ThrustTorque[3], double* SatMass, double SatMtxI[3][3], double JetPWMPlan[12]);
|
||||
//void sensor_ThrustMeas(double ThrustForce[3], double ThrustTorque[3], double* SatMass, double SatMtxI[3][3], double JetPWMPlan[12]);
|
||||
#endif
|
||||
163
sensor/include/sensor_tx2.h
Normal file
163
sensor/include/sensor_tx2.h
Normal file
@@ -0,0 +1,163 @@
|
||||
#ifndef _SENSOR_TX2_H_
|
||||
#define _SENSOR_TX2_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
#define VISION_Info_Length 164+6 //164字节数据+5字节头+1字节校验
|
||||
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint16_t ext;
|
||||
struct
|
||||
{
|
||||
uint8_t VISION_state1_data7 : 3; //输出单帧图像中点的检测数量,范围[0~5]。
|
||||
uint8_t VISION_state1_data6 : 3; //预留
|
||||
uint8_t VISION_state1_data5 : 2; //00:第一个簇是目标;
|
||||
//01:第一个簇识别错误;
|
||||
//10:第一个簇识别错误;
|
||||
//11:第一个簇是恒星
|
||||
uint8_t VISION_state1_data4 : 2; //00:第二个簇是目标;
|
||||
//01:第二个簇识别错误;
|
||||
//10:第二个簇识别错误;
|
||||
//11:第二个簇是恒星
|
||||
uint8_t VISION_state1_data3 : 2; //00:第三个簇是目标;
|
||||
//01:第三个簇识别错误;
|
||||
//10:第三个簇识别错误;
|
||||
//11:第三个簇是恒星
|
||||
uint8_t VISION_state1_data2 : 2; //00:第四个簇是目标;
|
||||
//01:第四个簇识别错误;
|
||||
//10:第四个簇识别错误;
|
||||
//11:第四个簇是恒星
|
||||
uint8_t VISION_state1_data1 : 2; //00:第五个簇是目标;
|
||||
//01:第五个簇识别错误;
|
||||
//10:第五个簇识别错误;
|
||||
//11:第五个簇是恒星
|
||||
};
|
||||
} Star_Removal_Brightness_Rec_State;
|
||||
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint8_t ext;
|
||||
struct
|
||||
{
|
||||
uint8_t Flag0 : 4; //远距标志
|
||||
uint8_t Flag1 : 4; //近距标志
|
||||
};
|
||||
}TX2_Image_Flag;
|
||||
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
uint8_t recog_Valid; //识别结果,0b00:数据无效; 0b11:数据有效
|
||||
float recog_Alpha ; //计算俯仰角α1
|
||||
float recog_Beta ; //计算俯仰角α1
|
||||
}RecResult;
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
uint16_t FRAME_HEAD; //帧头 0xEB90
|
||||
uint8_t Type_Code; //类型码 0xF0
|
||||
uint16_t Code_Length; //帧长度
|
||||
uint16_t FRAME_RESERVE1; //预留-1 0x8AA1
|
||||
uint8_t star_Q_flag;
|
||||
uint8_t Image_flag;
|
||||
uint8_t Telemetry_Counter; //遥测帧计数器
|
||||
Star_Removal_Brightness_Rec_State SRBRS_State_data; //远距恒星剔除和亮度识别算法检测情况
|
||||
|
||||
float TARGET_Horizontal; //图像中目标点的横向坐标
|
||||
float TARGET_Vertical ; //图像中目标点的横向坐标
|
||||
float TARGET_Brightness ; //图像中目标点的亮度信息
|
||||
uint8_t Target_Capture_Flag; //目标稳定捕获标志(0b01:已稳定捕获,进入跟踪阶段;0b00:未稳定捕获)
|
||||
uint8_t Image_Number; //目标识别阶段已识别到目标的图像数量
|
||||
float frame_noise_ratio ; //图像的信噪比
|
||||
float frame_contrast; //图像对比度
|
||||
uint8_t Area_Number_far; //远距相机检测到的区域数量
|
||||
uint8_t Area_Number_close; //近距相机检测到的区域数量
|
||||
uint8_t far_Core_Size_far; //远距相机存储开运算核的尺寸
|
||||
uint8_t far_Core_Size_close; //近距相机存储开运算核的尺寸
|
||||
uint8_t Area_Brightness_far; //远距相机图像平均亮度
|
||||
uint8_t Area_Brightness_close; //近距相机图像平均亮度
|
||||
uint8_t Target_Edge_Integrity_Flag_far; //远距相机完整性标志;0b00:完整;0b11:不完整
|
||||
uint8_t Target_Edge_Integrity_Flag_close; //近距相机完整性标志;0b00:完整;0b11:不完整
|
||||
|
||||
uint8_t Missed_Number; //跟踪目标脱靶次数
|
||||
uint8_t line_of_sight_flag_far; //远距相机视线距可靠标志位;0b00:不可靠;0b11:可靠
|
||||
uint8_t line_of_sight_flag_close; //近距相机视线距可靠标志位;0b00:不可靠;0b11:可靠
|
||||
|
||||
float Line_Distance_far; //远距相机视线距离
|
||||
float Line_Distance_close; //近距相机视线距离
|
||||
uint32_t Image_time_sec; //照片时间戳整秒
|
||||
uint16_t Image_time_ms; //照片时间戳毫秒
|
||||
|
||||
RecResult Left_Sail_far; //远距相机左帆板
|
||||
RecResult Right_Sail_far; //远距相机右帆板
|
||||
RecResult Self_plat_far; //远距相机本体
|
||||
|
||||
RecResult Left_Sail_close; //近距相机左帆板
|
||||
RecResult Right_Sail_close; //近距相机右帆板
|
||||
RecResult Self_plat_close; //近距相机本体
|
||||
|
||||
|
||||
uint8_t Corrosion_size_far_cmd; //远距相机腐蚀核尺寸指令执行结果
|
||||
uint8_t Corrosion_size_far; //远距相机腐蚀核尺寸
|
||||
|
||||
uint8_t Corrosion_size_close_cmd; //近距相机腐蚀核尺寸指令执行结果
|
||||
uint8_t Corrosion_size_close; //近距相机腐蚀核尺寸
|
||||
|
||||
uint8_t removal_match_radius_cmd; //恒星剔除匹配半径指令执行结果
|
||||
uint8_t removal_match_radius; //恒星剔除匹配半径
|
||||
|
||||
uint8_t Capture_flag_cmd; //捕获标志位指令执行结果
|
||||
uint8_t Capture_flag; //捕获标志位
|
||||
|
||||
uint8_t Target_Stable_Threshold_cmd; //目标稳定捕获判定阈值指令执行结果
|
||||
uint8_t Target_Stable_Threshold; //目标稳定捕获判定阈值
|
||||
|
||||
uint8_t alg_Threshold_far_cmd; //远距相机算法阈值分割系数指令执行结果
|
||||
float alg_Threshold_far; //远距相机算法阈值分割系数
|
||||
|
||||
uint8_t target_track_cmd; //追踪目标信息遥控指令接收结果
|
||||
uint8_t target_track_fan_flag; //追踪目标信息帆板单双侧标志
|
||||
float target_track_fan_coef; //追踪目标信息帆板比例系数
|
||||
float target_track_target_length; //追踪目标信息目标整体长度
|
||||
float target_track_target_width; //追踪目标信息目标帆板宽度
|
||||
|
||||
uint8_t far_alg_change_cmd; //远距相机远近距算法切换阈值指令
|
||||
uint8_t far_alg_change_Threshold; //远距相机远近距算法切换阈值
|
||||
|
||||
uint8_t far_camera_Threshold_cmd; //远距相机依据像素大小判断目标阈值指令
|
||||
uint8_t far_camera_Threshold; //远距相机依据像素大小判断目标阈值
|
||||
|
||||
|
||||
uint8_t moon_exist_cmd; //月亮存在标志指令
|
||||
uint8_t moon_exist; //月亮存在标志
|
||||
|
||||
uint8_t close_alg_change_cmd; //近距相机远近距算法切换阈值指令
|
||||
uint8_t close_alg_change_Threshold; //近距相机远近距算法切换阈值
|
||||
|
||||
uint8_t close_camera_Threshold_cmd; //近距相机依据像素大小判断目标阈值指令
|
||||
uint8_t close_camera_Threshold; //近距相机依据像素大小判断目标阈值
|
||||
|
||||
uint32_t Identification_time_sec; //识别结果时间整秒
|
||||
uint16_t Identification_time_ms; //识别结果时间毫秒
|
||||
|
||||
TX2_Image_Flag image_exist_flag; //图像无目标标志
|
||||
TX2_Image_Flag far_close_alg_change_flag; //远近距算法切换标志
|
||||
TX2_Image_Flag target_edge_flag; //目标边缘标志
|
||||
// uint8_t image_exist_flag;
|
||||
// uint8_t far_close_alg_change_flag; //远近距算法切换标志
|
||||
// uint8_t target_edge_flag; //目标边缘标志
|
||||
|
||||
float frame_noise_ratio_close ; //近距图像的信噪比
|
||||
float frame_contrast_close; //近距图像对比度
|
||||
uint8_t checksum;
|
||||
}VISION_TLM_STRUCT; //视觉遥测数据包
|
||||
|
||||
|
||||
uint8_t generate_tx2_frame(uint8_t *frame, double LOS_Remote[9], double R_Plane[2], double TarRVECI[6], double ChaRVECI[6], double ChaMtxVVLH2Body[3][3], double ChaMtxECI2VVLH[3][3], int TargetFLAG);
|
||||
|
||||
#endif
|
||||
28
sensor/include/sensor_wheel.h
Normal file
28
sensor/include/sensor_wheel.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _SENSOR_WHEEL_H_
|
||||
#define _SENSOR_WHEEL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define WHEEL_FRAME_LENGTH 19
|
||||
|
||||
#define WHEEL_EXP 1000
|
||||
#define WHEEL_LIMIT4 4.294967296e9
|
||||
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
uint8_t header;
|
||||
uint8_t rotate_speed[4]; //飞轮转速
|
||||
uint8_t current[4]; //飞轮电流
|
||||
uint8_t control_state[4]; //控制状态
|
||||
uint8_t acc_torque[4]; //飞轮加速力矩指令
|
||||
uint8_t id; //飞轮ID
|
||||
uint8_t checksum;
|
||||
}FlyWheel_Frame;
|
||||
|
||||
//uint8_t generate_wheel_frame(uint8_t *frame);
|
||||
uint8_t generate_wheel_frame(uint8_t *frame,double CmdWheel);
|
||||
double cal_message_para(int s1, int s2, int s3, int s4, int exp);
|
||||
|
||||
void sensor_WheelMeas(double WheelTorqueBody[3], double WheelAM[3], double CmdWheel[3]);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user