![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
for learning
Diff: main.cpp
- Revision:
- 141:4eb8790e7b78
- Parent:
- 140:cc5bc7fb0a16
- Child:
- 142:43026242815a
diff -r cc5bc7fb0a16 -r 4eb8790e7b78 main.cpp --- a/main.cpp Thu Oct 08 00:33:35 2020 +0000 +++ b/main.cpp Thu Oct 08 03:44:03 2020 +0000 @@ -1,4 +1,4 @@ -//201008-2 +//201008-3 #include "mbed.h" #include "FastPWM.h" #include "INIT_HW.h" @@ -1740,11 +1740,11 @@ torq.err = torq.ref - torq.sen; //[N] torq.err_sum += torq.err/(float) TMR_FREQ_5k; //[N] - float k3 = 3000.0f; + float k3 = 2000.0f; float k4 = 1000.0f; - float rho3 = 1.0f; - float rho4 = 50000.0f; -// float rho4 = 100000.0f; + float rho3 = 2.0f; +// float rho4 = 50000.0f; + float rho4 = 100000.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 +1761,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 = 100.0f; + float rho_gamma = 10000.0f; 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;