The final program for the #include AIR robot

Dependencies:   Biquad HIDScope QEI angleandposition controlandadjust mbed

Fork of includeair by BioRobotics

Revision:
30:cd4d9754a357
Parent:
29:cd47a5a772db
Child:
31:8646e853979f
--- a/main.cpp	Tue Oct 27 16:16:36 2015 +0000
+++ b/main.cpp	Wed Oct 28 10:48:23 2015 +0000
@@ -100,7 +100,7 @@
 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.25;// time it can take to shoot
+const float timetoshoot=0.5;// time it can take to shoot
 const float timetogoback=0.5;// time it can take to go back after shooting
 
 float desired_position=0;
@@ -159,12 +159,12 @@
 //gather data and send to scope
 void scopedata()
 {
-    scope.set(0,desired_position);
-    scope.set(1,emg1_input.read());
-    scope.set(2,emg2_input.read());
-    scope.set(3,filteredsignal1);
-    scope.set(4,filteredsignal2);
-    scope.set(5,threshold_value);
+    scope.set(0,desired_position-anglepos.angletoposition(counttorad*encoder1.getPulses(),counttorad*encoder2.getPulses()));
+    scope.set(1,anglepos.angletoposition_y(counttorad*encoder1.getPulses(),counttorad*encoder2.getPulses()));
+    scope.set(2,error1*radtodeg);
+    scope.set(3,error2*radtodeg);
+    scope.set(4,mycontroller.motor1pwm());
+    scope.set(5,mycontroller.motor2pwm());
     scope.send();
 }
 //read potmeters and adjust the safetyfactor and threshold
@@ -211,7 +211,7 @@
 
     filteredsignal1=(pass7_emg1*9e11*filter_extragain);
     filteredsignal2=(pass7_emg2*9e11*filter_extragain);
-    
+
     if (makeempty==true) {//this is needed so the filtered value is nog high after shooting
         pass1_emg1 = pass1_emg2 =pass2_emg1 =pass2_emg2 =pass3_emg1 = pass3_emg2 =pass4_emg1 =pass4_emg2 =pass5_emg1 =pass5_emg2 =0;
         pass5_emg1_abs=pass5_emg2_abs=pass6_emg1 =pass6_emg2 =pass7_emg1=pass7_emg2 =filteredsignal1=filteredsignal2=0;
@@ -248,7 +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());
+    float x_punch=anglepos.angletoposition(counttorad*encoder1.getPulses(),counttorad*encoder2.getPulses());
     Timer shoottimer;
     shoottimer.reset();
     shoottimer.start();