Poep Hoofd / Mbed 2 deprecated PoolRobot_Code

Dependencies:   HIDScope mbed MODSERIAL QEI

Revision:
7:c17f5473f4e1
Parent:
6:452e301a105a
Child:
11:dd1976534a03
--- a/EMG.cpp	Mon Oct 16 13:07:53 2017 +0000
+++ b/EMG.cpp	Tue Oct 17 06:29:42 2017 +0000
@@ -1,41 +1,36 @@
 #include "EMG.h"
-#include"BiQuad.h"
+
 
-EMG::EMG(PinName data) : _data(data)
+EMG::EMG(PinName data) : _data(data) , MainsReject(0.940809296, -1.525271192, 0.940809296, 1.000000000, -1.525271192, 0.881618592) , 
+                                        Low_pass( 0.145323884, 0.290647768, 0.145323884, 1.000000000, -0.671029091, 0.252324626)  ,
+                                        HiPass(0.914969144, -1.829938288, 0.914969144, 1.000000000, -1.822694925, 0.837181651) , 
+                                        LoPass( 0.003621682, 0.007243363, 0.003621682, 1.000000000, -1.822694925, 0.837181651)
 {
     cntr = 0;
-}
+           
 
 
+}
 double EMG::get_notch(double data){
     
-    double a0=1,                        a1=-1.525271192436899,          a2=0.881618592363190,
-       b0=0.940809296181595,        b1=-1.525271192436899,          b2=0.940809296181595;
-           
-    BiQuad MainsReject(b0, b1, b2, a0, a1, a2);
+    
     
     return MainsReject.step(data);
     
 }
     
     
-double EMG::get_noise(double data){
+double EMG::get_noise(){
+   
    
-   double a0=1,                        a1=-0.671029090774096,          a2=0.252324626282266,
-       b0=0.145323883877042,        b1= 0.290647767754085,          b2= 0.145323883877042;
-           
-    BiQuad Low_pass(b0, b1, b2, a0, a1, a2);
     
-    return Low_pass.step(data);
+    return Low_pass.step(_data);
 }
     
     
 double EMG::get_DC(double data){
     
-    double a_0_0=1,                        a_0_1=-1.475480443592646,          a_0_2=0.586919508061190,
-       b_0_0=0.765599987913459,        b_0_1=-1.531199975826918,          b_0_2=0.765599987913459;
-           
-    BiQuad HiPass(b_0_0, b_0_1, b_0_2, a_0_0, a_0_1, a_0_2);
+    
     
     return HiPass.step(data);
     
@@ -52,10 +47,7 @@
     
 double EMG::get_envelope(double data){
     
-    double a_1_0=1,                        a_1_1=-1.982228929792529,          a_1_2=0.982385450614126,
-       b_1_0=0.00003913020539916823,    b_1_1=0.00007826041079833645,           b_1_2=0.00003913020539916823;
-           
-    BiQuad LoPass(b_1_0, b_1_1, b_1_2, a_1_0, a_1_1, a_1_2);
+   
     
     return LoPass.step(data);
 }
@@ -69,7 +61,7 @@
     }
     else
     {
-        return get_envelope(get_absolute(get_DC(get_notch(get_noise(_data)))));
+        return get_envelope(get_absolute(get_DC(get_notch(get_noise()))));
     }
     
 }
\ No newline at end of file