20210203

Dependencies:   mbed FastPWM

Revision:
142:43026242815a
Parent:
141:4eb8790e7b78
Child:
143:d441540d477e
diff -r 4eb8790e7b78 -r 43026242815a main.cpp
--- a/main.cpp	Thu Oct 08 03:44:03 2020 +0000
+++ b/main.cpp	Thu Oct 08 06:10:16 2020 +0000
@@ -1720,7 +1720,7 @@
                     }
                 }
                 float tau = 0.01f;
-                float K_valve = 0.04f;
+                float K_valve = 0.0004f;
                 
                 float x_v = 0.0f;   //x_v : -1~1
                 if(value>=VALVE_CENTER) {
@@ -1740,11 +1740,10 @@
                 torq.err = torq.ref - torq.sen; //[N]
                 torq.err_sum += torq.err/(float) TMR_FREQ_5k; //[N]
                 
-                float k3 = 2000.0f;
-                float k4 = 1000.0f;
-                float rho3 = 2.0f;
-//                float rho4 = 50000.0f;
-                float rho4 = 100000.0f;
+                float k3 = 20000.0f; //2000
+                float k4 = 10.0f;
+                float rho3 = 3.2f;
+                float rho4 = 25000000.0f;
                 float x_4_des = (-f3 + torq_ref_dot - k3*(-torq.err))/(gamma_hat*g3_prime);
                 if (x_4_des > 1) x_4_des = 1;
                 else if (x_4_des < -1) x_4_des = -1;
@@ -1761,7 +1760,7 @@
                 
                 V_out = (-f4 + x_4_des_dot - k4*(x_v-x_4_des)- rho3/rho4*gamma_hat*g3_prime*(-torq.err))/g4;
                 
-                float rho_gamma = 10000.0f;
+                float rho_gamma = 50000.0f;//5000
                 float gamma_hat_dot = rho3*(-torq.err)/rho_gamma*((-f3+torq_ref_dot-k3*(-torq.err))/gamma_hat + g3_prime*(x_v-x_4_des));
                 gamma_hat = gamma_hat + gamma_hat_dot / (float) TMR_FREQ_5k;
                 break;