My fully self designed first stable working Quadrocopter Software.

Dependencies:   mbed

Dependents:   fluy343

/media/uploads/maetugr/dsc09031.jpg

Revision:
4:b0a60b0b24a9
Parent:
0:12950aa67f2a
Child:
10:14390c90c3f5
--- a/IMU/IMU_10DOF.cpp	Tue Sep 24 15:15:39 2013 +0000
+++ b/IMU/IMU_10DOF.cpp	Sat Feb 15 14:28:11 2014 +0000
@@ -1,6 +1,6 @@
 #include "IMU_10DOF.h"
 
-IMU_10DOF::IMU_10DOF(PinName sda, PinName scl) : Gyro(sda, scl), Acc(sda, scl), Comp(sda, scl), Alt(sda,scl)
+IMU_10DOF::IMU_10DOF(PinName sda, PinName scl) : Sensor(p28, p27), Gyro(sda, scl), Acc(sda, scl), Comp(sda, scl), Alt(sda,scl)
 {
     dt = 0;
     dt_sensors = 0;
@@ -9,22 +9,26 @@
     
     angle = Filter.angle;           // initialize array pointer
     
+    Sensor.calibrate(50, 0.02);
+    
     LocalTimer.start();
 }
 
 void IMU_10DOF::readAngles()
 {
     time_for_dt_sensors = LocalTimer.read(); // start time for measuring sensors
-    Gyro.read(); // reading sensor data
-    Acc.read();
-    Comp.read();    
+    Sensor.read();
+    //Gyro.read(); // reading sensor data
+    //Acc.read();
+    //Comp.read();    
     dt_sensors = LocalTimer.read() - time_for_dt_sensors; // stop time for measuring sensors
 
     // meassure dt for the filter
     dt = LocalTimer.read() - time_for_dt; // time in s since last loop
     time_for_dt = LocalTimer.read();      // set new time for next measurement
     
-    Filter.compute(dt, Gyro.data, Acc.data, Comp.data);
+    Filter.compute(dt, Sensor.data_gyro, Sensor.data_acc, Comp.data);
+    //Filter.compute(dt, Gyro.data, Acc.data, Comp.data);
 }
 
 void IMU_10DOF::readAltitude()