0
0
Files
build/sensor/include/sensor_star.h

89 lines
3.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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; //0PPS校时使能开1PPS信号使能关
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; //遥测数据包1CAK_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