2nd draft

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed Servo

Fork of robot_mockup by Martijn Kern

Files at this revision

API Documentation at this revision

Comitter:
Vigilance88
Date:
Tue Oct 27 09:32:06 2015 +0000
Parent:
51:e4a0ce7ff4b8
Child:
53:bf0d97487e84
Commit message:
met deze gains werkt het redelijk bij ouder filter

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 27 09:09:56 2015 +0000
+++ b/main.cpp	Tue Oct 27 09:32:06 2015 +0000
@@ -103,7 +103,6 @@
 double movavg2[window];
 double movavg3[window];
 double movavg4[window];
-double sum1, sum2, sum3, sum4;                  //sum of the entire window
 double biceps_avg, triceps_avg,flexor_avg, extens_avg;  //sum divided by window size
 
 int muscle;             //Muscle selector for MVC measurement, 1 = first emg etc.
@@ -517,12 +516,19 @@
     biceps_power = abs(biceps_power); triceps_power = abs(triceps_power); flexor_power = abs(flexor_power); extens_power = abs(extens_power);
     biceps_power = lowpass.step(biceps_power); triceps_power = lowpass2.step(triceps_power); flexor_power = lowpass3.step(flexor_power); extens_power = lowpass4.step(extens_power);
    
-    
+    //send filtered emg to scope 
     //scope.set(0,biceps_power);
     //scope.set(1,triceps_power);
     //scope.set(2,flexor_power);
     //scope.set(3,extens_power);
     //scope.send();
+    
+    //send normalized emg to scope 
+    scope.set(0,biceps);
+    scope.set(1,triceps);
+    scope.set(2,flexor);
+    scope.set(3,extens);
+    scope.send();
        
 }
 
@@ -864,16 +870,8 @@
     keep_in_range(&flexor,0,1);
     keep_in_range(&extens,0,1);
     
-    //send normalized emg to scope to compare with just filtered emg.
-    scope.set(0,biceps);
-    scope.set(1,triceps);
-    scope.set(2,flexor);
-    scope.set(3,extens);
-    scope.send();
     
-    //threshold detection! buffer or two thresholds? If average of 100 samples > threshold, then muscle considered on.
-     
-    
+    //threshold detection! buffer or two thresholds? If average of 100 samples > threshold, then muscle considered on.    
     movavg1[i]=biceps;   //fill array with 100 normalized samples
     movavg2[i]=triceps;
     movavg3[i]=flexor;