minimize vcorr^2 on correction before decoupling
parent
41f0d66851
commit
cceb2f1379
|
@ -32,8 +32,9 @@ function [u_corr, U_corr_history, q_pred] = ucorr(t, q, sim_data)
|
|||
T_inv = decouple_matrix(q_act, sim_data);
|
||||
ut = utrack(t, q_act, sim_data);
|
||||
|
||||
H = 2 * (T_inv') * T_inv;
|
||||
%H = eye(2);
|
||||
% minimize v
|
||||
H = 2*eye(2);
|
||||
|
||||
f = zeros(2,1);
|
||||
A = [T_inv; -T_inv];
|
||||
%A = [eye(2); -eye(2)];
|
||||
|
@ -121,20 +122,15 @@ function [u_corr, U_corr_history, q_pred] = ucorr(t, q, sim_data)
|
|||
% vectors in u_corr times the number of elements [2] in each vector)
|
||||
A_deq = [];
|
||||
b_deq = [];
|
||||
H1 = [];
|
||||
for k=1:pred_hor
|
||||
T_inv = T_inv_pred(:,:,k);
|
||||
u_track = u_track_pred(:,:,k);
|
||||
d = T_inv*u_track;
|
||||
|
||||
H1 = blkdiag(H1, T_inv);
|
||||
H2 = blkdiag(H2, T_inv');
|
||||
A_deq = blkdiag(A_deq, [T_inv; -T_inv]);
|
||||
b_deq = [b_deq; s_ - d; s_ + d];
|
||||
end
|
||||
|
||||
H = H1'*H1;
|
||||
|
||||
%A_deq = kron(eye(pred_hor), [eye(2); -eye(2)]);
|
||||
%A_deq
|
||||
%b_deq
|
||||
|
@ -143,7 +139,8 @@ function [u_corr, U_corr_history, q_pred] = ucorr(t, q, sim_data)
|
|||
% squared norm of u_corr. H must be identity,
|
||||
% PREDICTION_HORIZON*size(u_corr)
|
||||
%H = eye(pred_hor*2)*2;
|
||||
%H = kron(eye(pred_hor), [1,0;0,0]);
|
||||
H = kron(eye(pred_hor), 2*eye(2));
|
||||
%H = kron(eye(pred_hor), 2*ones(2,2));
|
||||
% no linear terms
|
||||
f = zeros(pred_hor*2, 1);
|
||||
|
||||
|
|
2
tesi.m
2
tesi.m
|
@ -8,6 +8,7 @@ ROBOT = 'diffdrive'
|
|||
TESTS = ["circle/start_center"]
|
||||
|
||||
% main
|
||||
|
||||
s_ = size(TESTS);
|
||||
for i = 1:length(TESTS)
|
||||
clearvars -except i s_ TESTS ROBOT
|
||||
|
@ -24,7 +25,6 @@ for i = 1:length(TESTS)
|
|||
sim_data.(fn{1}) = test_data.(fn{1});
|
||||
end
|
||||
|
||||
sim_data.r = 0.06
|
||||
% set trajectory and starting conditions
|
||||
sim_data.q0 = set_initial_conditions(sim_data.INITIAL_CONDITIONS);
|
||||
[ref dref] = set_trajectory(sim_data.TRAJECTORY, sim_data);
|
||||
|
|
Loading…
Reference in New Issue