fix: remove attitude_t, unify with INS_t
- Delete attitude_t struct from ins_task.h - INS_Init() returns INS_t* directly instead of casting from INS.Gyro offset - Change Gimbal_Upload_Data_s.gimbal_imu_data to INS_t* pointer - Update gimbal.c and robot_cmd.c accordingly
This commit is contained in:
@@ -77,12 +77,12 @@ static void InitQuaternion(float *init_q4)
|
||||
init_q4[i + 1] = axis_rot[i] * sinf(angle / 2.0f); // 轴角公式,第三轴为0(没有z轴分量)
|
||||
}
|
||||
|
||||
attitude_t *INS_Init(void)
|
||||
INS_t *INS_Init(void)
|
||||
{
|
||||
if (!INS.init)
|
||||
INS.init = 1;
|
||||
else
|
||||
return (attitude_t *)&INS.Gyro;
|
||||
return &INS;
|
||||
|
||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_4);
|
||||
|
||||
@@ -112,7 +112,7 @@ attitude_t *INS_Init(void)
|
||||
// noise of accel is relatively big and of high freq,thus lpf is used
|
||||
INS.AccelLPF = 0.0085;
|
||||
DWT_GetDeltaT(&INS_DWT_Count);
|
||||
return (attitude_t *)&INS.Gyro; // @todo: 这里偷懒了,不要这样做! 修改INT_t结构体可能会导致异常,待修复.
|
||||
return &INS;
|
||||
}
|
||||
|
||||
/* 注意以1kHz的频率运行此任务 */
|
||||
|
||||
+1
-12
@@ -25,17 +25,6 @@
|
||||
|
||||
#define INS_TASK_PERIOD 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float Gyro[3]; // 角速度
|
||||
float Accel[3]; // 加速度
|
||||
// 还需要增加角速度数据
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float YawTotalAngle;
|
||||
} attitude_t; // 最终解算得到的角度,以及yaw转动的总角度(方便多圈控制)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float q[4]; // 四元数估计值
|
||||
@@ -82,7 +71,7 @@ typedef struct
|
||||
* @brief 初始化惯导解算系统
|
||||
*
|
||||
*/
|
||||
attitude_t *INS_Init(void);
|
||||
INS_t *INS_Init(void);
|
||||
|
||||
/**
|
||||
* @brief 此函数放入实时系统中,以1kHz频率运行
|
||||
|
||||
Reference in New Issue
Block a user