diff --git a/User/module/balance_chassis.c b/User/module/balance_chassis.c index 90d6289..8d08335 100644 --- a/User/module/balance_chassis.c +++ b/User/module/balance_chassis.c @@ -762,11 +762,11 @@ int8_t Chassis_LQRControl(Chassis_t *c, const Chassis_CMD_t *c_cmd) { /* ==================== 目标状态 ==================== */ LQR_State_t target_state = { - .theta = 0.0f, + .theta = 0.0f+c->param->lqr_offset.theta, .d_theta = 0.0f, - .phi = 0.0f, + .phi = 0.0f+c->param->lqr_offset.phi, .d_phi = 0.0f, - .x = c->chassis_state.target_x, + .x = c->chassis_state.target_x+c->param->lqr_offset.x, .d_x = c->chassis_state.target_velocity_x, }; diff --git a/utils/Simulation-master/balance/series_legs/get_k_length.m b/utils/Simulation-master/balance/series_legs/get_k_length.m index 03d19c3..d46203b 100644 --- a/utils/Simulation-master/balance/series_legs/get_k_length.m +++ b/utils/Simulation-master/balance/series_legs/get_k_length.m @@ -48,8 +48,8 @@ function K = get_k_length(leg_length) B=subs(B,[R,L,LM,l,mw,mp,M,Iw,Ip,IM,g],[R1,L1,LM1,l1,mw1,mp1,M1,Iw1,Ip1,IM1,9.8]); B=double(B); - Q=diag([4000 200 500 50 50000 10]);%theta d_theta x d_x phi d_phi%700 1 600 200 1000 1 - R=[150 0;0 5]; %T Tp + Q=diag([4000 200 1000 500 50000 10]);%theta d_theta x d_x phi d_phi%700 1 600 200 1000 1 + R=[150 0;0 25]; %T Tp K=lqr(A,B,Q,R);