The final program for the #include AIR robot

Dependencies:   Biquad HIDScope QEI angleandposition controlandadjust mbed

Fork of includeair by BioRobotics

Revision:
34:bc2d64e86cb9
Parent:
33:1c7b498ded25
Child:
35:0141a1fe8138
--- a/main.cpp	Wed Oct 28 14:58:35 2015 +0000
+++ b/main.cpp	Thu Oct 29 10:35:42 2015 +0000
@@ -100,16 +100,16 @@
 
 
 //////////////////////////////// POSITION AND ANGLE SHIZZLE
-const float safetymarginfield=0.1; //adjustable, tweak for maximum but safe range
-const float mm_per_sec_emg=0.1;// move the pod 100 mm per sec if muscle is flexed
-const float y_start=0.145;//starting y position of the pod
-const float y_punch=0.473;// position to where there is punched
-const float timetoshoot=0.35;// time it can take to shoot
-const float timetogoback=1;// time it can take to go back after shooting
+const double safetymarginfield=0.1; //adjustable, tweak for maximum but safe range
+const double mm_per_sec_emg=0.1;// move the pod 100 mm per sec if muscle is flexed
+const double y_start=0.145;//starting y position of the pod
+const double y_punch=0.473;// position to where there is punched
+const double timetoshoot=0.35;// time it can take to shoot
+const double timetogoback=1;// time it can take to go back after shooting
 
-float desired_position=0;
-float desired_angle1=0;
-float desired_angle2=0;
+double desired_position=0;
+double desired_angle1=0;
+double desired_angle2=0;
 
 const float fieldwidth=0.473;
 const float maxdisplacement=((fieldwidth/2)-safetymarginfield); //so the pod doesn't hit the edges of the playfield
@@ -280,6 +280,7 @@
     shoottimer.reset();
     stepsize=(PIE)/(timetogoback*control_frequency);
     profile_angle=0;
+    desired_position=0;
     while (time<=timetogoback) {
         ledblue=!ledblue;
 
@@ -291,8 +292,9 @@
             y_during_punch=y_during_punch;
         }
 
-        desired_angle1=anglepos.positiontoangle1(x_punch,y_during_punch);// calculate desired angles
-        desired_angle2=anglepos.positiontoangle2(x_punch,y_during_punch);
+        desired_angle1=anglepos.positiontoangle1(desired_position,y_during_punch);// calculate desired angles
+        desired_angle2=anglepos.positiontoangle2(desired_position,y_during_punch);
+        
 
         error1=(desired_angle1-counttorad*encoder1.getPulses());//calculate errors
         error2=(desired_angle2-counttorad*encoder2.getPulses());