Ian Hua / Quadcopter-mbedRTOS
Revision:
5:4879ef0e6d41
Parent:
3:605fbcb54e75
Child:
7:3d28cfc4901b
--- a/RTOS-Threads/src/Task2.cpp	Wed Apr 30 06:37:42 2014 +0000
+++ b/RTOS-Threads/src/Task2.cpp	Wed Apr 30 07:13:11 2014 +0000
@@ -12,22 +12,26 @@
 
 void Task2(void const *argument)
 {
-    yawPIDrate.setSetPoint(RCCommand[0]);
-    pitchPIDrate.setSetPoint(RCCommand[1]);
-    rollPIDrate.setSetPoint(RCCommand[2]);
-    
+    yawPIDrate.setSetPoint((RCCommand[0]-1500)*9/10);
+    pitchPIDrate.setSetPoint((RCCommand[1]-1500)*-1*9/10);
+    rollPIDrate.setSetPoint((RCCommand[2]-1500)*9/10);
+
     imu.getRotation(&gx, &gy, &gz);
     gx /= 32.8;
+    gx += 2;
     gy /= 32.8;
     gz /= 32.8;
-    
+
+    if (gyro_out)
+        BT.printf("%4d %4d %4d\n", gx, gy, gz);
+
     yawPIDrate.setProcessValue(gz);
     pitchPIDrate.setProcessValue(gy);
-    rollPIDrate.setProcessValue(gz);
-    
+    rollPIDrate.setProcessValue(gx);
+
     yaw_adjust = yawPIDrate.compute();
     pitch_adjust = pitchPIDrate.compute();
     roll_adjust = rollPIDrate.compute();
-    
+
     //LED[2] = !LED[2];
 }
\ No newline at end of file