Quadcopter software. Flying - Contact me for more details or a copy of the PC ground station code

Dependencies:   ConfigFile PID PPM MODSERIAL mbed-rtos mbed MaxbotixDriver TinyGPS filter

Revision:
9:7b194f83e567
Parent:
7:bc5822aa8878
--- a/flightController.h	Tue Feb 10 20:58:12 2015 +0000
+++ b/flightController.h	Sun Feb 22 20:10:12 2015 +0000
@@ -8,10 +8,7 @@
 void NotFlying();
 
 //Variables
-float           _yawTarget = 0;
 int             _notFlying = 0; 
-float           _altitude = 0;
-double          _basePower = 0;
 
 //Timers
 RtosTimer       *_flightControllerUpdateTimer;
@@ -184,42 +181,25 @@
 
 void GetAttitude()
 {
-    //Use the 2 spare channels to alter the offset
-    if(_levelOffset == true)
-    {
-        float pitchOffset = /*_channel7MedianFilter->process(*/Map(_rcCommands[6], RC_OUT_MIN, RC_OUT_MAX, -5, 5);//);
-        float rollOffset = /*_channel8MedianFilter->process(*/Map(_rcCommands[7], RC_OUT_MIN, RC_OUT_MAX, -5, 5);//);
-        
-        _zeroValues[1] = _oldZeroValues[1] + pitchOffset;
-        _zeroValues[2] = _oldZeroValues[2] + rollOffset;
-    }
-    else 
-    {
-        _oldZeroValues[1] = _zeroValues[1];
-        _oldZeroValues[2] = _zeroValues[2];
-    }
-    
-    //_zeroValues[1] = _rcCommands[6];
-    //_zeroValues[2] = _rcCommands[7];
     
     //Get raw data from IMU
     _freeIMU.getYawPitchRoll(_ypr);
     _freeIMU.getRate(_gyroRate);
     
-    //Take off zero values to account for any angle inbetween the PCB level and ground
-    _ypr[1] = _ypr[1] - _zeroValues[1];
-    _ypr[2] = _ypr[2] - _zeroValues[2];
+    //Take off zero values to account for any angle inbetween level and ground
+    //_ypr[1] = _ypr[1] - _zeroValues[1];
+    //_ypr[2] = _ypr[2] - _zeroValues[2];
     
     //Swap pitch and roll angle because IMU is mounted at a right angle to the board
-    float yaw = _ypr[0];
     float pitch = _ypr[2];
-    float roll = - _ypr[1]; //Needs to be negative
-    _ypr[0] = yaw;
+    float roll = -_ypr[1];
     _ypr[1] = pitch;
     _ypr[2] = roll;
     
-    //Swap pitch, roll and yaw? rate because IMU is mounted at a right angle to the board
-    yaw = _gyroRate[2];
+    _ypr[0] = _ypr[0];
+    
+    //Swap pitch, roll and yaw rate because IMU is mounted at a right angle to the board
+    float yaw = _gyroRate[2];
     pitch = _gyroRate[0];
     roll = _gyroRate[1];
     _gyroRate[0] = yaw;