将os任务的创建统一转移到app层方便修改,使得架构更加清晰.修复了INS未初始化导致的读取错误

This commit is contained in:
NeoZng
2023-06-05 22:43:25 +08:00
parent 253f391cd5
commit 72884ef96b
9 changed files with 136 additions and 100 deletions

View File

@@ -150,7 +150,7 @@ float PIDCalculate(PIDInstance *pid, float measure, float ref)
if (pid->Improve & PID_ErrorHandle)
f_PID_ErrorHandle(pid);
pid->dt = DWT_GetDeltaT((void *)&pid->DWT_CNT); // 获取两次pid计算的时间间隔,用于积分和微分
pid->dt = DWT_GetDeltaT(&pid->DWT_CNT); // 获取两次pid计算的时间间隔,用于积分和微分
// 保存上次的测量值和误差,计算当前error
pid->Measure = measure;

View File

@@ -74,6 +74,11 @@ static void InitQuaternion(float *init_q4)
attitude_t *INS_Init(void)
{
if (!INS.init)
INS.init = 1;
else
return (attitude_t *)&INS.Gyro;
while (BMI088Init(&hspi1, 1) != BMI088_NO_ERROR)
;
IMU_Param.scale[X] = 1;

View File

@@ -62,6 +62,8 @@ typedef struct
float Pitch;
float Yaw;
float YawTotalAngle;
uint8_t init;
} INS_t;
/* 用于修正安装误差的参数 */