Jorn Dokter / Mbed 2 deprecated TEB_branch2

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Files at this revision

API Documentation at this revision

Comitter:
JornD
Date:
Tue Oct 15 13:07:08 2019 +0000
Branch:
Branch2
Parent:
57:cc8a8097e248
Child:
59:ec28e8a4a233
Commit message:
Implemented Rens' Biquad function;

Changed in this revision

controller.cpp Show annotated file Show diff for this revision Revisions of this file
structures.h Show annotated file Show diff for this revision Revisions of this file
diff -r cc8a8097e248 -r 897b67113094 controller.cpp
--- a/controller.cpp	Tue Oct 15 13:03:12 2019 +0000
+++ b/controller.cpp	Tue Oct 15 13:07:08 2019 +0000
@@ -42,15 +42,24 @@
     //--Build controller, EMG
         float PE[] = {1,2,3};
         float QE[] = {4,5,6};
-        //BuildController(Set_ProcessEMG, PE, QE);
+        BuildController(Set_ProcessEMG, PE, QE);
     //--Build controller, Base
         float PB[] = {1,2,3};
         float QB[] = {4,5,6};
-        //BuildController(Set_Base, PB, QB);
+        BuildController(Set_Base, PB, QB);
     //--Build controller, End Affector
         float PA[] = {1,2,3};
         float QA[] = {4,5,6};
-        //BuildController(Set_EndAffector, PA, QA);
+        BuildController(Set_EndAffector, PA, QA);
         
 }
 
+float Biquad(ControllerSettings& StrucName, MemoryIO& MemName, float X)
+{
+    //Difference equation which implements the digital biquad filter
+    float Y = StrucName.A * X + StrucName.B * MemName.Xm + StrucName.C * MemName.Xmm + StrucName.D * MemName.Ym + StrucName.E * MemName.Ymm;        
+    
+    
+    return Y; 
+}
+
diff -r cc8a8097e248 -r 897b67113094 structures.h
--- a/structures.h	Tue Oct 15 13:03:12 2019 +0000
+++ b/structures.h	Tue Oct 15 13:07:08 2019 +0000
@@ -31,16 +31,16 @@
 //--Memory of Input/Output
     struct MemoryIO
     {
-        float dY;   //output, delayed once
-        float ddY;  //output, delayed twice
-        float dX;   //input, delayed once
-        float ddX;  //input, delayed twice
+        float Ym;   //output, delayed once
+        float Ymm;  //output, delayed twice
+        float Xm;   //input, delayed once
+        float Xmm;  //input, delayed twice
         void ShiftValues(float CurX, float CurY) //Input: Current X, current Y
         {
-            ddY = dY; //Y delayed once to Y delayed twice
-            ddX = dX; //X delayed once to X delayed twice 
-            dY = CurY; //Current Y to Y delayed once
-            dX = CurX; //Current X to X delayed once
+            Ymm = Ym; //Y delayed once to Y delayed twice
+            Xmm = Xm; //X delayed once to X delayed twice 
+            Ym = CurY; //Current Y to Y delayed once
+            Xm = CurX; //Current X to X delayed once
         };
     };