Biorobotics / Robot-Software

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed Servo

Revision:
25:734a26538711
Parent:
17:1f93c83e211f
Child:
41:e9d6fdf02074
--- a/help_functions/processing_chain_emg.h	Mon Oct 29 12:38:04 2018 +0000
+++ b/help_functions/processing_chain_emg.h	Mon Oct 29 14:45:01 2018 +0000
@@ -4,12 +4,17 @@
 //Define objects
 
 // filter chains for high pass, low pass and notch filters
-BiQuadChain bqc;
+BiQuadChain bqc0;
+BiQuadChain bqc1;
 
 // these are for sampling frequency 1000 Hz
-BiQuad bqlow( 0.1311, 0.2622, 0.1311, -0.7478, 0.2722);
-BiQuad bqhigh( 0.9150, -1.8299, 0.9150, -1.8227, 0.8372);
-BiQuad bqnotch( 0.9695, -1.8442, 0.9695, -1.8442, 0.9391);
+BiQuad bq0low( 0.1311, 0.2622, 0.1311, -0.7478, 0.2722);
+BiQuad bq0high( 0.9150, -1.8299, 0.9150, -1.8227, 0.8372);
+BiQuad bq0notch( 0.9695, -1.8442, 0.9695, -1.8442, 0.9391);
+
+BiQuad bq1low( 0.1311, 0.2622, 0.1311, -0.7478, 0.2722);
+BiQuad bq1high( 0.9150, -1.8299, 0.9150, -1.8227, 0.8372);
+BiQuad bq1notch( 0.9695, -1.8442, 0.9695, -1.8442, 0.9391);
 
 // old filters
 //BiQuad bqlow( 0.3767, 0.7533, 0.3767, 0.3172, 0.1894);
@@ -25,8 +30,8 @@
 void processing_chain_emg(double &raw_emg_0, double &raw_emg_1, double &process_emg_0, double &process_emg_1) {
     
     // we first filter high pass and notch, then rectifier and after that low pass
-    movavg0[n] = bqlow.step(fabs(bqc.step( raw_emg_0 )));
-    movavg1[n] = bqlow.step(fabs(bqc.step( raw_emg_1 )));
+    movavg0[n] = bq0low.step(fabs(bqc0.step( raw_emg_0 )));
+    movavg1[n] = bq1low.step(fabs(bqc1.step( raw_emg_1 )));
     
     // moving average 
     double emgavg0 = 0, emgavg1 = 0;