Ian Hua / Quadcopter-mbedRTOS
Revision:
24:54a8cdf17378
Parent:
22:ef8aa9728013
Child:
25:a7cfe421cb4a
diff -r 75c0950b3592 -r 54a8cdf17378 RTOS-Threads/src/Task2.cpp
--- a/RTOS-Threads/src/Task2.cpp	Thu May 08 10:49:38 2014 +0000
+++ b/RTOS-Threads/src/Task2.cpp	Thu May 08 13:00:50 2014 +0000
@@ -32,17 +32,18 @@
     pitchPIDstable.setSetPoint(inputYPR[1]);
     rollPIDstable.setSetPoint(inputYPR[2]);
 
-    pitchPIDstable.setProcessValue(ypr[1] - ypr_offset[1]);
-    rollPIDstable.setProcessValue(ypr[2] - ypr_offset[2]);
+    pitchPIDstable.setProcessValue((int) (ypr[1] - ypr_offset[1]));
+    rollPIDstable.setProcessValue((int) (ypr[2] - ypr_offset[2]));
 
     adjust_stable[1] = pitchPIDstable.compute();
     adjust_stable[2] = rollPIDstable.compute();
+    adjust_stable[2] *= -1;
 
     yawPIDrate.setSetPoint(inputYPR[0]);
-    pitchPIDrate.setSetPoint(inputYPR[1]);
-    rollPIDrate.setSetPoint(inputYPR[2]);
-    //pitchPIDrate.setSetPoint(adjust_stable[1]);
-    //rollPIDrate.setSetPoint(adjust_stable[2]);
+    //pitchPIDrate.setSetPoint(inputYPR[1]);
+    //rollPIDrate.setSetPoint(inputYPR[2]);
+    pitchPIDrate.setSetPoint(adjust_stable[1]);
+    rollPIDrate.setSetPoint(adjust_stable[2]);
 
     yawPIDrate.setProcessValue(gyro[2]);
     pitchPIDrate.setProcessValue(gyro[1]);
@@ -53,7 +54,6 @@
     adjust[2] = rollPIDrate.compute();
 
     counterTask1 = false;
-
     counterESC = true;
 
     if (adjust_check)