k = linspace(0,-.1);
df = zeros(length(k),1);
dr = zeros(length(k),1);
for i=1:length(k)
    [f, r] = steer(k(i));
    df(i) = f;
    dr(i) = r;
end

figure()
plot(k,df,'-o')
hold on
plot(k,dr,'-o')


%%
% input
ux = 5;
handwheel = 300;

L = 2.78;
max_handwheel = 300;
max_ay = 7;
max_steer_angle = .43; % max steering angle [rad]  

% calcs
max_kinemetic_k = 2*tan(max_steer_angle)/L;
min_kinematic_ux = sqrt(max_ay/max_kinemetic_k);
ux_limited = max(min_kinematic_ux,ux);
max_k = max_ay / (ux_limitedux*ux_limited);

ratio = max_k/max_handwheel;
k_cmd = handwheel * ratio;

% new version
ratio2 = max_ay / (min_kinematic_ux * ux);
max_ay/min_kinematic_ux

ratio = max_ay / (ux_limited * ux_limited) / max_handwheel;
ratio2 = max_ay / (min_kinematic_ux * ux_limited) / max_handwheel;
