The final program for the #include AIR robot

Dependencies:   Biquad HIDScope controlandadjust mbed QEI angleandposition

Files at this revision

API Documentation at this revision

Comitter:
Gerth
Date:
Tue Oct 27 16:16:36 2015 +0000
Parent:
28:71a90073e482
Child:
30:cd4d9754a357
Commit message:
Now using the calculated x position when shooting

Changed in this revision

angleandposition.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/angleandposition.lib	Tue Oct 27 13:05:36 2015 +0000
+++ b/angleandposition.lib	Tue Oct 27 16:16:36 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/BioRobotics1/code/angleandposition/#b99fef8df97e
+https://developer.mbed.org/teams/BioRobotics1/code/angleandposition/#067c75c62882
--- a/main.cpp	Tue Oct 27 13:05:36 2015 +0000
+++ b/main.cpp	Tue Oct 27 16:16:36 2015 +0000
@@ -248,6 +248,7 @@
     float stepsize=(y_punch-y_start)/(timetoshoot*control_frequency);
     float y_during_punch=y_start;// set initial y position to start position
 
+float x_punch=anglepos.angletoposition(counttorad*encoder1.getPulses(),counttorad*encoder2.getPulses());
     Timer shoottimer;
     shoottimer.reset();
     shoottimer.start();
@@ -262,8 +263,8 @@
             y_during_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);
+        desired_angle1=anglepos.positiontoangle1(x_punch,y_during_punch);// calculate desired angles
+        desired_angle2=anglepos.positiontoangle2(x_punch,y_during_punch);
 
         error1=(desired_angle1-counttorad*encoder1.getPulses());//calculate errors
         error2=(desired_angle2-counttorad*encoder2.getPulses());
@@ -290,8 +291,8 @@
             y_during_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);
+        desired_angle1=anglepos.positiontoangle1(x_punch,y_during_punch);// calculate desired angles
+        desired_angle2=anglepos.positiontoangle2(x_punch,y_during_punch);
 
         error1=(desired_angle1-counttorad*encoder1.getPulses());//calculate errors
         error2=(desired_angle2-counttorad*encoder2.getPulses());