Alvee Ahmed
/
Hobbyking_Cheetah_Compact_DRV8323_14bit
customizing code for Aliexpress 14 bit version with MA702
structs.h@22:60276ba87ac6, 2017-03-31 (annotated)
- Committer:
- benkatz
- Date:
- Fri Mar 31 18:24:46 2017 +0000
- Revision:
- 22:60276ba87ac6
- Parent:
- 20:bf9ea5125d52
- Child:
- 23:2adf23ee0305
Encoder autocalibration for dc offset and harmonics
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benkatz | 20:bf9ea5125d52 | 1 | #ifndef STRUCTS_H |
benkatz | 20:bf9ea5125d52 | 2 | #define STRUCTS_H |
benkatz | 20:bf9ea5125d52 | 3 | |
benkatz | 20:bf9ea5125d52 | 4 | //#include "CANnucleo.h" |
benkatz | 20:bf9ea5125d52 | 5 | #include "mbed.h" |
benkatz | 20:bf9ea5125d52 | 6 | #include "FastPWM.h" |
benkatz | 20:bf9ea5125d52 | 7 | |
benkatz | 20:bf9ea5125d52 | 8 | |
benkatz | 20:bf9ea5125d52 | 9 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 10 | DigitalOut *enable; |
benkatz | 20:bf9ea5125d52 | 11 | FastPWM *pwm_u, *pwm_v, *pwm_w; |
benkatz | 22:60276ba87ac6 | 12 | int phasing; |
benkatz | 20:bf9ea5125d52 | 13 | } GPIOStruct; |
benkatz | 20:bf9ea5125d52 | 14 | |
benkatz | 20:bf9ea5125d52 | 15 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 16 | |
benkatz | 20:bf9ea5125d52 | 17 | }COMStruct; |
benkatz | 20:bf9ea5125d52 | 18 | |
benkatz | 20:bf9ea5125d52 | 19 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 20 | int adc1_raw, adc2_raw; |
benkatz | 20:bf9ea5125d52 | 21 | float i_a, i_b, i_c; |
benkatz | 20:bf9ea5125d52 | 22 | float v_bus; |
benkatz | 20:bf9ea5125d52 | 23 | float theta_mech, theta_elec; |
benkatz | 20:bf9ea5125d52 | 24 | float dtheta_mech, dtheta_elec; |
benkatz | 20:bf9ea5125d52 | 25 | float i_d, i_q; |
benkatz | 20:bf9ea5125d52 | 26 | float v_d, v_q; |
benkatz | 20:bf9ea5125d52 | 27 | float dtc_u, dtc_v, dtc_w; |
benkatz | 20:bf9ea5125d52 | 28 | float v_u, v_v, v_w; |
benkatz | 20:bf9ea5125d52 | 29 | float d_int, q_int; |
benkatz | 20:bf9ea5125d52 | 30 | int adc1_offset, adc2_offset; |
benkatz | 20:bf9ea5125d52 | 31 | float i_d_ref, i_q_ref; |
benkatz | 22:60276ba87ac6 | 32 | int loop_count; |
benkatz | 22:60276ba87ac6 | 33 | int mode; |
benkatz | 20:bf9ea5125d52 | 34 | } ControllerStruct; |
benkatz | 20:bf9ea5125d52 | 35 | |
benkatz | 22:60276ba87ac6 | 36 | typedef struct{ |
benkatz | 22:60276ba87ac6 | 37 | float vel_1; |
benkatz | 22:60276ba87ac6 | 38 | float vel_1_old; |
benkatz | 22:60276ba87ac6 | 39 | float vel_1_est; |
benkatz | 22:60276ba87ac6 | 40 | float vel_2; |
benkatz | 22:60276ba87ac6 | 41 | float vel_2_old; |
benkatz | 22:60276ba87ac6 | 42 | float vel_2_est; |
benkatz | 22:60276ba87ac6 | 43 | float ts; |
benkatz | 22:60276ba87ac6 | 44 | float est; |
benkatz | 22:60276ba87ac6 | 45 | } VelocityEstimatorStruct; |
benkatz | 22:60276ba87ac6 | 46 | |
benkatz | 20:bf9ea5125d52 | 47 | #endif |