summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYanzhenXiangRobotics <xyz000327@gmail.com>2023-05-11 07:54:17 +0200
committerYanzhenXiangRobotics <xyz000327@gmail.com>2023-05-11 07:54:17 +0200
commit28da3e20b81bac077792736847e0c48a8a68a06d (patch)
treec89ec54da835e02cd5ef949c08c02752c966f275
parentADD: pass task 25 (diff)
downloadmpc_pe-28da3e20b81bac077792736847e0c48a8a68a06d.tar.gz
mpc_pe-28da3e20b81bac077792736847e0c48a8a68a06d.zip
ADD: pass 26
-rw-r--r--templates/simulate_uncertain.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/templates/simulate_uncertain.m b/templates/simulate_uncertain.m
index dc9df26..f74f7af 100644
--- a/templates/simulate_uncertain.m
+++ b/templates/simulate_uncertain.m
@@ -8,4 +8,17 @@
function [Xt,Ut,ctrl_info] = simulate_uncertain(x0, ctrl, Wt, params)
% YOUR CODE HERE
+ Xt = [x0];
+ Ut = [];
+ x = x0
+ ctrl_info = [];
+ % obj = LQR();
+ for i = 1:params.model.HorizonLength
+ [u, ctrl_info_] = ctrl.eval(x);
+ Ut = [Ut u];
+ ctrl_info = [ctrl_info ctrl_info_];
+ x = params.model.A*x + params.model.B*u + Wt(:,i);
+ Xt = [Xt x];
+ end
+ % plot_trajectory(Xt, Ut, ctrl_info, params);
end \ No newline at end of file