Bla bla

Dependencies:   HIDScope MODSERIAL Motordriver QEI Servo mbed

Fork of The_Claw_kloten by Meike Froklage

Files at this revision

API Documentation at this revision

Comitter:
Nickname
Date:
Tue Nov 01 13:16:36 2016 +0000
Parent:
7:defb5001b787
Commit message:
BLA bla;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r defb5001b787 -r 6bced66239d6 main.cpp
--- a/main.cpp	Tue Nov 01 13:02:00 2016 +0000
+++ b/main.cpp	Tue Nov 01 13:16:36 2016 +0000
@@ -117,6 +117,18 @@
 double rno2_a1 = -0.6071;
 double rno2_a2 = 0.9647;
 
+double lno3_b0 = 0.9987;
+double lno3_b1 = -1.9898;
+double lno3_b2 = 0.9987;
+double lno3_a1 = -1.9898;
+double lno3_a2 = 0.9975;
+
+double rno3_b0 = 0.9987;
+double rno3_b1 = -1.9898;
+double rno3_b2 = 0.9987;
+double rno3_a1 = -1.9898;
+double rno3_a2 = 0.9975;
+
 double lhf_b0 = 0.9355;    
 double lhf_b1 = -1.8711;   
 double lhf_b2 = 0.9355;    
@@ -146,11 +158,13 @@
 //starting values of the biquads of the corresponding filters
 double lno_v1 = 0, lno_v2 = 0;
 double lno2_v1 = 0, lno2_v2 = 0;
+double lno3_v1 = 0, lno3_v2 = 0;
 double lhf_v1 = 0, lhf_v2 = 0;
 double llf_v1 = 0, llf_v2 = 0;
 
 double rno_v1 = 0, rno_v2 = 0;
 double rno2_v1 = 0, rno2_v2 = 0;
+double rno3_v1 = 0, rno3_v2 = 0;
 double rhf_v1 = 0, rhf_v2 = 0;
 double rlf_v1 = 0, rlf_v2 = 0;
 
@@ -160,11 +174,13 @@
 */ 
 double lno_y;
 double lno2_y;
+double lno3_y;
 double lhf_y;
 double llf_y;
 double lrect_y;
 double rno_y;
 double rno2_y;
+double rno3_y;
 double rhf_y;
 double rlf_y;
 double rrect_y;
@@ -201,6 +217,16 @@
     return y;
 }
 
+double biquad_lno3(double u, double&v1 , double&v2 , const double a1 , const double a2 , const double b0 ,
+    const double b1 , const double b2 )
+{
+    double v = u - a1*v1 - a2*v2;
+    double y = b0*v + b1*v1 + b2*v2;
+    v2 = v1;
+    v1 = v;
+    return y;
+}
+
 double biquad_lhf(double u, double&v1 , double&v2 , const double a1 , const double a2 , const double b0 ,
     const double b1 , const double b2 )
 {
@@ -240,6 +266,16 @@
     return y;
 }
 
+double biquad_rno3(double u, double&v1 , double&v2 , const double a1 , const double a2 , const double b0 ,
+    const double b1 , const double b2 )
+{
+    double v = u - a1*v1 - a2*v2;
+    double y = b0*v + b1*v1 + b2*v2;
+    v2 = v1;
+    v1 = v;
+    return y;
+}
+
 double biquad_rhf(double u, double&v1 , double&v2 , const double a1 , const double a2 , const double b0 ,
     const double b1 , const double b2 )
 {
@@ -275,15 +311,17 @@
 void scopeSend(void){
     lno_y = biquad_lno(emgl.read(), lno_v1, lno_v2, lno_a1, lno_a2, lno_b0, lno_b1, lno_b2);
     lno2_y = biquad_lno2(lno_y, lno2_v1, lno2_v2, lno2_a1, lno2_a2, lno2_b0, lno2_b1, lno2_b2);
-    lhf_y = biquad_lhf(lno2_y, lhf_v1, lhf_v2, lhf_a1, lhf_a2, lhf_b0, lhf_b1, lhf_b2);
+    lno3_y = biquad_lno3(lno2_y, lno3_v1, lno3_v2, lno3_a1, lno3_a2, lno3_b0, lno3_b1, lno3_b2);
+    lhf_y = biquad_lhf(lno3_y, lhf_v1, lhf_v2, lhf_a1, lhf_a2, lhf_b0, lhf_b1, lhf_b2);
     lrect_y = fabs(lhf_y);
     llf_y = biquad_llf(lrect_y, llf_v1, llf_v2, llf_a1, llf_a2, llf_b0, llf_b1, llf_b2)/0.2;
     rno_y = biquad_rno(emgr.read(), rno_v1, rno_v2, rno_a1, rno_a2, rno_b0, rno_b1, rno_b2);
     rno2_y = biquad_rno2(rno_y, rno2_v1, rno2_v2, rno2_a1, rno2_a2, rno2_b0, rno2_b1, rno2_b2);
-    rhf_y = biquad_rhf(rno2_y, rhf_v1, rhf_v2, rhf_a1, rhf_a2, rhf_b0, rhf_b1, rhf_b2);
+    rno3_y = biquad_rno3(rno2_y, rno3_v1, rno3_v2, rno3_a1, rno3_a2, rno3_b0, rno3_b1, rno3_b2);    
+    rhf_y = biquad_rhf(rno3_y, rhf_v1, rhf_v2, rhf_a1, rhf_a2, rhf_b0, rhf_b1, rhf_b2);
     rrect_y = fabs(rhf_y);
     rlf_y = biquad_rlf(rrect_y, rlf_v1, rlf_v2, rlf_a1, rlf_a2, rlf_b0, rlf_b1, rlf_b2)/0.2;  
-       scope.set(1, llf_y);
+    scope.set(1, llf_y);
     scope.set(0, rlf_y);
     scope.send();
     }