Sungwoo Kim
/
HydraulicControlBoard_Learning
for learning
Diff: setting.h
- Revision:
- 30:8d561f16383b
- Parent:
- 29:69f3f5445d6d
- Child:
- 32:4b8c0fedaf2c
diff -r 69f3f5445d6d -r 8d561f16383b setting.h --- a/setting.h Wed Oct 02 04:41:59 2019 +0000 +++ b/setting.h Fri Oct 04 11:58:18 2019 +0000 @@ -11,18 +11,18 @@ #define TMR3_COUNT 0x4650 // loop 5k #define TMR2_COUNT 0x2710 // loop 500hz with prescale 18 -#define FREQ_500 500.0 -#define FREQ_1k 1000.0 -#define FREQ_5k 5000.0 -#define FREQ_10k 10000.0 -#define FREQ_20k 20000.0 -#define FREQ_40k 40000.0 -#define DT_500 0.002 -#define DT_1k 0.0005 -#define DT_5k 0.0002 -#define DT_10k 0.0001 -#define DT_20k 0.00005 -#define DT_40k 0.000025 +#define FREQ_500 500.0f +#define FREQ_1k 1000.0f +#define FREQ_5k 5000.0f +#define FREQ_10k 10000.0f +#define FREQ_20k 20000.0f +#define FREQ_40k 40000.0f +#define DT_500 0.002f +#define DT_1k 0.0005f +#define DT_5k 0.0002f +#define DT_10k 0.0001f +#define DT_20k 0.00005f +#define DT_40k 0.000025f //extern int CID_RX_CMD; //extern int CID_RX_REF_POSITION; @@ -46,8 +46,8 @@ extern AnalogOut dac_1; extern AnalogOut dac_2; -extern double dtc_v; -extern double dtc_w; +extern float dtc_v; +extern float dtc_w; // I2C extern I2C i2c; // SDA, SCL (for K22F) @@ -86,13 +86,13 @@ /******************************************************************************* * COMMON CONSTANTS ******************************************************************************/ -#define RAD_30 0.523598775598299 -#define RAD_60 1.047197551196598 -#define RAD_120 2.094395102393195 -#define RAD_180 3.141592653589793 -#define RAD_240 4.188790204786391 -#define RAD_300 5.235987755982989 -#define RAD_360 6.283185307179586 +#define RAD_30 0.523598775598299f +#define RAD_60 1.047197551196598f +#define RAD_120 2.094395102393195f +#define RAD_180 3.141592653589793f +#define RAD_240 4.188790204786391f +#define RAD_300 5.235987755982989f +#define RAD_360 6.283185307179586f #define SYSFREQ 200000000 #define PBCLK 100000000 @@ -109,9 +109,9 @@ #define DIGITAL 0 #define ANALOG 1 -#define PI 3.141592653589793 -#define D2R 0.017453292519943 -#define R2D 57.295779513082323 +#define PI 3.141592653589793f +#define D2R 0.017453292519943f +#define R2D 57.295779513082323f /******************************************************************************* @@ -134,18 +134,18 @@ extern int16_t DIR_VALVE; extern int16_t DIR_VALVE_ENC; -extern double SUPPLY_VOLTAGE; -extern double VALVE_VOLTAGE_LIMIT; +extern float SUPPLY_VOLTAGE; +extern float VALVE_VOLTAGE_LIMIT; -extern double P_GAIN_VALVE_POSITION; -extern double I_GAIN_VALVE_POSITION; -extern double D_GAIN_VALVE_POSITION; -extern double P_GAIN_JOINT_POSITION; -extern double I_GAIN_JOINT_POSITION; -extern double D_GAIN_JOINT_POSITION; -extern double P_GAIN_JOINT_TORQUE; -extern double I_GAIN_JOINT_TORQUE; -extern double D_GAIN_JOINT_TORQUE; +extern float P_GAIN_VALVE_POSITION; +extern float I_GAIN_VALVE_POSITION; +extern float D_GAIN_VALVE_POSITION; +extern float P_GAIN_JOINT_POSITION; +extern float I_GAIN_JOINT_POSITION; +extern float D_GAIN_JOINT_POSITION; +extern float P_GAIN_JOINT_TORQUE; +extern float I_GAIN_JOINT_TORQUE; +extern float D_GAIN_JOINT_TORQUE; extern int16_t VALVE_DEADZONE_PLUS; extern int16_t VALVE_DEADZONE_MINUS; @@ -164,7 +164,7 @@ extern int16_t PISTON_AREA_A; extern int16_t PISTON_AREA_B; -extern double PISTON_AREA_alpha; +extern float PISTON_AREA_alpha; extern int16_t PRES_SUPPLY; @@ -181,20 +181,20 @@ extern int16_t ENC_PULSE_PER_POSITION; extern int16_t TORQUE_SENSOR_PULSE_PER_TORQUE; -extern double PRES_SENSOR_A_PULSE_PER_BAR; -extern double PRES_SENSOR_B_PULSE_PER_BAR; +extern float PRES_SENSOR_A_PULSE_PER_BAR; +extern float PRES_SENSOR_B_PULSE_PER_BAR; extern int HOMEPOS_OFFSET; extern int HOMEPOS_VALVE_OPENING; -extern double FRICTION; -extern double REF_PERIOD; -extern double REF_MAG; +extern float FRICTION; +extern float REF_PERIOD; +extern float REF_MAG; extern int REF_NUM; -extern double DAC_REF; -extern double DAC_RESOL; +extern float DAC_REF; +extern float DAC_RESOL; extern int REF_POSITION; extern int REF_VELOCITY; @@ -215,9 +215,9 @@ extern int CUR_POSITION; extern int CUR_VELOCITY; -extern double CUR_TORQUE; -extern double CUR_PRES_A; -extern double CUR_PRES_B; +extern float CUR_TORQUE; +extern float CUR_PRES_A; +extern float CUR_PRES_B; extern int CUR_PWM; extern int CUR_VALVE_POSITION; @@ -238,24 +238,24 @@ ////////////////////////////// SEUNGHOON ADD /////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -extern double CUR_PRES_A_BAR; -extern double CUR_PRES_B_BAR; -extern double CUR_TORQUE_NM; -extern double CUR_TORQUE_NM_PRESS; +extern float CUR_PRES_A_BAR; +extern float CUR_PRES_B_BAR; +extern float CUR_TORQUE_NM; +extern float CUR_TORQUE_NM_PRESS; -extern double PRES_A_VREF; -extern double PRES_A_VREF_TEST; -extern double PRES_B_VREF; -extern double PRES_B_VREF_TEST; -extern double TORQUE_VREF; +extern float PRES_A_VREF; +extern float PRES_A_VREF_TEST; +extern float PRES_B_VREF; +extern float PRES_B_VREF_TEST; +extern float TORQUE_VREF; -extern double VALVE_PWM_RAW_FB; -extern double VALVE_PWM_RAW_FF; +extern float VALVE_PWM_RAW_FB; +extern float VALVE_PWM_RAW_FF; extern int VALVE_PWM_VALVE_DZ; extern int VALVE_INPUT_PWM; -extern double VALVE_GAIN_LPM_PER_V[10]; -extern double VALVE_POS_VS_PWM[25]; +extern float VALVE_GAIN_LPM_PER_V[10]; +extern float VALVE_POS_VS_PWM[25]; extern long JOINT_VEL[100]; extern int VALVE_MAX_POS; @@ -280,27 +280,27 @@ extern bool FLAG_REFERENCE_PRES_DIFF; extern bool FLAG_REFERENCE_CURRENT; -extern double TUNING_TIME; +extern float TUNING_TIME; -extern double REFERENCE_FREQ; -extern double REFERENCE_MAG; +extern float REFERENCE_FREQ; +extern float REFERENCE_MAG; extern bool FLAG_FIND_HOME; extern int MODE_JUMP_STATUS; -extern double CUR_PRES_DIFF_BAR; -extern double CUR_PRES_A_sum; -extern double CUR_PRES_B_sum; -extern double CUR_PRES_A_mean; -extern double CUR_PRES_B_mean; -extern double CUR_TORQUE_sum; -extern double CUR_TORQUE_mean; -extern double PRES_A_NULL; -extern double PRES_B_NULL; -extern double TORQUE_NULL; +extern float CUR_PRES_DIFF_BAR; +extern float CUR_PRES_A_sum; +extern float CUR_PRES_B_sum; +extern float CUR_PRES_A_mean; +extern float CUR_PRES_B_mean; +extern float CUR_TORQUE_sum; +extern float CUR_TORQUE_mean; +extern float PRES_A_NULL; +extern float PRES_B_NULL; +extern float TORQUE_NULL; -extern double Ref_Valve_Pos_Old; +extern float Ref_Valve_Pos_Old; extern int VALVE_ID_timer; extern int VALVE_DZ_timer; @@ -315,7 +315,7 @@ extern int DZ_index; extern int ID_index_array[50]; extern int first_check; -extern double init_time; +extern float init_time; extern int VEL_POINT; extern int DZ_case; extern int START_POS; @@ -325,19 +325,19 @@ extern int SECOND_DZ; extern int DZ_NUM; extern int one_period_end; -extern double Ref_Vel_Test; +extern float Ref_Vel_Test; extern long TMR2_FOR_SLOW_LOGGING; //extern int velcount; extern char max_check; extern char min_check; -extern double valve_pos_err, valve_pos_err_old, valve_pos_err_diff, valve_pos_err_sum; -extern double joint_pos_err, joint_pos_err_old, joint_pos_err_diff, joint_pos_err_diff_fil, joint_pos_err_sum; -extern double joint_torq_err, joint_torq_err_old, joint_torq_err_diff, joint_torq_err_sum; -extern double VALVE_PWM_RAW_POS, VALVE_PWM_RAW_TORQ; +extern float valve_pos_err, valve_pos_err_old, valve_pos_err_diff, valve_pos_err_sum; +extern float joint_pos_err, joint_pos_err_old, joint_pos_err_diff, joint_pos_err_diff_fil, joint_pos_err_sum; +extern float joint_torq_err, joint_torq_err_old, joint_torq_err_diff, joint_torq_err_sum; +extern float VALVE_PWM_RAW_POS, VALVE_PWM_RAW_TORQ; -extern double CUR_FLOWRATE; -extern double VALVE_FF_VOLTAGE; +extern float CUR_FLOWRATE; +extern float VALVE_FF_VOLTAGE; extern int pos_plus_end; extern int pos_minus_end; @@ -346,8 +346,8 @@ extern int temp_time; -extern double CUR_VELOCITY_sum; -extern double temp_vel_sum; +extern float CUR_VELOCITY_sum; +extern float temp_vel_sum; extern int DZ_dir; extern int DZ_temp_cnt; @@ -372,18 +372,18 @@ extern int check_vel_pos_fin; extern int check_vel_pos_interv; extern int valve_gain_repeat_cnt; -extern double VALVE_VOLTAGE; +extern float VALVE_VOLTAGE; -extern double freq_fric_tune; +extern float freq_fric_tune; extern bool FLAG_VALVE_OUTPUT_CALIB; extern uint32_t TMR3_COUNT_CAN_TX; -extern double I_REF; +extern float I_REF; extern int TMR3_COUNT_IREF; -extern double CUR_CURRENT; -extern double u_CUR[3]; +extern float CUR_CURRENT; +extern float u_CUR[3]; extern int FINDHOME_STAGE; extern int FINDHOME_INIT; @@ -395,3 +395,5 @@ + +