diff options
author | YanzhenXiangRobotics <xyz000327@gmail.com> | 2023-05-11 07:54:17 +0200 |
---|---|---|
committer | YanzhenXiangRobotics <xyz000327@gmail.com> | 2023-05-11 07:54:17 +0200 |
commit | 28da3e20b81bac077792736847e0c48a8a68a06d (patch) | |
tree | c89ec54da835e02cd5ef949c08c02752c966f275 | |
parent | ADD: pass task 25 (diff) | |
download | mpc_pe-28da3e20b81bac077792736847e0c48a8a68a06d.tar.gz mpc_pe-28da3e20b81bac077792736847e0c48a8a68a06d.zip |
ADD: pass 26
Diffstat (limited to '')
-rw-r--r-- | templates/simulate_uncertain.m | 13 |
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 |