16 lines
603 B
C
16 lines
603 B
C
#ifndef MADGWICK_FILTER_H
|
|||
|
|
#define MADGWICK_FILTER_H
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
float q[4]; // Quaternion: [qw, qx, qy, qz]
|
||
|
|
float beta; // Filter gain (tunes correction strength)
|
||
|
|
float sampleFreq; // Sampling frequency in Hz
|
||
|
|
} MadgwickFilter;
|
||
|
|
|
||
|
|
void MadgwickFilter_Init(MadgwickFilter* filter, float sampleFreq, float beta);
|
||
|
|
void MadgwickFilter_Update(MadgwickFilter* filter, float gx, float gy, float gz,
|
||
|
|
float ax, float ay, float az);
|
||
|
|
void MadgwickFilter_GetEulerAngles(MadgwickFilter* filter, float* roll, float* pitch, float* yaw);
|
||
|
|
|
||
|
|
#endif /* MADGWICK_FILTER_H */
|