summaryrefslogtreecommitdiffstats
path: root/templates/simulate_uncertain.m
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2023-05-24 16:50:06 +0200
committerNao Pross <np@0hm.ch>2023-05-24 17:03:43 +0200
commit1f12e47e6d1fe8b365806aa0b42de237970d53bf (patch)
treeba9c739eb170397a7b7a9303e3ea7d1a03a94844 /templates/simulate_uncertain.m
parentTake deliverables for soft contraints from yuanxu (diff)
downloadmpc_pe-1f12e47e6d1fe8b365806aa0b42de237970d53bf.tar.gz
mpc_pe-1f12e47e6d1fe8b365806aa0b42de237970d53bf.zip
Take deliverables for Robust MPC from yanzhen
According to table 12 - generate_disturbances - simulate_uncertain - compute_tube_contorller - compute_minRPI - compute_tightening - MPC_TUBE - MPC_TUBE/eval (contained in MPC_TUBE.m) - MPC_TUBE_script (and its output MPC_TUBE_params.mat)
Diffstat (limited to '')
-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