AvrIO  1.4.5
Bibliothèque C modulaire pour ATMEL AVR
imu6d.h
1 
23 #ifndef _AVRIO_IMU6D_H_
24 #define _AVRIO_IMU6D_H_
25 
26 #include <avrio/defs.h>
27 
28 __BEGIN_C_DECLS
29 /* ========================================================================== */
30 #include <avrio/vector3f.h>
31 #include <avrio/quaternionf.h>
32 
44 /* structures =============================================================== */
49 typedef struct xImu6dFilter {
50 
51  // Quatfernion orientation of earth frame relative to auxiliary frame.
52  xQuatf xAEq;
53 
54  // Estimated orientation quaternionf elements with initial conditions.
55  xQuatf xSEq;
56 
57  // Attitude Vector (Euler Angles)
58  float xAtt[3];
59 
60  // Sampling period
61  float fDeltaT;
62 
63  // Gyroscope measurement error (in degrees per second).
64  float fGyroMeasError;
65 
66  // Compute fBeta (filter tuning constant...)
67  float fBeta;
68 
69  // Initializer boolean
70  bool bFirstUpdate;
71 
72 } xImu6dFilter;
73 
74 
75 /* internal public functions ================================================ */
86 void vImu6dInit (xImu6dFilter * xFilter, float fFilterRate, float fGyroError);
87 
95 void vImu6dUpdateFilter(xImu6dFilter * xFilter, float * xAcc, float * xRate);
96 
102 void vImu6dComputeEuler(xImu6dFilter * xFilter);
103 
107 void vImu6dReset(xImu6dFilter * xFilter);
108 
109 # if defined(__DOXYGEN__)
110 /*
111  * __DOXYGEN__ defined
112  * Partie documentation ne devant pas être compilée.
113  * =============================================================================
114  */
120 float fImu6dRoll(xImu6dFilter * xFilter);
121 
127 float fImu6dPitch(xImu6dFilter * xFilter);
128 
134 float fImu6dYaw(xImu6dFilter * xFilter);
135 
141 # else
142 /*
143  * __DOXYGEN__ not defined
144  * Partie ne devant pas être documentée.
145  * =============================================================================
146  */
147 
148 // -----------------------------------------------------------------------------
149 __STATIC_ALWAYS_INLINE (float
150 fImu6dRoll(xImu6dFilter * xFilter)) {
151 
152  return xFilter->xAtt[0];
153 }
154 
155 // -----------------------------------------------------------------------------
156 __STATIC_ALWAYS_INLINE (float
157 fImu6dPitch(xImu6dFilter * xFilter)) {
158 
159  return xFilter->xAtt[1];
160 }
161 
162 // -----------------------------------------------------------------------------
163 __STATIC_ALWAYS_INLINE (float
164 fImu6dYaw(xImu6dFilter * xFilter)) {
165 
166  return xFilter->xAtt[2];
167 }
168 
169 /* public variables ========================================================= */
170 
171 # endif /* __DOXYGEN__ not defined */
172 /* ========================================================================== */
173 __END_C_DECLS
174 #endif /* _AVRIO_IMU6D_H_ not defined */
void vImu6dComputeEuler(xImu6dFilter *xFilter)
void vImu6dReset(xImu6dFilter *xFilter)
float fImu6dYaw(xImu6dFilter *xFilter)
float fImu6dPitch(xImu6dFilter *xFilter)
Données du filtre Imu6d.
Definition: imu6d.h:49
void vImu6dInit(xImu6dFilter *xFilter, float fFilterRate, float fGyroError)
void vImu6dUpdateFilter(xImu6dFilter *xFilter, float *xAcc, float *xRate)
float fImu6dRoll(xImu6dFilter *xFilter)