Tristan Vlogman / Mbed 2 deprecated locomotion_pid_action_refactor_EMG

Dependencies:   FastPWM HIDScope MODSERIAL QEI Matrix biquadFilter controller errorFetch mbed motorConfig refGen MatrixMath inverseKinematics

Fork of Minor_test_serial by First Last

Files at this revision

API Documentation at this revision

Comitter:
tvlogman
Date:
Sun Oct 22 08:39:28 2017 +0000
Parent:
35:99bf23b34ee3
Child:
37:633dd1901681
Commit message:
Works, but needs a calibration for the filtering to subtract mean offset and normalize to maximum contraction.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Oct 22 08:07:06 2017 +0000
+++ b/main.cpp	Sun Oct 22 08:39:28 2017 +0000
@@ -20,8 +20,8 @@
 biquadFilter HPbq2(1.0000, -2.0000, 1.0000, 1.0000, -1.9903, 0.9904);
 biquadChain HPbqc(HPbq1, HPbq2);
 // low pass
-biquadFilter LPbq1(1.0e-6*0.1202, 1.0e-6*0.2405, 1.0e-6*0.1202, 1.0000, -1.9313, 0.9327);
-biquadFilter LPbq2(1.0000, 2.0000, 1.0000, 1.0000, -1.9702, 0.9716);
+biquadFilter LPbq1(1.0e-5*1.3294, 1.0e-5*2.6587, 1.0e-5*1.3294, 1.0000, -1.7783, 0.7924);
+biquadFilter LPbq2(1.0000, 2.0000, 1.0000, 1.0000, -1.8934, 0.9085);
 biquadChain LPbqc(LPbq1, LPbq2);
 
 // Controller parameters
@@ -107,6 +107,7 @@
     m2counts = Encoder2.getPulses();
     float r1 = ref1.getReference();
     r1 = HPbqc.applyFilter(r1);
+    r1 = fabs(r1);
     r1 = LPbqc.applyFilter(r1);
     e1.fetchError(m1counts, r1);
     float motorValue = motorController1.control(e1.e_pos, e1.e_int, e1.e_der);