38 #ifdef INCLUDE_DEBUG_FUNCTIONS 42 volatile static uint16_t iTestProgress;
43 volatile static uint16_t iTestDelay = 0;
45 volatile float angle=0.0f;
46 volatile static float threshold=0;
148 switch (quaternionPacketType) {
151 CurrentQ = sfg->SV_3DOF_G_BASIC.fLPq;
152 qAeqAxB(&(sfg->SV_3DOF_G_BASIC.fLPq), &ftmpq);
157 CurrentQ = sfg->SV_3DOF_B_BASIC.fLPq;
158 qAeqAxB(&(sfg->SV_3DOF_B_BASIC.fLPq), &ftmpq);
163 CurrentQ = sfg->SV_3DOF_Y_BASIC.fq;
164 qAeqAxB(&(sfg->SV_3DOF_Y_BASIC.fq), &ftmpq);
169 CurrentQ = sfg->SV_6DOF_GB_BASIC.fLPq;
170 qAeqAxB(&(sfg->SV_6DOF_GB_BASIC.fLPq), &ftmpq);
175 CurrentQ = sfg->SV_6DOF_GY_KALMAN.fqPl;
176 qAeqAxB(&(sfg->SV_6DOF_GY_KALMAN.fqPl), &ftmpq);
179 #if F_9DOF_GBY_KALMAN 181 CurrentQ = sfg->SV_9DOF_GBY_KALMAN.fqPl;
182 qAeqAxB(&(sfg->SV_9DOF_GBY_KALMAN.fqPl), &ftmpq);
194 switch (iTestProgress) {
203 StartingQ.
q0 = CurrentQ.
q0;
204 StartingQ.
q1 = -1 * CurrentQ.
q1;
205 StartingQ.
q2 = -1 * CurrentQ.
q2;
206 StartingQ.
q3 = -1 * CurrentQ.
q3;
211 qAeqAxB(&CurrentQ, &StartingQ);
213 angle = fmod(fabs(angle), 180.0);
220 if (angle<threshold) iTestProgress=2;
221 if (angle < (0.2 * threshold)) iTestProgress=0;
222 if (iTestDelay>100) iTestProgress=0;
float q2
y vector component
volatile uint8_t iPerturbation
test perturbation to be applied
enum quaternion quaternion_type
the quaternion type to be transmitted
Quaternion derived from 3-axis accel + 3 axis mag (eCompass)
Defines control sub-system.
The top level fusion structure.
#define F180OVERPI
radians to degrees conversion = 180 / pi
Quaternion derived from 3-axis accel (tilt)
Quaternion derived from 3-axis mag only (auto compass algorithm)
quaternion structure definition
#define ONEOVERSQRT2
1/sqrt(2)
float q3
z vector component
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART
Quaternion derived from full 9-axis sensor fusion.
The sensor_fusion.h file implements the top level programming interface.
struct ControlSubsystem * pControlSubsystem
Quaternion derived from 3-axis gyro only (rotation)
float q1
x vector component
void ApplyPerturbation(SensorFusionGlobals *sfg)
Quaternion derived from 3-axis accel + 3-axis gyro (gaming)
void qAeqAxB(Quaternion *pqA, const Quaternion *pqB)
function compute the quaternion product qA = qA * qB