function [q1,q2,q3] = xi2q(x,y,phi,t)

%[L,rw,rth] = omni_params;
%L = .146;  % (meters) THIS VALUE HAS CHANGED!
L = .088; %.09; % <- New configuration has wheels at about 155mm from one another,
rw=.032;

eta = [-120 0 120]*pi/180; % angle to each wheel, wrt COB (geometry)
dt = diff(t);
dx = diff(x)./dt;
dy = diff(y)./dt;
dphi = diff(phi)./dt; % not really needed, if you modify code in a clever way
phi_av = .5*(phi(1:end-1)+phi(2:end)); % to match size of "dq1"

dq1 = (-1/rw)*(-sin(phi_av+eta(1)).*dx + ...
    cos(phi_av+eta(1)).*dy + ...
    L*dphi);
dq2 = (-1/rw)*(-sin(phi_av+eta(2)).*dx + ...
    cos(phi_av+eta(2)).*dy + ...
    L*dphi);
dq3 = (-1/rw)*(-sin(phi_av+eta(3)).*dx + ...
    cos(phi_av+eta(3)).*dy + ...
    L*dphi);

q1 = 0*phi; q2=0*phi; q3=0*phi; % pre-allocate size
q1(2:end) = cumsum(dt.*dq1);
q2(2:end) = cumsum(dt.*dq2);
q3(2:end) = cumsum(dt.*dq3);

% ma = [-sin(phi_b+eta(i)), ...
%        cos(phi_b+eta(i)), ...
%        L];
%    M(i,:) = (-1/rw)*ma; % to account 