AHRS

Dependencies:   Eigen

Dependents:   IndNav_QK3_T265

Revision:
20:1182bc29c195
Parent:
19:42ea6dd68185
Child:
21:31e01d3e0143
--- a/AHRS.h	Wed Oct 02 15:30:15 2019 +0000
+++ b/AHRS.h	Wed Oct 09 13:45:36 2019 +0000
@@ -1,3 +1,7 @@
+#ifndef AHRS_H_
+#define AHRS_H_
+
+
 #include "Mahony.h"
 #include "MadgwickAHRS.h"
 #include "LinearCharacteristics.h"
@@ -5,9 +9,10 @@
 #include "Signal.h"
 #include "EKF.h"
 #include "matrix.h"
-#include "data_logger.h"
+#include "Data_Logger.h"
+#include "Read_Xtern_Sensors.h"
 
-extern data_logger my_logger;
+extern DATA_Xchange data;
 
 class AHRS
 {
@@ -20,7 +25,7 @@
     float getRoll(uint8_t ft)
     {
         if(ft ==1)
-            return RPY_filter.get_est_state(0);
+            return ekf.get_est_state(0);
         else
             return Mahony_filter.getRollRadians();
     }
@@ -28,7 +33,7 @@
     float getPitch(uint8_t ft)
     {
         if(ft ==1)
-            return RPY_filter.get_est_state(1);
+            return ekf.get_est_state(1);
         else
             return Mahony_filter.getPitchRadians();
     }
@@ -40,7 +45,7 @@
 
     LSM9DS1 imu;
     Mahony Mahony_filter;
-    EKF RPY_filter;
+    EKF ekf;
     LinearCharacteristics raw_gx2gx;
     LinearCharacteristics raw_gy2gy;
     LinearCharacteristics raw_gz2gz;
@@ -50,6 +55,7 @@
     LinearCharacteristics raw_mx2mx;
     LinearCharacteristics raw_my2my;
     LinearCharacteristics raw_mz2mz;
+    void read_imu_sensors(void);
     float xyzUS[3];
     float xyzAS[3];
     float rxryrzUS[3];
@@ -57,15 +63,20 @@
     float xyzOF[3];
     float xyzLIDAR[3];
     float magnet_cal_0[3];
-
+    void update();
+    void update_as_thread(void);
+    void start_loop(void);
 private:
 
+    float local_time;
+    uint8_t filtertype;
     Signal signal;
     Thread thread;
     Ticker ticker;
-    Mutex mutex;      // mutex to lock critical sections
     void sendSignal();
-    float local_time;
-    void update();
-    uint8_t filtertype;
+    float Ts;
+    //DigitalOut dout3;
+
 };
+
+#endif
\ No newline at end of file