minimize v,w via w_r, w_l

diffdrive-costfun
EmaMaker 2024-09-29 10:47:37 +02:00
parent 6dd6af2b8c
commit 8bf21fa218
2 changed files with 13 additions and 6 deletions

View File

@ -30,7 +30,14 @@ function [u_corr, U_corr_history, q_pred] = ucorr(t, q, sim_data)
if eq(pred_hor, 0)
return
elseif eq(pred_hor, 1)
H = eye(2)*2;
% minimize wcorr_r^2 + wcorr_l^2
%H = eye(2);
% ex1: minimize v=r(wr+wl)/2
%H = sim_data.r*sim_data.r*0.5*ones(2,2);
% ex2: minimize w=r(wr-wl)/d
H = sim_data.r*sim_data.r*2*[1, -1; -1, 1]/(sim_data.d*sim_data.d);
f = zeros(2,1);
T_inv = decouple_matrix(q_act, sim_data);
ut = utrack(t, q_act, sim_data);

10
tesi.m
View File

@ -3,9 +3,9 @@ clear all
close all
% options
ROBOT = 'unicycle'
TESTS = ["straightline/chill", "straightline/chill_errortheta_pisixths", "straightline/toofast", "straightline/chill_errory", "circle/start_center", "figure8/chill", "figure8/toofast", "square"]
%TESTS = ["circle/start_center"]
ROBOT = 'diffdrive'
%TESTS = ["straightline/chill", "straightline/chill_errortheta_pisixths", "straightline/toofast", "straightline/chill_errory", "circle/start_center", "figure8/chill", "figure8/toofast", "square"]
TESTS = ["circle/start_center"]
% main
s_ = size(TESTS);
@ -34,7 +34,7 @@ for i = 1:length(TESTS)
% 1: track only
% 2: track + 1step
% 3: track + multistep
spmd (3)
spmd (2)
worker_index = spmdIndex;
% load controller-specific options
data = load(['tests/' num2str(worker_index) '.mat']);
@ -64,7 +64,7 @@ for i = 1:length(TESTS)
% save simulation data
f1 = [ TEST '/' char(datetime, 'dd-MM-yyyy-HH-mm-ss')]; % windows compatible name
f = ['results-' ROBOT '/' f1];
f = ['results-' ROBOT '-costfun-ddronly/' f1];
mkdir(f)
% save workspace
dsave([f '/workspace_composite.mat']);