Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
header.h@33:5e2e95c322da, 2019-10-09 (annotated)
- Committer:
- JornD
- Date:
- Wed Oct 09 15:26:54 2019 +0000
- Revision:
- 33:5e2e95c322da
- Parent:
- 32:da34d27a13f3
Stripping down the code and trying to fix L6312W;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JornD | 24:d0ca537913c2 | 1 | #ifndef header_h |
JornD | 24:d0ca537913c2 | 2 | #define header_h |
JornD | 24:d0ca537913c2 | 3 | int AddInt(int a, int b); |
JordanO | 27:71be6e074d0f | 4 | |
JordanO | 18:266f1ffdc9c4 | 5 | double ControllerPID(double e, double Ts); //e = error, Ts = sampling time |
JornD | 33:5e2e95c322da | 6 | //void motorAndEncoder(float PWM1, float PWM2, float dt); |
JornD | 33:5e2e95c322da | 7 | |
JornD | 33:5e2e95c322da | 8 | //Structures |
JornD | 33:5e2e95c322da | 9 | struct motorReturnSub |
JornD | 33:5e2e95c322da | 10 | { |
JornD | 33:5e2e95c322da | 11 | int counts; |
JornD | 33:5e2e95c322da | 12 | float angle; |
JornD | 33:5e2e95c322da | 13 | float velocity; |
JornD | 33:5e2e95c322da | 14 | }; |
JornD | 33:5e2e95c322da | 15 | |
JornD | 33:5e2e95c322da | 16 | struct motorData |
JornD | 33:5e2e95c322da | 17 | { |
JornD | 33:5e2e95c322da | 18 | motorReturnSub motor1; |
JornD | 33:5e2e95c322da | 19 | motorReturnSub motor2; |
JornD | 33:5e2e95c322da | 20 | motorReturnSub motor3; |
JornD | 33:5e2e95c322da | 21 | }; |
JornD | 33:5e2e95c322da | 22 | |
JornD | 33:5e2e95c322da | 23 | //Define global variables |
JornD | 33:5e2e95c322da | 24 | extern double X; //Input from EMG, signal X |
JornD | 33:5e2e95c322da | 25 | |
JornD | 33:5e2e95c322da | 26 | //Define structures |
JornD | 33:5e2e95c322da | 27 | extern motorData motorReturn; |
JornD | 33:5e2e95c322da | 28 | |
JornD | 24:d0ca537913c2 | 29 | #endif |
JordanO | 18:266f1ffdc9c4 | 30 | |
JornD | 24:d0ca537913c2 | 31 | //double motorAndEncoder(float voltage1, float periodMotor1, float voltage2, float periodMotor2, float dt, float &countsMotor1Return, float &countsMotor2Return, float &velocityMotor1Return, float &velocityMotor2Return); |
JordanO | 19:07706535ff7b | 32 | //voltage in PWM (between -1 and 1), -1 for negative direction full power, 1 for positive direction full power |
JordanO | 18:266f1ffdc9c4 | 33 | //period in seconds |
JordanO | 19:07706535ff7b | 34 | //dt the time between measurements, i.o.w. Ticker timing, for velocity calculation |
JordanO | 18:266f1ffdc9c4 | 35 | //Returns (velocityMotor1, velocityMotor2, countsMotor1[1], countsMotor2[0]) |
JornD | 23:767911637f3a | 36 | //Velocity in radians/s |
JornD | 23:767911637f3a | 37 | |
JornD | 24:d0ca537913c2 | 38 | //double ProcessEMG(double X); |