![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
robot
prefs.h@86:b059f637e9ac, 2017-03-12 (annotated)
- Committer:
- bwang
- Date:
- Sun Mar 12 08:54:19 2017 +0000
- Revision:
- 86:b059f637e9ac
- Parent:
- Preferences.h@85:2280526f9bad
renamed some stuff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 82:5e741c5ffd9f | 1 | #ifndef __CONFIG_H |
bwang | 82:5e741c5ffd9f | 2 | #define __CONFIG_H |
bwang | 82:5e741c5ffd9f | 3 | |
bwang | 82:5e741c5ffd9f | 4 | #include "mbed.h" |
bwang | 82:5e741c5ffd9f | 5 | |
bwang | 82:5e741c5ffd9f | 6 | /*---driving---*/ |
bwang | 82:5e741c5ffd9f | 7 | #define _TORQUE_MODE __int_reg[0] |
bwang | 82:5e741c5ffd9f | 8 | #define _MAX_TQPCT_PLUS __float_reg[0] |
bwang | 82:5e741c5ffd9f | 9 | #define _MAX_TQPCT_MINUS __float_reg[1] |
bwang | 82:5e741c5ffd9f | 10 | #define _TORQUE_MAX __float_reg[2] |
bwang | 82:5e741c5ffd9f | 11 | #define _W_MAX __float_reg[3] |
bwang | 82:5e741c5ffd9f | 12 | |
bwang | 82:5e741c5ffd9f | 13 | /*---inverter---*/ |
bwang | 82:5e741c5ffd9f | 14 | #define _BUS_VOLTAGE __float_reg[4] |
bwang | 82:5e741c5ffd9f | 15 | #define _F_SW __float_reg[5] |
bwang | 82:5e741c5ffd9f | 16 | |
bwang | 82:5e741c5ffd9f | 17 | /*---logging---*/ |
bwang | 82:5e741c5ffd9f | 18 | #define _ENABLE_LOGGING __int_reg[1] |
bwang | 82:5e741c5ffd9f | 19 | #define _LOG_FREQUENCY __float_reg[6] |
bwang | 82:5e741c5ffd9f | 20 | |
bwang | 82:5e741c5ffd9f | 21 | /*---loop---*/ |
bwang | 82:5e741c5ffd9f | 22 | #define _K_LOOP_D __float_reg[7] |
bwang | 82:5e741c5ffd9f | 23 | #define _KI_BASE_D __float_reg[8] |
bwang | 82:5e741c5ffd9f | 24 | |
bwang | 82:5e741c5ffd9f | 25 | #define _K_LOOP_Q __float_reg[9] |
bwang | 82:5e741c5ffd9f | 26 | #define _KI_BASE_Q __float_reg[10] |
bwang | 82:5e741c5ffd9f | 27 | |
bwang | 82:5e741c5ffd9f | 28 | #define _F_SLOW_LOOP __float_reg[11] |
bwang | 82:5e741c5ffd9f | 29 | |
bwang | 82:5e741c5ffd9f | 30 | #define _INTEGRAL_MAX __float_reg[12] |
bwang | 82:5e741c5ffd9f | 31 | |
bwang | 82:5e741c5ffd9f | 32 | #define _W_FILTER_STRENGTH __float_reg[13] |
bwang | 82:5e741c5ffd9f | 33 | #define _DQ_FILTER_STRENGTH __float_reg[14] |
bwang | 82:5e741c5ffd9f | 34 | #define _THROTTLE_FILTER_STRENGTH __float_reg[15] |
bwang | 82:5e741c5ffd9f | 35 | |
bwang | 82:5e741c5ffd9f | 36 | #define _KP_D __float_reg[17] |
bwang | 82:5e741c5ffd9f | 37 | #define _KI_D __float_reg[18] |
bwang | 82:5e741c5ffd9f | 38 | |
bwang | 82:5e741c5ffd9f | 39 | #define _KP_Q __float_reg[19] |
bwang | 82:5e741c5ffd9f | 40 | #define _KI_Q __float_reg[20] |
bwang | 82:5e741c5ffd9f | 41 | |
bwang | 82:5e741c5ffd9f | 42 | #define _SLOW_LOOP_COUNTER __float_reg[21] |
bwang | 82:5e741c5ffd9f | 43 | |
bwang | 82:5e741c5ffd9f | 44 | /*---motor---*/ |
bwang | 82:5e741c5ffd9f | 45 | #define _POLE_PAIRS __float_reg[22] |
bwang | 82:5e741c5ffd9f | 46 | #define _POS_OFFSET __float_reg[23] |
bwang | 82:5e741c5ffd9f | 47 | #define _RESOLVER_LOBES __float_reg[24] |
bwang | 82:5e741c5ffd9f | 48 | #define _CPR __int_reg[2] |
bwang | 82:5e741c5ffd9f | 49 | #define _Ld __float_reg[25] |
bwang | 82:5e741c5ffd9f | 50 | #define _Lq __float_reg[26] |
bwang | 82:5e741c5ffd9f | 51 | #define _FLUX_LINKAGE __float_reg[27] |
bwang | 82:5e741c5ffd9f | 52 | #define _Rs __float_reg[28] |
bwang | 82:5e741c5ffd9f | 53 | #define _KT __float_reg[29] |
bwang | 82:5e741c5ffd9f | 54 | #define _W_SAFE __float_reg[30] |
bwang | 82:5e741c5ffd9f | 55 | #define _W_CRAZY __float_reg[31] |
bwang | 82:5e741c5ffd9f | 56 | |
bwang | 82:5e741c5ffd9f | 57 | /*---rc_throttle---*/ |
bwang | 82:5e741c5ffd9f | 58 | #define _TH_LIMIT_LOW __int_reg[3] |
bwang | 82:5e741c5ffd9f | 59 | #define _TH_LIMIT_HIGH __int_reg[4] |
bwang | 82:5e741c5ffd9f | 60 | #define _TH_LIMIT_CRAZY __int_reg[5] |
bwang | 82:5e741c5ffd9f | 61 | |
bwang | 82:5e741c5ffd9f | 62 | /*---table---*/ |
bwang | 82:5e741c5ffd9f | 63 | #define _ROWS __int_reg[6] |
bwang | 82:5e741c5ffd9f | 64 | #define _COLUMNS __int_reg[7] |
bwang | 82:5e741c5ffd9f | 65 | #define _W_STEP __float_reg[8] |
bwang | 82:5e741c5ffd9f | 66 | |
bwang | 82:5e741c5ffd9f | 67 | /*---operating mode---*/ |
bwang | 82:5e741c5ffd9f | 68 | |
bwang | 82:5e741c5ffd9f | 69 | #define BREMS_mode __int_reg[8] |
bwang | 82:5e741c5ffd9f | 70 | #define BREMS_src __int_reg[9] |
bwang | 82:5e741c5ffd9f | 71 | #define BREMS_op __int_reg[10] |
bwang | 82:5e741c5ffd9f | 72 | |
bwang | 84:dd32640942a4 | 73 | /*---error handling---*/ |
bwang | 84:dd32640942a4 | 74 | #define ERR_ignores __int_reg[11] |
bwang | 84:dd32640942a4 | 75 | |
bwang | 82:5e741c5ffd9f | 76 | /*internal variables and macros*/ |
bwang | 82:5e741c5ffd9f | 77 | |
bwang | 82:5e741c5ffd9f | 78 | extern float __float_reg[]; |
bwang | 82:5e741c5ffd9f | 79 | extern int __int_reg[]; |
bwang | 82:5e741c5ffd9f | 80 | |
bwang | 82:5e741c5ffd9f | 81 | #define DEFAULT(a) _##a = a |
bwang | 82:5e741c5ffd9f | 82 | #define FPRINT(a) pc->printf("%s: %f\n", #a, _##a) |
bwang | 82:5e741c5ffd9f | 83 | #define DPRINT(a) pc->printf("%s: %d\n", #a, _##a) |
bwang | 82:5e741c5ffd9f | 84 | |
bwang | 84:dd32640942a4 | 85 | #define NUM_MODES 4 |
bwang | 82:5e741c5ffd9f | 86 | enum { |
bwang | 82:5e741c5ffd9f | 87 | MODE_RUN, |
bwang | 82:5e741c5ffd9f | 88 | MODE_CFG, |
bwang | 82:5e741c5ffd9f | 89 | MODE_ZERO, |
bwang | 82:5e741c5ffd9f | 90 | MODE_CHR, |
bwang | 82:5e741c5ffd9f | 91 | }; |
bwang | 82:5e741c5ffd9f | 92 | |
bwang | 84:dd32640942a4 | 93 | #define NUM_OPS 4 |
bwang | 82:5e741c5ffd9f | 94 | enum { |
bwang | 82:5e741c5ffd9f | 95 | OP_TORQUE, |
bwang | 82:5e741c5ffd9f | 96 | OP_DRIVING, |
bwang | 82:5e741c5ffd9f | 97 | OP_SPEED, |
bwang | 82:5e741c5ffd9f | 98 | OP_POSITION, |
bwang | 82:5e741c5ffd9f | 99 | }; |
bwang | 82:5e741c5ffd9f | 100 | |
bwang | 84:dd32640942a4 | 101 | #define NUM_SRCS 6 |
bwang | 82:5e741c5ffd9f | 102 | enum { |
bwang | 82:5e741c5ffd9f | 103 | CMD_SRC_RC, |
bwang | 82:5e741c5ffd9f | 104 | CMD_SRC_ANALOG, |
bwang | 82:5e741c5ffd9f | 105 | CMD_SRC_TERMINAL, |
bwang | 82:5e741c5ffd9f | 106 | CMD_SRC_SERIAL, |
bwang | 82:5e741c5ffd9f | 107 | CMD_SRC_CAN, |
bwang | 82:5e741c5ffd9f | 108 | CMD_SRC_INTERNAL |
bwang | 82:5e741c5ffd9f | 109 | }; |
bwang | 82:5e741c5ffd9f | 110 | |
bwang | 82:5e741c5ffd9f | 111 | #endif |