summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYanzhenXiangRobotics <xyz000327@gmail.com>2023-05-11 09:04:25 +0200
committerYanzhenXiangRobotics <xyz000327@gmail.com>2023-05-11 09:04:25 +0200
commit028bd7ee110009ae0b26dcc6c3ac1809bab8d4a0 (patch)
treeb69ccff4cd82b0818e81991ba3684f0c5493d57c
parentADD: pass 27 (diff)
downloadmpc_pe-028bd7ee110009ae0b26dcc6c3ac1809bab8d4a0.tar.gz
mpc_pe-028bd7ee110009ae0b26dcc6c3ac1809bab8d4a0.zip
ADD: 28 bug
Diffstat (limited to '')
-rw-r--r--templates/compute_minRPI.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/templates/compute_minRPI.m b/templates/compute_minRPI.m
index 0b4ffdb..2ae7946 100644
--- a/templates/compute_minRPI.m
+++ b/templates/compute_minRPI.m
@@ -8,4 +8,27 @@
function [H_tube,h_tube,n_iter] = compute_minRPI(K_tube,params)
% YOUR CODE HERE
+ A = params.model.A+params.model.B*K_tube;
+ nx = params.model.nx;
+ omega = Polyhedron('A',[eye(nx);-eye(nx)],'b',zeros(1,2*nx)');
+ % display(omega.A)
+ % display(omega.b)
+ n_iter = 0;
+ Hw = params.constraints.DisturbanceMatrix;
+ hw = params.constraints.DisturbanceRHS;
+ while true
+ omega_last = copy(omega);
+ % display(n_iter)
+ % A_last = omega.A;
+ % b_last = omega.b;
+ omega = omega.plus(Polyhedron('A',Hw*(A^n_iter),'b',hw));
+
+ if eq(omega.minHRep(),omega_last.minHRep())
+ % if eq(omega,omega_last)
+ break
+ end
+ n_iter = n_iter+1;
+ end
+ H_tube = omega.A;
+ h_tube = omega.b;
end \ No newline at end of file