45 #if FLOAT_DCM_SEND_DEBUG
48 #include "pprzlink/messages.h"
67 float DCM_Matrix[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
83 #if PERFORMANCE_REPORTING == 1
92 for (
int i = 0; i < 3; i++) {
93 for (
int j = 0; j < 3; j++) {
120 struct FloatVect3 *lp_mag __attribute__((unused)))
155 float dp = 0, dq = 0, dr = 0;
177 static float last_gps_speed_3d = 0;
184 if (gps_s->gspeed >= 500) {
211 #if USE_AHRS_GPS_ACCELERATIONS
230 MESSAGE(
"MAGNETOMETER FEEDBACK NOT TESTED YET")
244 MAG_Heading_X = mag->
x * cos_pitch + mag->
y * sin_roll * sin_pitch + mag->
z * cos_roll * sin_pitch;
267 #if FLOAT_DCM_SEND_DEBUG
280 #else // !USE_MAGNETOMETER
289 float temporary[3][3];
310 if (renorm < 1.5625f && renorm > 0.64
f) {
311 renorm = .5 * (3 - renorm);
312 }
else if (renorm < 100.0f && renorm > 0.01
f) {
313 renorm = 1. / sqrtf(renorm);
314 #if PERFORMANCE_REPORTING == 1
319 #if PERFORMANCE_REPORTING == 1
327 if (renorm < 1.5625f && renorm > 0.64
f) {
328 renorm = .5 * (3 - renorm);
329 }
else if (renorm < 100.0f && renorm > 0.01
f) {
330 renorm = 1. / sqrtf(renorm);
331 #if PERFORMANCE_REPORTING == 1
336 #if PERFORMANCE_REPORTING == 1
344 if (renorm < 1.5625f && renorm > 0.64
f) {
345 renorm = .5 * (3 - renorm);
346 }
else if (renorm < 100.0f && renorm > 0.01
f) {
347 renorm = 1. / sqrtf(renorm);
348 #if PERFORMANCE_REPORTING == 1
353 #if PERFORMANCE_REPORTING == 1
368 #ifndef ACCEL_WEIGHT_FILTER
369 #define ACCEL_WEIGHT_FILTER 8
375 #ifndef ACCEL_WEIGHT_BAND
376 #define ACCEL_WEIGHT_BAND 1.f
382 static float Scaled_Omega_P[3];
383 static float Scaled_Omega_I[3];
384 static float Accel_filtered = 0.f;
385 float Accel_magnitude;
387 float Integrator_magnitude;
390 float errorRollPitch[3];
398 Accel_magnitude = Accel_magnitude /
GRAVITY;
399 #if ACCEL_WEIGHT_FILTER
401 #else // set ACCEL_WEIGHT_FILTER to 0 to disable filter
402 Accel_filtered = Accel_magnitude;
409 #if PERFORMANCE_REPORTING == 1
412 float tempfloat = ((Accel_weight - 0.5) * 256.0f);
442 #else // Use GPS Ground course to correct yaw gyro drift
446 float COGX = cosf(
course);
447 float COGY = sinf(
course);
459 #if USE_MAGNETOMETER_ONGROUND
460 PRINT_CONFIG_MSG(
"AHRS_FLOAT_DCM uses magnetometer prior to takeoff and GPS during flight")
473 #endif // USE_MAGNETOMETER_ONGROUND
478 if (Integrator_magnitude > RadOfDeg(300)) {
491 #if OUTPUTMODE==1 // With corrected data (drift correction)
501 #else // Uncorrected data (no drift correction)
515 for (
int x = 0;
x < 3;
x++) {
516 for (
int y = 0;
y < 3;
y++) {
524 #if (OUTPUTMODE==2) // Only accelerometer info (debugging purposes)