2023-12-22 15:24:39 +08:00
|
|
|
#ifndef _BY_IMU_H__
|
|
|
|
|
#define _BY_IMU_H__
|
|
|
|
|
|
|
|
|
|
#include "stdio.h"
|
|
|
|
|
#include "ch32v30x.h"
|
2023-12-22 22:39:59 +08:00
|
|
|
typedef struct {
|
|
|
|
|
float gyro_x;
|
|
|
|
|
float gyro_y;
|
|
|
|
|
float gyro_z;
|
|
|
|
|
float acc_x;
|
|
|
|
|
float acc_y;
|
|
|
|
|
float acc_z;
|
|
|
|
|
} icm_param_t;
|
2023-12-22 15:24:39 +08:00
|
|
|
|
2023-12-22 22:39:59 +08:00
|
|
|
typedef struct {
|
|
|
|
|
float q0;
|
|
|
|
|
float q1;
|
|
|
|
|
float q2;
|
|
|
|
|
float q3;
|
|
|
|
|
} quater_param_t;
|
2023-12-22 15:24:39 +08:00
|
|
|
|
2023-12-22 22:39:59 +08:00
|
|
|
typedef struct {
|
|
|
|
|
float pitch; //俯仰角
|
|
|
|
|
float roll; //偏航角
|
|
|
|
|
float yaw; //翻滚角
|
|
|
|
|
} euler_param_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
float Xdata;
|
|
|
|
|
float Ydata;
|
|
|
|
|
float Zdata;
|
|
|
|
|
} gyro_param_t;
|
|
|
|
|
|
|
|
|
|
extern icm_param_t icm_data;
|
|
|
|
|
extern euler_param_t eulerAngle;
|
|
|
|
|
|
|
|
|
|
void gyroOffset_init(void);
|
|
|
|
|
|
|
|
|
|
float fast_sqrt(float x);
|
|
|
|
|
|
|
|
|
|
void ICM_AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az);
|
|
|
|
|
|
|
|
|
|
void ICM_getValues();
|
|
|
|
|
|
|
|
|
|
void ICM_getEulerianAngles(void);
|
2023-12-22 15:24:39 +08:00
|
|
|
#endif
|