64 #ifdef INCLUDE_DEBUG_FUNCTIONS 68 volatile static uint16_t iTestProgress;
69 volatile static uint16_t iTestDelay = 0;
71 volatile float angle=0.0f;
72 volatile static float threshold=0;
174 switch (quaternionPacketType) {
177 CurrentQ = sfg->SV_3DOF_G_BASIC.fLPq;
178 qAeqAxB(&(sfg->SV_3DOF_G_BASIC.fLPq), &ftmpq);
183 CurrentQ = sfg->SV_3DOF_B_BASIC.fLPq;
184 qAeqAxB(&(sfg->SV_3DOF_B_BASIC.fLPq), &ftmpq);
189 CurrentQ = sfg->SV_3DOF_Y_BASIC.fq;
190 qAeqAxB(&(sfg->SV_3DOF_Y_BASIC.fq), &ftmpq);
195 CurrentQ = sfg->SV_6DOF_GB_BASIC.fLPq;
196 qAeqAxB(&(sfg->SV_6DOF_GB_BASIC.fLPq), &ftmpq);
201 CurrentQ = sfg->SV_6DOF_GY_KALMAN.fqPl;
202 qAeqAxB(&(sfg->SV_6DOF_GY_KALMAN.fqPl), &ftmpq);
205 #if F_9DOF_GBY_KALMAN 207 CurrentQ = sfg->SV_9DOF_GBY_KALMAN.fqPl;
208 qAeqAxB(&(sfg->SV_9DOF_GBY_KALMAN.fqPl), &ftmpq);
220 switch (iTestProgress) {
229 StartingQ.
q0 = CurrentQ.
q0;
230 StartingQ.
q1 = -1 * CurrentQ.
q1;
231 StartingQ.
q2 = -1 * CurrentQ.
q2;
232 StartingQ.
q3 = -1 * CurrentQ.
q3;
237 qAeqAxB(&CurrentQ, &StartingQ);
239 angle = fmod(fabs(angle), 180.0);
246 if (angle<threshold) iTestProgress=2;
247 if (angle < (0.2 * threshold)) iTestProgress=0;
248 if (iTestDelay>100) iTestProgress=0;
enum quaternion quaternion_type
the quaternion type to be transmitted
Quaternion derived from full 9-axis sensor fusion.
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART
#define ONEOVERSQRT2
1/sqrt(2)
volatile uint8_t iPerturbation
test perturbation to be applied
Quaternion derived from 3-axis mag only (auto compass algorithm)
float q1
x vector component
Quaternion derived from 3-axis gyro only (rotation)
Quaternion derived from 3-axis accel + 3 axis mag (eCompass)
Quaternion derived from 3-axis accel + 3-axis gyro (gaming)
The top level fusion structure.
void ApplyPerturbation(SensorFusionGlobals *sfg)
The sensor_fusion.h file implements the top level programming interface.
#define F180OVERPI
radians to degrees conversion = 180 / pi
float q2
y vector component
quaternion structure definition
Quaternion derived from 3-axis accel (tilt)
Defines control sub-system.
struct ControlSubsystem * pControlSubsystem
float q3
z vector component
void qAeqAxB(Quaternion *pqA, const Quaternion *pqB)
function compute the quaternion product qA = qA * qB