This is my quadcopter prototype software, still in development!

Files at this revision

API Documentation at this revision

Comitter:
Anaesthetix
Date:
Tue Jul 23 14:01:42 2013 +0000
Parent:
0:978110f7f027
Commit message:
Other accelerometer added

Changed in this revision

quadv3/gyro.h Show annotated file Show diff for this revision Revisions of this file
quadv3/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/quadv3/gyro.h	Wed Jan 30 13:14:44 2013 +0000
+++ b/quadv3/gyro.h	Tue Jul 23 14:01:42 2013 +0000
@@ -133,7 +133,7 @@
     
     
     //Moving avarage filter
-    xangle[0] = ax;
+    xangle[0] = (ax + 6);
     ax1 = ((0.025*xangle[0]) + (0.025*xangle[1]) + (0.025*xangle[2]) + (0.025*xangle[3]) + (0.025*xangle[4]) + (0.025*xangle[5]) + (0.025*xangle[6]) + (0.025*xangle[7]) + (0.025*xangle[8]) + (0.025*xangle[9]) + (0.025*xangle[10]) + (0.025*xangle[11]) + (0.025*xangle[12]) + (0.025*xangle[13]) + (0.025*xangle[14]) + (0.025*xangle[15]) + (0.025*xangle[16]) + (0.025*xangle[17]) + (0.025*xangle[18]) + (0.025*xangle[19]) + (0.025*xangle[20]) + (0.025*xangle[21]) + (0.025*xangle[22]) + (0.025*xangle[23]) + (0.025*xangle[24]) + (0.025*xangle[25]) + (0.025*xangle[26]) + (0.025*xangle[27]) + (0.025*xangle[28]) + (0.025*xangle[29]) + (0.025*xangle[30]) + (0.025*xangle[31]) + (0.025*xangle[32]) + (0.025*xangle[33]) + (0.025*xangle[34]) + (0.025*xangle[35]) + (0.025*xangle[36]) + (0.025*xangle[37]) + (0.025*xangle[38]) + (0.025*xangle[39]));
     xangle[39] = xangle[38]; 
     xangle[38] = xangle[37];
--- a/quadv3/main.cpp	Wed Jan 30 13:14:44 2013 +0000
+++ b/quadv3/main.cpp	Tue Jul 23 14:01:42 2013 +0000
@@ -31,9 +31,7 @@
 #include "gyro.h"
 #include "IOMacros.h"
 #include "pwmout.h"
-#include "TextLCD.h"
 
-TextLCD lcd(p11, p12, p13, p14, p15, p16, TextLCD::LCD16x2);
 DigitalOut myled(LED1);
 
 Timer trudder;
@@ -102,8 +100,9 @@
     m4 = throttle;
 
     //Calc aileron compensation and mix with rx input
-    xcomp = (((((newax)-xsteering)*(1-ratio)) + ((yag+((newax-xsteering)*0.7))*ratio))*0.8);
-    xcomp2 = xcomp;
+    xcomp = (((((newax)-xsteering)*(1-ratio)) + ((yag+((newax-xsteering)*0.7))*ratio))*1.10);
+    xcomp2 = (xcomp*-1);
+ //   xcomp2 = 0;
 
     //Mix aileron
     m1 = m1 - xcomp2;
@@ -112,8 +111,9 @@
     m4 = m4 - xcomp2;
 
     //Calc elevator compensation and mix with rx input
-    ycomp = (((((neway)+ysteering)*(1-ratio)) + ((xag+((neway+ysteering)*0.7))*ratio))*0.8);
+    ycomp = (((((neway)+ysteering)*(1-ratio)) + ((xag+((neway+ysteering)*0.7))*ratio))*1.10);
     ycomp2 = ycomp;
+   // ycomp2 = 0;
 
     //Mix elevator
     m1 = m1 - ycomp2;
@@ -121,8 +121,8 @@
     m3 = m3 + ycomp2;
     m4 = m4 + ycomp2;
 
-    //Calc rudder compensation and mix with rx input
-    ruddercomp = (rud + (zarg*1));
+    //Calc rudder compensation and mix with rx input -> PI-controller?
+    ruddercomp = (rud + (zarg*1));  //has drift
     zcomp = ruddercomp;
 
     //Mix rudder