Jorn Dokter / Mbed 2 deprecated TEB_branch2

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Committer:
JornD
Date:
Wed Oct 16 13:39:19 2019 +0000
Branch:
Branch2
Revision:
66:fa7171cf3f67
Parent:
64:5a6bf0cd1c50
WORKING - Implemented Jordan's motor control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JornD 64:5a6bf0cd1c50 1 #ifndef structures_h
JornD 64:5a6bf0cd1c50 2 #define structures_h
JornD 28:4a5671b3d88d 3
JornD 40:82addb417220 4 //Structures
JornD 40:82addb417220 5 //--Motor data
JornD 66:fa7171cf3f67 6
JornD 66:fa7171cf3f67 7 struct motorDataOutputSub
JornD 40:82addb417220 8 {
JornD 40:82addb417220 9 int counts;
JornD 40:82addb417220 10 float angle;
JornD 40:82addb417220 11 float velocity;
JornD 40:82addb417220 12 };
JornD 40:82addb417220 13
JornD 66:fa7171cf3f67 14 struct motorDataInputSub
JornD 66:fa7171cf3f67 15 {
JornD 66:fa7171cf3f67 16 float PWM;
JornD 66:fa7171cf3f67 17 int calibrationCounts;
JornD 66:fa7171cf3f67 18 };
JornD 66:fa7171cf3f67 19
JornD 66:fa7171cf3f67 20 struct motorDataCombined
JornD 40:82addb417220 21 {
JornD 66:fa7171cf3f67 22 motorDataOutputSub output;
JornD 66:fa7171cf3f67 23 motorDataInputSub input;
JornD 66:fa7171cf3f67 24
JornD 40:82addb417220 25 };
JornD 49:a9ed4f4cdef7 26
JornD 66:fa7171cf3f67 27 struct motorStruc
JornD 66:fa7171cf3f67 28 {
JornD 66:fa7171cf3f67 29 motorDataCombined motor1;
JornD 66:fa7171cf3f67 30 motorDataCombined motor2;
JornD 66:fa7171cf3f67 31 motorDataCombined motor3;
JornD 66:fa7171cf3f67 32 float dt;
JornD 66:fa7171cf3f67 33 bool debug;
JornD 66:fa7171cf3f67 34 };
JornD 66:fa7171cf3f67 35
JornD 66:fa7171cf3f67 36
JornD 40:82addb417220 37 //--PID controller settings
JornD 40:82addb417220 38 struct ControllerSettings //Controller settings of the discrete TF
JornD 40:82addb417220 39 {
JornD 40:82addb417220 40 float A;
JornD 40:82addb417220 41 float B;
JornD 40:82addb417220 42 float C;
JornD 40:82addb417220 43 float D;
JornD 40:82addb417220 44 float E;
JornD 40:82addb417220 45 };
JornD 49:a9ed4f4cdef7 46
JornD 40:82addb417220 47 //--Memory of Input/Output
JornD 40:82addb417220 48 struct MemoryIO
JornD 40:82addb417220 49 {
JornD 58:897b67113094 50 float Ym; //output, delayed once
JornD 58:897b67113094 51 float Ymm; //output, delayed twice
JornD 58:897b67113094 52 float Xm; //input, delayed once
JornD 58:897b67113094 53 float Xmm; //input, delayed twice
JornD 50:283a831f84a9 54 void ShiftValues(float CurX, float CurY) //Input: Current X, current Y
JornD 50:283a831f84a9 55 {
JornD 58:897b67113094 56 Ymm = Ym; //Y delayed once to Y delayed twice
JornD 58:897b67113094 57 Xmm = Xm; //X delayed once to X delayed twice
JornD 58:897b67113094 58 Ym = CurY; //Current Y to Y delayed once
JornD 58:897b67113094 59 Xm = CurX; //Current X to X delayed once
JornD 53:0aab2185b144 60 };
JornD 40:82addb417220 61 };
JornD 61:4c7de1e2f9fe 62
JornD 28:4a5671b3d88d 63 #endif