![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Original Version of STM Board
Diff: CAN/function_CAN.h
- Revision:
- 230:2c3e5ecbe7e1
- Parent:
- 227:699c3e572283
- Child:
- 236:c16774af92ed
diff -r 7a1c46b9b471 -r 2c3e5ecbe7e1 CAN/function_CAN.h --- a/CAN/function_CAN.h Tue Apr 20 00:42:45 2021 +0000 +++ b/CAN/function_CAN.h Wed Apr 21 04:20:39 2021 +0000 @@ -45,7 +45,10 @@ #define CRX_SET_VOLTAGE_SUPPLY 112 #define CRX_ASK_VOLTAGE_VALVE 13 #define CRX_SET_VOLTAGE_VALVE 113 -#define CRX_SET_HOMEPOS 114 +#define CRX_SET_HOMEPOS 114 +#define CRX_ASK_VARIABLE_SUPPLY 15 +#define CRX_SET_VARIABLE_SUPPLY 115 + #define CRX_ASK_PID_GAIN 20 #define CRX_SET_PID_GAIN 120 #define CRX_ASK_VALVE_DEADZONE 21 @@ -62,8 +65,8 @@ #define CRX_SET_CHAMBER_VOLUME 127 #define CRX_ASK_PISTON_AREA 28 #define CRX_SET_PISTON_AREA 128 -#define CRX_ASK_PRES 29 -#define CRX_SET_PRES 129 +#define CRX_ASK_SUP_PRES 29 +#define CRX_SET_SUP_PRES 129 #define CRX_ASK_ENC_LIMIT 30 #define CRX_SET_ENC_LIMIT 130 #define CRX_ASK_STROKE 31 @@ -119,6 +122,7 @@ #define CTX_SEND_VALVE_ENC_DIR 11 #define CTX_SEND_VOLTAGE_SUPPLY 12 #define CTX_SEND_VOLTAGE_VALVE 13 +#define CTX_SEND_VARIABLE_SUPPLY 15 #define CTX_SEND_PID_GAIN 20 #define CTX_SEND_VALVE_DEADZONE 21 #define CTX_SEND_VELOCITY_COMP_GAIN 22 @@ -127,7 +131,7 @@ #define CTX_SEND_BULK_MODULUS 26 #define CTX_SEND_CHAMBER_VOLUME 27 #define CTX_SEND_PISTON_AREA 28 -#define CTX_SEND_PRES 29 +#define CTX_SEND_SUP_PRES 29 #define CTX_SEND_ENC_LIMIT 30 #define CTX_SEND_STROKE 31 #define CTX_SEND_VALVE_LIMIT 32 @@ -168,6 +172,8 @@ void CAN_TX_VALVE_ENC_DIR(void); void CAN_TX_VOLTAGE_SUPPLY(void); void CAN_TX_VOLTAGE_VALVE(void); +void CAN_TX_VARIABLE_SUPPLY_ONOFF(void); + void CAN_TX_PID_GAIN(int t_type); void CAN_TX_VALVE_DEADZONE(void); void CAN_TX_VELOCITY_COMP_GAIN(void); @@ -176,7 +182,7 @@ void CAN_TX_BULK_MODULUS(void); void CAN_TX_CHAMBER_VOLUME(void); void CAN_TX_PISTON_AREA(void); -void CAN_TX_PRES_A_AND_B(void); +void CAN_TX_SUP_PRES(void); void CAN_TX_ENC_LIMIT(void); void CAN_TX_STROKE(void); void CAN_TX_VALVE_LIMIT(void); @@ -199,10 +205,8 @@ { public: float sen; + float sen_diff; float ref; - float ref_old; - float ref_diff; - float ref_home_pos; float err; float err_int; float err_old; @@ -211,20 +215,23 @@ public: State(){ sen = 0.0f; + sen_diff = 0.0f; ref = 0.0f; - ref_old = 0.0f; - ref_diff = 0.0f; - ref_home_pos = 0.0f; err = 0.0f; err_int = 0.0f; err_old = 0.0f; err_diff = 0.0f; } + + void UpdateSen(float sen_new, float Freq_update, float f_cut = 1000.0f); + void UpdateRef(float ref_new); + void Reset(); }; extern State pos; extern State vel; extern State Vout; +extern State force; extern State torq; extern State torq_dot; extern State pres_A;