diff options
author | YanzhenXiangRobotics <xyz000327@gmail.com> | 2023-04-26 10:58:22 +0200 |
---|---|---|
committer | YanzhenXiangRobotics <xyz000327@gmail.com> | 2023-04-26 10:58:22 +0200 |
commit | 47c9e3b59640109c9e4d2bbd15e277e3e2b1a483 (patch) | |
tree | 849b4b6c9ce7b45ecfccd8879b11de2360b4792f | |
parent | ADD: pass task 6 (diff) | |
download | mpc_pe-47c9e3b59640109c9e4d2bbd15e277e3e2b1a483.tar.gz mpc_pe-47c9e3b59640109c9e4d2bbd15e277e3e2b1a483.zip |
ADD: another approach passing task 6
-rw-r--r-- | templates/LQR.m | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/templates/LQR.m b/templates/LQR.m index c84a670..c05237d 100644 --- a/templates/LQR.m +++ b/templates/LQR.m @@ -18,9 +18,10 @@ classdef LQR % obj.K = ... (save feedback matrix for use in eval function) A = params.model.A; B = params.model.B; - [X, L, G] = dare(A,B,Q,R); + % [X, L, G] = dare(A,B,Q,R); + [K,S,e] = dlqr(A,B,Q,R) % obj.K = -inv(B'*P_inf*B+R)*B'*P_inf*A; - obj.K = -G; + obj.K = -K; end function [u, ctrl_info] = eval(obj,x) |