Ian Hua / Quadcopter-mbedRTOS
Revision:
24:54a8cdf17378
Parent:
22:ef8aa9728013
Child:
25:a7cfe421cb4a
--- a/RTOS-Setup/src/setup.cpp	Thu May 08 10:49:38 2014 +0000
+++ b/RTOS-Setup/src/setup.cpp	Thu May 08 13:00:50 2014 +0000
@@ -4,11 +4,11 @@
  * Purpose: Setup code to initialise all device
  */
 
-float KP_PITCH_STABLE = 0.0;
-float KP_ROLL_STABLE = 0.0;
-float KP_YAW_RATE = 8.5;
-float KP_PITCH_RATE = 8.5;
-float KP_ROLL_RATE = 8.5;
+float KP_PITCH_STABLE = 0.5;
+float KP_ROLL_STABLE = 0.5;
+float KP_YAW_RATE = 8.5; // 8.5 for RATE MODE
+float KP_PITCH_RATE = 8.0; // 8.5 for RATE MODE
+float KP_ROLL_RATE = 8.0; // 8.5 for RATE MODE
 
 float PID_TI_RATE = 0.0;
 float PID_TI_STABLE = 0.0;
@@ -112,12 +112,12 @@
 bool setup_PID(void)
 {
     pitchPIDstable.setInputLimits(-90.0, 90.0);
-    pitchPIDstable.setOutputLimits(-500, 500.0);
+    pitchPIDstable.setOutputLimits(-250, 250.0);
     pitchPIDstable.setBias(0.0);
     pitchPIDstable.setMode(AUTO_MODE);
 
     rollPIDstable.setInputLimits(-90.0, 90.0);
-    rollPIDstable.setOutputLimits(-500, 500.0);
+    rollPIDstable.setOutputLimits(-250, 250.0);
     rollPIDstable.setBias(0.0);
     rollPIDstable.setMode(AUTO_MODE);
 
@@ -135,6 +135,12 @@
     rollPIDrate.setOutputLimits(-200.0, 200.0);
     rollPIDrate.setBias(0.0);
     rollPIDrate.setMode(AUTO_MODE);
+    
+    pitchPIDstable.reset();
+    rollPIDstable.reset();
+    yawPIDrate.reset();
+    pitchPIDrate.reset();
+    rollPIDrate.reset();
 
     return true;
 }