![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Original Version of STM Board
setting.h@36:a46e63505ed8, 2019-11-22 (annotated)
- Committer:
- Lightvalve
- Date:
- Fri Nov 22 08:03:52 2019 +0000
- Revision:
- 36:a46e63505ed8
- Parent:
- 35:34ce7b0347b8
- Child:
- 39:e961db3b93f8
- Child:
- 45:35fa6884d0c6
191122
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GiJeongKim | 0:51c43836c1d7 | 1 | #include "mbed.h" |
GiJeongKim | 0:51c43836c1d7 | 2 | #include "FastPWM.h" |
GiJeongKim | 0:51c43836c1d7 | 3 | |
GiJeongKim | 0:51c43836c1d7 | 4 | // pwm |
jobuuu | 2:a1c0a37df760 | 5 | #define PIN_V PB_7 |
jobuuu | 2:a1c0a37df760 | 6 | #define PIN_W PB_6 |
jobuuu | 2:a1c0a37df760 | 7 | //#define PWM_ARR 0x465 // loop 80k, pwm 40k |
jobuuu | 2:a1c0a37df760 | 8 | //#define PWM_ARR 0x8CA // loop 40k, pwm 20k |
Lightvalve | 19:23b7c1ad8683 | 9 | //#define PWM_ARR 0x1194 // loop 20k, pwm 10k |
Lightvalve | 19:23b7c1ad8683 | 10 | #define PWM_ARR 0x2328 // loop 10k, pwm 5k |
Lightvalve | 11:82d8768d7351 | 11 | #define TMR3_COUNT 0x4650 // loop 5k |
Lightvalve | 23:59218d4a256d | 12 | #define TMR2_COUNT 0x2710 // loop 500hz with prescale 18 |
jobuuu | 2:a1c0a37df760 | 13 | |
Lightvalve | 30:8d561f16383b | 14 | #define FREQ_500 500.0f |
Lightvalve | 30:8d561f16383b | 15 | #define FREQ_1k 1000.0f |
Lightvalve | 30:8d561f16383b | 16 | #define FREQ_5k 5000.0f |
Lightvalve | 30:8d561f16383b | 17 | #define FREQ_10k 10000.0f |
Lightvalve | 30:8d561f16383b | 18 | #define FREQ_20k 20000.0f |
Lightvalve | 30:8d561f16383b | 19 | #define FREQ_40k 40000.0f |
Lightvalve | 30:8d561f16383b | 20 | #define DT_500 0.002f |
Lightvalve | 30:8d561f16383b | 21 | #define DT_1k 0.0005f |
Lightvalve | 30:8d561f16383b | 22 | #define DT_5k 0.0002f |
Lightvalve | 30:8d561f16383b | 23 | #define DT_10k 0.0001f |
Lightvalve | 30:8d561f16383b | 24 | #define DT_20k 0.00005f |
Lightvalve | 30:8d561f16383b | 25 | #define DT_40k 0.000025f |
jobuuu | 5:a4319f79457b | 26 | |
Lightvalve | 19:23b7c1ad8683 | 27 | //extern int CID_RX_CMD; |
Lightvalve | 19:23b7c1ad8683 | 28 | //extern int CID_RX_REF_POSITION; |
Lightvalve | 19:23b7c1ad8683 | 29 | //extern int CID_RX_REF_TORQUE; |
Lightvalve | 19:23b7c1ad8683 | 30 | //extern int CID_RX_REF_PRES_DIFF; |
Lightvalve | 19:23b7c1ad8683 | 31 | //extern int CID_RX_REF_VOUT; |
Lightvalve | 19:23b7c1ad8683 | 32 | //extern int CID_RX_REF_VALVE_POSITION; |
Lightvalve | 19:23b7c1ad8683 | 33 | //extern int CID_RX_REF_CURRENT; |
Lightvalve | 19:23b7c1ad8683 | 34 | // |
Lightvalve | 19:23b7c1ad8683 | 35 | //extern int CID_TX_INFO; |
Lightvalve | 19:23b7c1ad8683 | 36 | //extern int CID_TX_POSITION; |
Lightvalve | 19:23b7c1ad8683 | 37 | //extern int CID_TX_TORQUE; |
Lightvalve | 19:23b7c1ad8683 | 38 | //extern int CID_TX_PRES; |
Lightvalve | 19:23b7c1ad8683 | 39 | //extern int CID_TX_VOUT; |
Lightvalve | 19:23b7c1ad8683 | 40 | //extern int CID_TX_VALVE_POSITION; |
Lightvalve | 19:23b7c1ad8683 | 41 | |
Lightvalve | 19:23b7c1ad8683 | 42 | |
Lightvalve | 19:23b7c1ad8683 | 43 | |
jobuuu | 7:e9086c72bb22 | 44 | extern DigitalOut check; |
jobuuu | 7:e9086c72bb22 | 45 | extern DigitalOut check_2; |
jobuuu | 7:e9086c72bb22 | 46 | extern AnalogOut dac_1; |
jobuuu | 7:e9086c72bb22 | 47 | extern AnalogOut dac_2; |
jobuuu | 7:e9086c72bb22 | 48 | |
Lightvalve | 30:8d561f16383b | 49 | extern float dtc_v; |
Lightvalve | 30:8d561f16383b | 50 | extern float dtc_w; |
GiJeongKim | 0:51c43836c1d7 | 51 | |
GiJeongKim | 0:51c43836c1d7 | 52 | // I2C |
GiJeongKim | 0:51c43836c1d7 | 53 | extern I2C i2c; // SDA, SCL (for K22F) |
GiJeongKim | 0:51c43836c1d7 | 54 | extern const int i2c_slave_addr1; |
GiJeongKim | 0:51c43836c1d7 | 55 | extern unsigned int value; // 10bit output of reading sensor AS5510 |
GiJeongKim | 0:51c43836c1d7 | 56 | |
GiJeongKim | 0:51c43836c1d7 | 57 | // SPI |
Lightvalve | 16:903b5a4433b4 | 58 | //extern SPI eeprom; //(SPI_MOSI, SPI_MISO, SPI_SCK); |
Lightvalve | 16:903b5a4433b4 | 59 | //extern DigitalOut eeprom_cs; |
GiJeongKim | 0:51c43836c1d7 | 60 | extern SPI enc; |
GiJeongKim | 0:51c43836c1d7 | 61 | extern DigitalOut enc_cs; |
GiJeongKim | 0:51c43836c1d7 | 62 | |
GiJeongKim | 0:51c43836c1d7 | 63 | // UART |
jobuuu | 7:e9086c72bb22 | 64 | extern Serial pc; //Serial pc(PA_9,PA_10); _ UART |
jobuuu | 7:e9086c72bb22 | 65 | |
jobuuu | 7:e9086c72bb22 | 66 | // CAN |
jobuuu | 7:e9086c72bb22 | 67 | extern CAN can; |
jobuuu | 7:e9086c72bb22 | 68 | extern CANMessage msg; |
jobuuu | 7:e9086c72bb22 | 69 | |
jobuuu | 7:e9086c72bb22 | 70 | // Board Information |
jobuuu | 7:e9086c72bb22 | 71 | |
jobuuu | 7:e9086c72bb22 | 72 | |
jobuuu | 7:e9086c72bb22 | 73 | // User Function |
jobuuu | 7:e9086c72bb22 | 74 | |
jobuuu | 7:e9086c72bb22 | 75 | void CurrentControl(); |
jobuuu | 7:e9086c72bb22 | 76 | void ValveControl(unsigned int ControlMode); |
Lightvalve | 11:82d8768d7351 | 77 | |
Lightvalve | 11:82d8768d7351 | 78 | |
Lightvalve | 11:82d8768d7351 | 79 | /******************************************************************************* |
Lightvalve | 11:82d8768d7351 | 80 | * COMMON Settings |
Lightvalve | 11:82d8768d7351 | 81 | ******************************************************************************/ |
Lightvalve | 11:82d8768d7351 | 82 | #define LATEST_VERSION 19032 |
Lightvalve | 11:82d8768d7351 | 83 | |
Lightvalve | 11:82d8768d7351 | 84 | |
Lightvalve | 11:82d8768d7351 | 85 | |
Lightvalve | 11:82d8768d7351 | 86 | /******************************************************************************* |
Lightvalve | 11:82d8768d7351 | 87 | * COMMON CONSTANTS |
Lightvalve | 11:82d8768d7351 | 88 | ******************************************************************************/ |
Lightvalve | 30:8d561f16383b | 89 | #define RAD_30 0.523598775598299f |
Lightvalve | 30:8d561f16383b | 90 | #define RAD_60 1.047197551196598f |
Lightvalve | 30:8d561f16383b | 91 | #define RAD_120 2.094395102393195f |
Lightvalve | 30:8d561f16383b | 92 | #define RAD_180 3.141592653589793f |
Lightvalve | 30:8d561f16383b | 93 | #define RAD_240 4.188790204786391f |
Lightvalve | 30:8d561f16383b | 94 | #define RAD_300 5.235987755982989f |
Lightvalve | 30:8d561f16383b | 95 | #define RAD_360 6.283185307179586f |
Lightvalve | 11:82d8768d7351 | 96 | |
Lightvalve | 11:82d8768d7351 | 97 | #define SYSFREQ 200000000 |
Lightvalve | 11:82d8768d7351 | 98 | #define PBCLK 100000000 |
Lightvalve | 11:82d8768d7351 | 99 | |
Lightvalve | 11:82d8768d7351 | 100 | //#define TMR_FREQ_10k 10000 |
Lightvalve | 11:82d8768d7351 | 101 | #define TMR_FREQ_5k 5000 |
Lightvalve | 11:82d8768d7351 | 102 | |
Lightvalve | 11:82d8768d7351 | 103 | #define FALSE 0 |
Lightvalve | 11:82d8768d7351 | 104 | #define TRUE 1 |
Lightvalve | 11:82d8768d7351 | 105 | #define OUTPUT 0 |
Lightvalve | 11:82d8768d7351 | 106 | #define INPUT 1 |
Lightvalve | 11:82d8768d7351 | 107 | #define LOW 0 |
Lightvalve | 11:82d8768d7351 | 108 | #define HIGH 1 |
Lightvalve | 11:82d8768d7351 | 109 | #define DIGITAL 0 |
Lightvalve | 11:82d8768d7351 | 110 | #define ANALOG 1 |
Lightvalve | 11:82d8768d7351 | 111 | |
Lightvalve | 30:8d561f16383b | 112 | #define PI 3.141592653589793f |
Lightvalve | 30:8d561f16383b | 113 | #define D2R 0.017453292519943f |
Lightvalve | 30:8d561f16383b | 114 | #define R2D 57.295779513082323f |
Lightvalve | 11:82d8768d7351 | 115 | |
Lightvalve | 11:82d8768d7351 | 116 | |
Lightvalve | 11:82d8768d7351 | 117 | /******************************************************************************* |
Lightvalve | 11:82d8768d7351 | 118 | * HEADER INCLUDE |
Lightvalve | 11:82d8768d7351 | 119 | ******************************************************************************/ |
Lightvalve | 11:82d8768d7351 | 120 | |
Lightvalve | 11:82d8768d7351 | 121 | /******************************************************************************* |
Lightvalve | 11:82d8768d7351 | 122 | * VARIABLE |
Lightvalve | 11:82d8768d7351 | 123 | ******************************************************************************/ |
Lightvalve | 11:82d8768d7351 | 124 | |
Lightvalve | 11:82d8768d7351 | 125 | // Board Information |
Lightvalve | 11:82d8768d7351 | 126 | extern uint8_t BNO; |
Lightvalve | 11:82d8768d7351 | 127 | extern uint8_t CONTROL_MODE; |
Lightvalve | 11:82d8768d7351 | 128 | extern uint8_t OPERATING_MODE; |
Lightvalve | 11:82d8768d7351 | 129 | extern uint8_t SETTING_SWITCH; |
Lightvalve | 11:82d8768d7351 | 130 | extern uint8_t SETTING_SWITCH_OLD; |
Lightvalve | 11:82d8768d7351 | 131 | extern uint8_t REFERENCE_MODE; |
Lightvalve | 11:82d8768d7351 | 132 | extern uint16_t CAN_FREQ; |
Lightvalve | 17:1865016ca2e7 | 133 | extern int16_t DIR_JOINT_ENC; |
Lightvalve | 17:1865016ca2e7 | 134 | extern int16_t DIR_VALVE; |
Lightvalve | 17:1865016ca2e7 | 135 | extern int16_t DIR_VALVE_ENC; |
Lightvalve | 11:82d8768d7351 | 136 | |
Lightvalve | 30:8d561f16383b | 137 | extern float SUPPLY_VOLTAGE; |
Lightvalve | 30:8d561f16383b | 138 | extern float VALVE_VOLTAGE_LIMIT; |
Lightvalve | 11:82d8768d7351 | 139 | |
Lightvalve | 30:8d561f16383b | 140 | extern float P_GAIN_VALVE_POSITION; |
Lightvalve | 30:8d561f16383b | 141 | extern float I_GAIN_VALVE_POSITION; |
Lightvalve | 30:8d561f16383b | 142 | extern float D_GAIN_VALVE_POSITION; |
Lightvalve | 30:8d561f16383b | 143 | extern float P_GAIN_JOINT_POSITION; |
Lightvalve | 30:8d561f16383b | 144 | extern float I_GAIN_JOINT_POSITION; |
Lightvalve | 30:8d561f16383b | 145 | extern float D_GAIN_JOINT_POSITION; |
Lightvalve | 30:8d561f16383b | 146 | extern float P_GAIN_JOINT_TORQUE; |
Lightvalve | 30:8d561f16383b | 147 | extern float I_GAIN_JOINT_TORQUE; |
Lightvalve | 30:8d561f16383b | 148 | extern float D_GAIN_JOINT_TORQUE; |
Lightvalve | 11:82d8768d7351 | 149 | |
Lightvalve | 36:a46e63505ed8 | 150 | //extern float P_GAIN_VALVE_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 151 | //extern float I_GAIN_VALVE_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 152 | //extern float D_GAIN_VALVE_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 153 | //extern float P_GAIN_JOINT_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 154 | //extern float I_GAIN_JOINT_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 155 | //extern float D_GAIN_JOINT_POSITION_OPP; |
Lightvalve | 36:a46e63505ed8 | 156 | //extern float P_GAIN_JOINT_TORQUE_OPP; |
Lightvalve | 36:a46e63505ed8 | 157 | //extern float I_GAIN_JOINT_TORQUE_OPP; |
Lightvalve | 36:a46e63505ed8 | 158 | //extern float D_GAIN_JOINT_TORQUE_OPP; |
Lightvalve | 36:a46e63505ed8 | 159 | |
Lightvalve | 33:91b17819ec30 | 160 | extern float VALVE_DEADZONE_PLUS; |
Lightvalve | 33:91b17819ec30 | 161 | extern float VALVE_DEADZONE_MINUS; |
Lightvalve | 11:82d8768d7351 | 162 | |
Lightvalve | 11:82d8768d7351 | 163 | extern int16_t VELOCITY_COMP_GAIN; |
Lightvalve | 11:82d8768d7351 | 164 | extern int16_t COMPLIANCE_GAIN; |
Lightvalve | 11:82d8768d7351 | 165 | |
Lightvalve | 11:82d8768d7351 | 166 | extern int16_t VALVE_CENTER; |
Lightvalve | 11:82d8768d7351 | 167 | |
Lightvalve | 11:82d8768d7351 | 168 | extern int16_t VALVE_FF; |
Lightvalve | 11:82d8768d7351 | 169 | |
Lightvalve | 11:82d8768d7351 | 170 | extern int16_t BULK_MODULUS; |
Lightvalve | 11:82d8768d7351 | 171 | |
Lightvalve | 11:82d8768d7351 | 172 | extern int16_t CHAMBER_VOLUME_A; |
Lightvalve | 11:82d8768d7351 | 173 | extern int16_t CHAMBER_VOLUME_B; |
Lightvalve | 11:82d8768d7351 | 174 | |
Lightvalve | 11:82d8768d7351 | 175 | extern int16_t PISTON_AREA_A; |
Lightvalve | 11:82d8768d7351 | 176 | extern int16_t PISTON_AREA_B; |
Lightvalve | 30:8d561f16383b | 177 | extern float PISTON_AREA_alpha; |
Lightvalve | 11:82d8768d7351 | 178 | |
Lightvalve | 11:82d8768d7351 | 179 | |
Lightvalve | 11:82d8768d7351 | 180 | extern int16_t PRES_SUPPLY; |
Lightvalve | 11:82d8768d7351 | 181 | extern int16_t PRES_RETURN; |
Lightvalve | 11:82d8768d7351 | 182 | |
Lightvalve | 11:82d8768d7351 | 183 | extern int16_t ENC_LIMIT_PLUS; |
Lightvalve | 11:82d8768d7351 | 184 | extern int16_t ENC_LIMIT_MINUS; |
Lightvalve | 11:82d8768d7351 | 185 | |
Lightvalve | 11:82d8768d7351 | 186 | extern int16_t STROKE; |
Lightvalve | 11:82d8768d7351 | 187 | |
Lightvalve | 11:82d8768d7351 | 188 | |
Lightvalve | 11:82d8768d7351 | 189 | extern int16_t VALVE_LIMIT_PLUS; |
Lightvalve | 11:82d8768d7351 | 190 | extern int16_t VALVE_LIMIT_MINUS; |
Lightvalve | 11:82d8768d7351 | 191 | |
Lightvalve | 11:82d8768d7351 | 192 | extern int16_t ENC_PULSE_PER_POSITION; |
Lightvalve | 11:82d8768d7351 | 193 | extern int16_t TORQUE_SENSOR_PULSE_PER_TORQUE; |
Lightvalve | 30:8d561f16383b | 194 | extern float PRES_SENSOR_A_PULSE_PER_BAR; |
Lightvalve | 30:8d561f16383b | 195 | extern float PRES_SENSOR_B_PULSE_PER_BAR; |
Lightvalve | 11:82d8768d7351 | 196 | |
Lightvalve | 11:82d8768d7351 | 197 | extern int HOMEPOS_OFFSET; |
Lightvalve | 11:82d8768d7351 | 198 | extern int HOMEPOS_VALVE_OPENING; |
Lightvalve | 11:82d8768d7351 | 199 | |
Lightvalve | 30:8d561f16383b | 200 | extern float FRICTION; |
Lightvalve | 30:8d561f16383b | 201 | extern float REF_PERIOD; |
Lightvalve | 30:8d561f16383b | 202 | extern float REF_MAG; |
Lightvalve | 11:82d8768d7351 | 203 | extern int REF_NUM; |
Lightvalve | 11:82d8768d7351 | 204 | |
Lightvalve | 11:82d8768d7351 | 205 | |
Lightvalve | 30:8d561f16383b | 206 | extern float DAC_REF; |
Lightvalve | 30:8d561f16383b | 207 | extern float DAC_RESOL; |
Lightvalve | 11:82d8768d7351 | 208 | |
Lightvalve | 11:82d8768d7351 | 209 | extern int REF_POSITION; |
Lightvalve | 11:82d8768d7351 | 210 | extern int REF_VELOCITY; |
Lightvalve | 11:82d8768d7351 | 211 | extern int16_t REF_TORQUE; |
Lightvalve | 11:82d8768d7351 | 212 | extern int16_t REF_PRES_DIFF; |
Lightvalve | 11:82d8768d7351 | 213 | extern int16_t REF_PWM; |
Lightvalve | 11:82d8768d7351 | 214 | extern int16_t REF_VALVE_POSITION; |
Lightvalve | 14:8e7590227d22 | 215 | extern int16_t REF_CURRENT; |
Lightvalve | 11:82d8768d7351 | 216 | |
Lightvalve | 11:82d8768d7351 | 217 | extern int REF_MOVE_TIME_5k; |
Lightvalve | 11:82d8768d7351 | 218 | extern int INIT_REF_PWM; |
Lightvalve | 11:82d8768d7351 | 219 | extern int INIT_REF_VALVE_POS; |
Lightvalve | 11:82d8768d7351 | 220 | extern int INIT_REF_POS; |
Lightvalve | 11:82d8768d7351 | 221 | extern int INIT_REF_VEL; |
Lightvalve | 11:82d8768d7351 | 222 | extern int INIT_REF_TORQUE; |
Lightvalve | 11:82d8768d7351 | 223 | extern int INIT_REF_PRES_DIFF; |
Lightvalve | 14:8e7590227d22 | 224 | extern int INIT_REF_CURRENT; |
Lightvalve | 11:82d8768d7351 | 225 | |
Lightvalve | 11:82d8768d7351 | 226 | extern int CUR_POSITION; |
Lightvalve | 11:82d8768d7351 | 227 | extern int CUR_VELOCITY; |
Lightvalve | 30:8d561f16383b | 228 | extern float CUR_TORQUE; |
Lightvalve | 30:8d561f16383b | 229 | extern float CUR_PRES_A; |
Lightvalve | 30:8d561f16383b | 230 | extern float CUR_PRES_B; |
Lightvalve | 11:82d8768d7351 | 231 | extern int CUR_PWM; |
Lightvalve | 11:82d8768d7351 | 232 | extern int CUR_VALVE_POSITION; |
Lightvalve | 11:82d8768d7351 | 233 | |
Lightvalve | 11:82d8768d7351 | 234 | extern unsigned int TMR2_COUNT_LED1; |
Lightvalve | 11:82d8768d7351 | 235 | extern unsigned int TMR2_COUNT_LED2; |
Lightvalve | 11:82d8768d7351 | 236 | extern unsigned int TMR2_COUNT_CAN_TX; |
Lightvalve | 11:82d8768d7351 | 237 | |
Lightvalve | 11:82d8768d7351 | 238 | extern int num_err; |
Lightvalve | 11:82d8768d7351 | 239 | extern int flag_err[8]; |
Lightvalve | 11:82d8768d7351 | 240 | extern int flag_err_old[8]; |
Lightvalve | 11:82d8768d7351 | 241 | extern int flag_err_rt; |
Lightvalve | 11:82d8768d7351 | 242 | |
Lightvalve | 11:82d8768d7351 | 243 | extern int flag_ref_enable; |
Lightvalve | 11:82d8768d7351 | 244 | |
Lightvalve | 11:82d8768d7351 | 245 | extern int flag_data_request[5]; |
Lightvalve | 11:82d8768d7351 | 246 | |
Lightvalve | 11:82d8768d7351 | 247 | //////////////////////////////////////////////////////////////////////////////// |
Lightvalve | 11:82d8768d7351 | 248 | ////////////////////////////// SEUNGHOON ADD /////////////////////////////////// |
Lightvalve | 11:82d8768d7351 | 249 | //////////////////////////////////////////////////////////////////////////////// |
Lightvalve | 11:82d8768d7351 | 250 | |
Lightvalve | 30:8d561f16383b | 251 | extern float CUR_PRES_A_BAR; |
Lightvalve | 30:8d561f16383b | 252 | extern float CUR_PRES_B_BAR; |
Lightvalve | 30:8d561f16383b | 253 | extern float CUR_TORQUE_NM; |
Lightvalve | 30:8d561f16383b | 254 | extern float CUR_TORQUE_NM_PRESS; |
Lightvalve | 11:82d8768d7351 | 255 | |
Lightvalve | 30:8d561f16383b | 256 | extern float PRES_A_VREF; |
Lightvalve | 30:8d561f16383b | 257 | extern float PRES_A_VREF_TEST; |
Lightvalve | 30:8d561f16383b | 258 | extern float PRES_B_VREF; |
Lightvalve | 30:8d561f16383b | 259 | extern float PRES_B_VREF_TEST; |
Lightvalve | 30:8d561f16383b | 260 | extern float TORQUE_VREF; |
Lightvalve | 11:82d8768d7351 | 261 | |
Lightvalve | 30:8d561f16383b | 262 | extern float VALVE_PWM_RAW_FB; |
Lightvalve | 30:8d561f16383b | 263 | extern float VALVE_PWM_RAW_FF; |
Lightvalve | 11:82d8768d7351 | 264 | extern int VALVE_PWM_VALVE_DZ; |
Lightvalve | 11:82d8768d7351 | 265 | extern int VALVE_INPUT_PWM; |
Lightvalve | 11:82d8768d7351 | 266 | |
Lightvalve | 30:8d561f16383b | 267 | extern float VALVE_GAIN_LPM_PER_V[10]; |
Lightvalve | 30:8d561f16383b | 268 | extern float VALVE_POS_VS_PWM[25]; |
Lightvalve | 11:82d8768d7351 | 269 | extern long JOINT_VEL[100]; |
Lightvalve | 11:82d8768d7351 | 270 | |
Lightvalve | 11:82d8768d7351 | 271 | extern int VALVE_MAX_POS; |
Lightvalve | 11:82d8768d7351 | 272 | extern int VALVE_MIN_POS; |
Lightvalve | 33:91b17819ec30 | 273 | extern float DDV_CENTER; |
Lightvalve | 11:82d8768d7351 | 274 | extern int VALVE_POS_NUM; |
Lightvalve | 32:4b8c0fedaf2c | 275 | extern int VALVE_CENTER_OFFSET_times10; |
Lightvalve | 32:4b8c0fedaf2c | 276 | extern float VALVE_CENTER_OFFSET; |
Lightvalve | 33:91b17819ec30 | 277 | extern float VALVE_DZ_MINUS_OFFSET; |
Lightvalve | 33:91b17819ec30 | 278 | extern float VALVE_DZ_PLUS_OFFSET; |
Lightvalve | 33:91b17819ec30 | 279 | extern float VALVE_DEADZONE_MINUS; |
Lightvalve | 33:91b17819ec30 | 280 | extern float VALVE_DEADZONE_PLUS; |
Lightvalve | 11:82d8768d7351 | 281 | |
Lightvalve | 14:8e7590227d22 | 282 | extern int TMR3_COUNT_FINDHOME; |
Lightvalve | 14:8e7590227d22 | 283 | extern int TMR3_COUNT_FLOWRATE; |
Lightvalve | 14:8e7590227d22 | 284 | extern int TMR3_COUNT_DEADZONE; |
Lightvalve | 14:8e7590227d22 | 285 | extern int TMR3_COUNT_PRES_NULL; |
Lightvalve | 14:8e7590227d22 | 286 | extern int TMR3_COUNT_TORQUE_NULL; |
Lightvalve | 14:8e7590227d22 | 287 | extern int TMR3_COUNT_PRES_CALIB; |
Lightvalve | 14:8e7590227d22 | 288 | extern int TMR3_COUNT_REFERENCE; |
Lightvalve | 14:8e7590227d22 | 289 | extern int TMR3_COUNT_JOINT; |
Lightvalve | 14:8e7590227d22 | 290 | extern int TMR3_COUNT_ROTARY_FRIC_TUNE; |
Lightvalve | 11:82d8768d7351 | 291 | |
Lightvalve | 11:82d8768d7351 | 292 | extern bool FLAG_REFERENCE_VALVE_PWM; |
Lightvalve | 11:82d8768d7351 | 293 | extern bool FLAG_REFERENCE_VALVE_POSITION; |
Lightvalve | 11:82d8768d7351 | 294 | extern bool FLAG_REFERENCE_JOINT_POSITION; |
Lightvalve | 11:82d8768d7351 | 295 | extern bool FLAG_REFERENCE_JOINT_TORQUE; |
Lightvalve | 11:82d8768d7351 | 296 | extern bool FLAG_REFERENCE_PRES_DIFF; |
Lightvalve | 14:8e7590227d22 | 297 | extern bool FLAG_REFERENCE_CURRENT; |
Lightvalve | 11:82d8768d7351 | 298 | |
Lightvalve | 30:8d561f16383b | 299 | extern float TUNING_TIME; |
Lightvalve | 11:82d8768d7351 | 300 | |
Lightvalve | 30:8d561f16383b | 301 | extern float REFERENCE_FREQ; |
Lightvalve | 30:8d561f16383b | 302 | extern float REFERENCE_MAG; |
Lightvalve | 11:82d8768d7351 | 303 | |
Lightvalve | 11:82d8768d7351 | 304 | extern bool FLAG_FIND_HOME; |
Lightvalve | 11:82d8768d7351 | 305 | |
Lightvalve | 11:82d8768d7351 | 306 | extern int MODE_JUMP_STATUS; |
Lightvalve | 11:82d8768d7351 | 307 | |
Lightvalve | 30:8d561f16383b | 308 | extern float CUR_PRES_DIFF_BAR; |
Lightvalve | 30:8d561f16383b | 309 | extern float CUR_PRES_A_sum; |
Lightvalve | 30:8d561f16383b | 310 | extern float CUR_PRES_B_sum; |
Lightvalve | 30:8d561f16383b | 311 | extern float CUR_PRES_A_mean; |
Lightvalve | 30:8d561f16383b | 312 | extern float CUR_PRES_B_mean; |
Lightvalve | 30:8d561f16383b | 313 | extern float CUR_TORQUE_sum; |
Lightvalve | 30:8d561f16383b | 314 | extern float CUR_TORQUE_mean; |
Lightvalve | 30:8d561f16383b | 315 | extern float PRES_A_NULL; |
Lightvalve | 30:8d561f16383b | 316 | extern float PRES_B_NULL; |
Lightvalve | 30:8d561f16383b | 317 | extern float TORQUE_NULL; |
Lightvalve | 13:747daba9cf59 | 318 | |
Lightvalve | 30:8d561f16383b | 319 | extern float Ref_Valve_Pos_Old; |
Lightvalve | 13:747daba9cf59 | 320 | |
Lightvalve | 13:747daba9cf59 | 321 | extern int VALVE_ID_timer; |
Lightvalve | 13:747daba9cf59 | 322 | extern int VALVE_DZ_timer; |
Lightvalve | 13:747daba9cf59 | 323 | extern int VALVE_FR_timer; |
Lightvalve | 35:34ce7b0347b8 | 324 | extern int VALVE_HPL_timer; |
Lightvalve | 13:747daba9cf59 | 325 | extern int VALVE_POS_TMP; |
Lightvalve | 13:747daba9cf59 | 326 | extern int JOINT_VEL_TMP; |
Lightvalve | 13:747daba9cf59 | 327 | extern int DDV_POS_AVG ; |
Lightvalve | 19:23b7c1ad8683 | 328 | extern int VALVE_POS_AVG[50]; |
Lightvalve | 13:747daba9cf59 | 329 | extern int VALVE_POS_AVG_OLD; |
Lightvalve | 13:747daba9cf59 | 330 | extern int data_num; |
Lightvalve | 13:747daba9cf59 | 331 | extern int ID_index; |
Lightvalve | 13:747daba9cf59 | 332 | extern int DZ_index; |
Lightvalve | 19:23b7c1ad8683 | 333 | extern int ID_index_array[50]; |
Lightvalve | 13:747daba9cf59 | 334 | extern int first_check; |
Lightvalve | 30:8d561f16383b | 335 | extern float init_time; |
Lightvalve | 13:747daba9cf59 | 336 | extern int VEL_POINT; |
Lightvalve | 13:747daba9cf59 | 337 | extern int DZ_case; |
Lightvalve | 13:747daba9cf59 | 338 | extern int START_POS; |
Lightvalve | 13:747daba9cf59 | 339 | extern int FINAL_POS; |
Lightvalve | 13:747daba9cf59 | 340 | extern int DZ_DIRECTION; |
Lightvalve | 13:747daba9cf59 | 341 | extern int FIRST_DZ; |
Lightvalve | 13:747daba9cf59 | 342 | extern int SECOND_DZ; |
Lightvalve | 13:747daba9cf59 | 343 | extern int DZ_NUM; |
Lightvalve | 13:747daba9cf59 | 344 | extern int one_period_end; |
Lightvalve | 30:8d561f16383b | 345 | extern float Ref_Vel_Test; |
Lightvalve | 13:747daba9cf59 | 346 | extern long TMR2_FOR_SLOW_LOGGING; |
Lightvalve | 19:23b7c1ad8683 | 347 | //extern int velcount; |
Lightvalve | 13:747daba9cf59 | 348 | extern char max_check; |
Lightvalve | 13:747daba9cf59 | 349 | extern char min_check; |
Lightvalve | 13:747daba9cf59 | 350 | |
Lightvalve | 30:8d561f16383b | 351 | extern float valve_pos_err, valve_pos_err_old, valve_pos_err_diff, valve_pos_err_sum; |
Lightvalve | 30:8d561f16383b | 352 | extern float joint_pos_err, joint_pos_err_old, joint_pos_err_diff, joint_pos_err_diff_fil, joint_pos_err_sum; |
Lightvalve | 30:8d561f16383b | 353 | extern float joint_torq_err, joint_torq_err_old, joint_torq_err_diff, joint_torq_err_sum; |
Lightvalve | 30:8d561f16383b | 354 | extern float VALVE_PWM_RAW_POS, VALVE_PWM_RAW_TORQ; |
Lightvalve | 13:747daba9cf59 | 355 | |
Lightvalve | 30:8d561f16383b | 356 | extern float CUR_FLOWRATE; |
Lightvalve | 30:8d561f16383b | 357 | extern float VALVE_FF_VOLTAGE; |
Lightvalve | 13:747daba9cf59 | 358 | |
Lightvalve | 13:747daba9cf59 | 359 | extern int pos_plus_end; |
Lightvalve | 13:747daba9cf59 | 360 | extern int pos_minus_end; |
Lightvalve | 13:747daba9cf59 | 361 | |
Lightvalve | 13:747daba9cf59 | 362 | extern bool need_enc_init; |
Lightvalve | 13:747daba9cf59 | 363 | |
Lightvalve | 13:747daba9cf59 | 364 | extern int temp_time; |
Lightvalve | 13:747daba9cf59 | 365 | |
Lightvalve | 30:8d561f16383b | 366 | extern float CUR_VELOCITY_sum; |
Lightvalve | 30:8d561f16383b | 367 | extern float temp_vel_sum; |
Lightvalve | 13:747daba9cf59 | 368 | |
Lightvalve | 13:747daba9cf59 | 369 | extern int DZ_dir; |
Lightvalve | 13:747daba9cf59 | 370 | extern int DZ_temp_cnt; |
Lightvalve | 13:747daba9cf59 | 371 | extern int DZ_temp_cnt2; |
Lightvalve | 13:747daba9cf59 | 372 | extern int DZ_end; |
Lightvalve | 13:747daba9cf59 | 373 | extern int flag_flowrate; |
Lightvalve | 13:747daba9cf59 | 374 | extern int fl_temp_cnt; |
Lightvalve | 13:747daba9cf59 | 375 | extern int fl_temp_cnt2; |
Lightvalve | 13:747daba9cf59 | 376 | extern int cur_vel_sum; |
Lightvalve | 13:747daba9cf59 | 377 | |
Lightvalve | 13:747daba9cf59 | 378 | // find home |
Lightvalve | 13:747daba9cf59 | 379 | extern int CUR_VELOCITY_OLD; |
Lightvalve | 13:747daba9cf59 | 380 | extern int cnt_findhome; |
Lightvalve | 13:747daba9cf59 | 381 | extern int cnt_vel_findhome; |
Lightvalve | 13:747daba9cf59 | 382 | extern int FINDHOME_VELOCITY; |
Lightvalve | 13:747daba9cf59 | 383 | extern int FINDHOME_VELOCITY_OLD; |
Lightvalve | 13:747daba9cf59 | 384 | extern int FINDHOME_POSITION; |
Lightvalve | 13:747daba9cf59 | 385 | extern int FINDHOME_POSITION_OLD; |
Lightvalve | 13:747daba9cf59 | 386 | |
Lightvalve | 13:747daba9cf59 | 387 | // valve gain |
Lightvalve | 13:747daba9cf59 | 388 | extern int check_vel_pos_init; |
Lightvalve | 13:747daba9cf59 | 389 | extern int check_vel_pos_fin; |
Lightvalve | 13:747daba9cf59 | 390 | extern int check_vel_pos_interv; |
Lightvalve | 13:747daba9cf59 | 391 | extern int valve_gain_repeat_cnt; |
Lightvalve | 30:8d561f16383b | 392 | extern float VALVE_VOLTAGE; |
Lightvalve | 13:747daba9cf59 | 393 | |
Lightvalve | 30:8d561f16383b | 394 | extern float freq_fric_tune; |
Lightvalve | 13:747daba9cf59 | 395 | |
Lightvalve | 14:8e7590227d22 | 396 | extern bool FLAG_VALVE_OUTPUT_CALIB; |
Lightvalve | 14:8e7590227d22 | 397 | |
Lightvalve | 14:8e7590227d22 | 398 | extern uint32_t TMR3_COUNT_CAN_TX; |
Lightvalve | 14:8e7590227d22 | 399 | |
Lightvalve | 30:8d561f16383b | 400 | extern float I_REF; |
Lightvalve | 14:8e7590227d22 | 401 | extern int TMR3_COUNT_IREF; |
Lightvalve | 30:8d561f16383b | 402 | extern float CUR_CURRENT; |
Lightvalve | 30:8d561f16383b | 403 | extern float u_CUR[3]; |
Lightvalve | 19:23b7c1ad8683 | 404 | |
Lightvalve | 29:69f3f5445d6d | 405 | extern int FINDHOME_STAGE; |
Lightvalve | 29:69f3f5445d6d | 406 | extern int FINDHOME_INIT; |
Lightvalve | 29:69f3f5445d6d | 407 | extern int FINDHOME_GOTOLIMIT; |
Lightvalve | 29:69f3f5445d6d | 408 | extern int FINDHOME_ZEROPOSE; |
Lightvalve | 29:69f3f5445d6d | 409 | |
Lightvalve | 23:59218d4a256d | 410 | //extern int h1, h2, h3, h4, h5, h6; |
Lightvalve | 23:59218d4a256d | 411 | |
Lightvalve | 23:59218d4a256d | 412 | |
Lightvalve | 23:59218d4a256d | 413 | |
Lightvalve | 26:8317d883d4f2 | 414 | |
Lightvalve | 30:8d561f16383b | 415 | |
Lightvalve | 30:8d561f16383b | 416 | |
Lightvalve | 32:4b8c0fedaf2c | 417 | |
Lightvalve | 35:34ce7b0347b8 | 418 | |
Lightvalve | 36:a46e63505ed8 | 419 |