![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
robot
prefs.h@240:2aaffa217627, 2018-11-11 (annotated)
- Committer:
- bwang
- Date:
- Sun Nov 11 12:34:19 2018 +0000
- Revision:
- 240:2aaffa217627
- Parent:
- 193:3abadeecf908
- Child:
- 243:96b03b3bf3ef
added speed mode (untested), other changes - see CHANGELOG
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 181:d3510c8beab6 | 1 | #ifndef __CONFIG_H |
bwang | 181:d3510c8beab6 | 2 | #define __CONFIG_H |
bwang | 181:d3510c8beab6 | 3 | |
bwang | 181:d3510c8beab6 | 4 | #include "mbed.h" |
bwang | 181:d3510c8beab6 | 5 | |
bwang | 181:d3510c8beab6 | 6 | /*---programming flag---*/ |
bwang | 181:d3510c8beab6 | 7 | #define _PREFS_VALID __int_reg[0] |
bwang | 181:d3510c8beab6 | 8 | |
bwang | 181:d3510c8beab6 | 9 | /*---driving---*/ |
bwang | 181:d3510c8beab6 | 10 | #define _TORQUE_MODE __int_reg[1] |
bwang | 181:d3510c8beab6 | 11 | #define _MAX_TQPCT_PLUS __float_reg[0] |
bwang | 181:d3510c8beab6 | 12 | #define _MAX_TQPCT_MINUS __float_reg[1] |
bwang | 181:d3510c8beab6 | 13 | #define _TORQUE_MAX __float_reg[2] |
bwang | 181:d3510c8beab6 | 14 | #define _W_MAX __float_reg[3] |
bwang | 181:d3510c8beab6 | 15 | |
bwang | 181:d3510c8beab6 | 16 | /*---inverter---*/ |
bwang | 181:d3510c8beab6 | 17 | #define _BUS_VOLTAGE __float_reg[4] |
bwang | 181:d3510c8beab6 | 18 | #define _F_SW __float_reg[5] |
bwang | 181:d3510c8beab6 | 19 | |
bwang | 184:633119bb0b77 | 20 | /*---loop---*/ |
bwang | 184:633119bb0b77 | 21 | #define _K_LOOP_D __float_reg[6] |
bwang | 184:633119bb0b77 | 22 | #define _KI_BASE_D __float_reg[7] |
bwang | 181:d3510c8beab6 | 23 | |
bwang | 184:633119bb0b77 | 24 | #define _K_LOOP_Q __float_reg[8] |
bwang | 184:633119bb0b77 | 25 | #define _KI_BASE_Q __float_reg[9] |
bwang | 181:d3510c8beab6 | 26 | |
bwang | 184:633119bb0b77 | 27 | #define _F_SLOW_LOOP __float_reg[10] |
bwang | 181:d3510c8beab6 | 28 | |
bwang | 184:633119bb0b77 | 29 | #define _INTEGRAL_MAX __float_reg[11] |
bwang | 181:d3510c8beab6 | 30 | |
bwang | 184:633119bb0b77 | 31 | #define _W_FILTER_WINDOW __int_reg[2] |
bwang | 184:633119bb0b77 | 32 | #define _DQ_FILTER_STRENGTH __float_reg[12] |
bwang | 184:633119bb0b77 | 33 | #define _THROTTLE_FILTER_WINDOW __int_reg[3] |
bwang | 181:d3510c8beab6 | 34 | |
bwang | 181:d3510c8beab6 | 35 | /*---motor---*/ |
bwang | 189:760cd81a7633 | 36 | #define _POLE_PAIRS __float_reg[13] |
bwang | 189:760cd81a7633 | 37 | #define _POS_OFFSET __float_reg[14] |
bwang | 189:760cd81a7633 | 38 | #define _RESOLVER_LOBES __float_reg[15] |
bwang | 184:633119bb0b77 | 39 | #define _CPR __int_reg[4] |
bwang | 189:760cd81a7633 | 40 | #define _Ld __float_reg[16] |
bwang | 189:760cd81a7633 | 41 | #define _Lq __float_reg[17] |
bwang | 189:760cd81a7633 | 42 | #define _FLUX_LINKAGE __float_reg[18] |
bwang | 189:760cd81a7633 | 43 | #define _Rs __float_reg[19] |
bwang | 189:760cd81a7633 | 44 | #define _KT __float_reg[20] |
bwang | 189:760cd81a7633 | 45 | #define _W_SAFE __float_reg[21] |
bwang | 189:760cd81a7633 | 46 | #define _W_CRAZY __float_reg[22] |
bwang | 181:d3510c8beab6 | 47 | |
bwang | 181:d3510c8beab6 | 48 | /*---rc_throttle---*/ |
bwang | 184:633119bb0b77 | 49 | #define _TH_LIMIT_LOW __int_reg[5] |
bwang | 184:633119bb0b77 | 50 | #define _TH_LIMIT_HIGH __int_reg[6] |
bwang | 181:d3510c8beab6 | 51 | |
bwang | 181:d3510c8beab6 | 52 | /*---table---*/ |
bwang | 189:760cd81a7633 | 53 | #define _W_STEP __float_reg[23] |
bwang | 184:633119bb0b77 | 54 | |
bwang | 184:633119bb0b77 | 55 | /*---data logging---*/ |
bwang | 191:66861311bdcd | 56 | #define _ENABLE_LOGGING __int_reg[7] |
bwang | 191:66861311bdcd | 57 | #define _LOG_PAGE_SIZE __int_reg[8] |
bwang | 191:66861311bdcd | 58 | #define _LOG_HEADER_SIZE __int_reg[9] |
bwang | 191:66861311bdcd | 59 | #define _LOG_PACKET_SIZE __int_reg[10] |
bwang | 191:66861311bdcd | 60 | #define _LOG_BAUD_RATE __int_reg[11] |
bwang | 181:d3510c8beab6 | 61 | |
bwang | 181:d3510c8beab6 | 62 | /*---operating mode---*/ |
bwang | 181:d3510c8beab6 | 63 | |
bwang | 191:66861311bdcd | 64 | #define BREMS_mode __int_reg[12] |
bwang | 191:66861311bdcd | 65 | #define BREMS_src __int_reg[13] |
bwang | 191:66861311bdcd | 66 | #define BREMS_op __int_reg[14] |
bwang | 181:d3510c8beab6 | 67 | |
bwang | 181:d3510c8beab6 | 68 | /*---error handling---*/ |
bwang | 191:66861311bdcd | 69 | #define ERR_ignores __int_reg[15] |
bwang | 181:d3510c8beab6 | 70 | |
bwang | 193:3abadeecf908 | 71 | /*---commutation tweaks---*/ |
bwang | 193:3abadeecf908 | 72 | #define _OVERMODULATION_FACTOR __float_reg[24] |
bwang | 193:3abadeecf908 | 73 | #define _V_PHASE_SWIZZLE __float_reg[25] |
bwang | 193:3abadeecf908 | 74 | |
bwang | 240:2aaffa217627 | 75 | /*---speed loop---*/ |
bwang | 240:2aaffa217627 | 76 | #define _K_LOOP_W __float_reg[26] |
bwang | 240:2aaffa217627 | 77 | #define _KI_BASE_W __float_reg[27] |
bwang | 240:2aaffa217627 | 78 | #define _W_SETPOINT_MAX __float_reg[28] |
bwang | 240:2aaffa217627 | 79 | |
bwang | 181:d3510c8beab6 | 80 | /*internal variables and macros*/ |
bwang | 181:d3510c8beab6 | 81 | |
bwang | 181:d3510c8beab6 | 82 | extern float __float_reg[]; |
bwang | 181:d3510c8beab6 | 83 | extern int __int_reg[]; |
bwang | 181:d3510c8beab6 | 84 | |
bwang | 181:d3510c8beab6 | 85 | #define DEFAULT(a) _##a = a |
bwang | 181:d3510c8beab6 | 86 | #define FPRINT(a) pc->printf("%s: %f\n", #a, _##a) |
bwang | 181:d3510c8beab6 | 87 | #define DPRINT(a) pc->printf("%s: %d\n", #a, _##a) |
bwang | 189:760cd81a7633 | 88 | #define FPRINT2(a) pc->printf("%s: %f\n", #a, a); |
bwang | 191:66861311bdcd | 89 | #define DPRINT2(a) pc->printf("%s: %d\n", #a, a) |
bwang | 181:d3510c8beab6 | 90 | |
bwang | 181:d3510c8beab6 | 91 | #define NUM_MODES 4 |
bwang | 181:d3510c8beab6 | 92 | enum { |
bwang | 181:d3510c8beab6 | 93 | MODE_RUN, |
bwang | 181:d3510c8beab6 | 94 | MODE_CFG, |
bwang | 181:d3510c8beab6 | 95 | MODE_ZERO, |
bwang | 181:d3510c8beab6 | 96 | MODE_CHR, |
bwang | 181:d3510c8beab6 | 97 | }; |
bwang | 181:d3510c8beab6 | 98 | |
bwang | 181:d3510c8beab6 | 99 | #define NUM_OPS 4 |
bwang | 181:d3510c8beab6 | 100 | enum { |
bwang | 181:d3510c8beab6 | 101 | OP_TORQUE, |
bwang | 181:d3510c8beab6 | 102 | OP_DRIVING, |
bwang | 181:d3510c8beab6 | 103 | OP_SPEED, |
bwang | 181:d3510c8beab6 | 104 | OP_POSITION, |
bwang | 181:d3510c8beab6 | 105 | }; |
bwang | 181:d3510c8beab6 | 106 | |
bwang | 181:d3510c8beab6 | 107 | #define NUM_SRCS 6 |
bwang | 181:d3510c8beab6 | 108 | enum { |
bwang | 181:d3510c8beab6 | 109 | CMD_SRC_RC, |
bwang | 181:d3510c8beab6 | 110 | CMD_SRC_ANALOG, |
bwang | 181:d3510c8beab6 | 111 | CMD_SRC_TERMINAL, |
bwang | 181:d3510c8beab6 | 112 | CMD_SRC_SERIAL, |
bwang | 181:d3510c8beab6 | 113 | CMD_SRC_CAN, |
bwang | 181:d3510c8beab6 | 114 | CMD_SRC_INTERNAL |
bwang | 181:d3510c8beab6 | 115 | }; |
bwang | 181:d3510c8beab6 | 116 | |
bwang | 181:d3510c8beab6 | 117 | #endif |