summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorYanzhenXiangRobotics <xyz000327@gmail.com>2023-04-26 10:58:22 +0200
committerYanzhenXiangRobotics <xyz000327@gmail.com>2023-04-26 10:58:22 +0200
commit47c9e3b59640109c9e4d2bbd15e277e3e2b1a483 (patch)
tree849b4b6c9ce7b45ecfccd8879b11de2360b4792f /templates
parentADD: pass task 6 (diff)
downloadmpc_pe-47c9e3b59640109c9e4d2bbd15e277e3e2b1a483.tar.gz
mpc_pe-47c9e3b59640109c9e4d2bbd15e277e3e2b1a483.zip
ADD: another approach passing task 6
Diffstat (limited to '')
-rw-r--r--templates/LQR.m5
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)