optimization: collapse function calls into sistema_discr

at the expense of "modularity" but don't really need it at this point
master
EmaMaker 2024-07-31 21:21:01 +02:00
parent c02aa51088
commit 4e375a70f1
5 changed files with 4 additions and 15 deletions

View File

@ -1,3 +0,0 @@
function dq = diffdrive(t, q, u, sim_data)
dq = unicycle(t, q, diffdrive_to_uni(u, sim_data));
end

View File

@ -1,3 +1,3 @@
function u_ = diffdrive_to_uni(u, sim_data)
u_ = [sim_data.r/2, sim_data.r/2 ; sim_data.r/sim_data.d -sim_data.r/sim_data.d] * u;
u_ = [sim_data.r/2, sim_data.r/2 ; sim_data.r/sim_data.d, -sim_data.r/sim_data.d] * u;
end

View File

@ -1,3 +0,0 @@
function q = sistema(t, q, sim_data)
q = unicycle(t, q, control_act(t, q, sim_data));
end

View File

@ -1,3 +1,5 @@
function dq = sistema_discr(t, q, u_discr, sim_data)
dq = diffdrive(t, q, u_discr, sim_data);
theta = q(3);
G_q = [cos(theta), 0; sin(theta), 0; 0, 1];
dq = G_q*diffdrive_to_uni(u_discr, sim_data);
end

View File

@ -1,7 +0,0 @@
function dq = unicycle(t, q, u)
% u is (v;w)
% x is (x; y; theta)
theta = q(3);
G_q = [cos(theta), 0; sin(theta), 0; 0, 1];
dq = G_q*u;
end