Original Version of STM Board

Dependencies:   FastPWM mbed

Revision:
227:699c3e572283
Parent:
226:82a3ca333004
Child:
230:2c3e5ecbe7e1
diff -r 82a3ca333004 -r 699c3e572283 function_utilities/function_utilities.cpp
--- a/function_utilities/function_utilities.cpp	Wed Mar 03 10:56:25 2021 +0000
+++ b/function_utilities/function_utilities.cpp	Thu Mar 11 07:27:23 2021 +0000
@@ -17,7 +17,7 @@
 uint8_t CONTROL_UTILITY_MODE = 0;
 uint8_t CURRENT_CONTROL_MODE = 0; // (0 : pwm, 1 : current control)
 uint8_t FLAG_VALVE_DEADZONE = 0;
-uint8_t REFERENCE_MODE = 0;
+uint8_t REFERENCE_MODE = 1;
 int16_t CAN_FREQ = 500;
 int16_t DIR_JOINT_ENC = 0;
 int16_t DIR_VALVE = 0;
@@ -113,10 +113,11 @@
 float DAC_REF;
 float DAC_RESOL;
 
-int REF_POSITION;
-int REF_VELOCITY;
-int16_t REF_TORQUE;
-int16_t REF_PRES_DIFF;
+float REF_POSITION;
+float REF_VELOCITY;
+float REF_TORQUE;
+float REF_TORQUE_OLD;
+float REF_PRES_DIFF;
 int16_t REF_PWM;
 int16_t REF_VALVE_POSITION;
 int16_t REF_CURRENT;
@@ -287,6 +288,20 @@
 int FINDHOME_POSITION = 0;
 int FINDHOME_POSITION_OLD = 0;
 
+int cnt_finddz = 0;
+int cnt_vel_finddz = 0;
+int flag_finddz = 0;
+int FINDDZ_VELOCITY = 0;
+int FINDDZ_VELOCITY_OLD = 0;
+int FINDDZ_POSITION = 0;
+int FINDDZ_POSITION_OLD = 0;
+
+double temp_VALVE_DEADZONE_PLUS = 0.0f;
+double temp_VALVE_DEADZONE_MINUS = 0.0f;
+float temp_pos_ref = 0.0f;
+float temp_pos_ref_offset = 0.0f;
+
+
 // valve gain
 int check_vel_pos_init = 0;
 int check_vel_pos_fin = 0;
@@ -328,6 +343,12 @@
 int FINDHOME_GOTOLIMIT = 1;
 int FINDHOME_ZEROPOSE = 2;
 
+int FINDDZ_STAGE = 0;
+int FINDDZ_INIT = 0;
+int FINDDZ_START1 = 1;
+int FINDDZ_START2 = 2;
+int FINDDZ_STOP = 3;
+
 float alpha_trans = 0.0f;
 
 float V_out=0.0f;
@@ -389,7 +410,6 @@
     for (i = 0; i < 1000000; i++) {
         ;
     }
-
 }