Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [v, theta] = calc_params(vmax, thetamax, v_hist, theta_hist, dist_hist)
- %UNTITLED Summary of this function goes here
- % Detailed explanation goes here
- angles = [1:45];
- left = angles(1);
- right = angles(end);
- %counter = 1;
- if theta_hist
- for i = 1:length(theta_hist)
- if dist_hist(i) == 1
- angles = angles(find(angles == left):(find(angles == theta_hist(i))));
- right = angles(end);
- %counter = counter + 1;
- else
- angles = angles((find(angles == theta_hist(i))):find(angles == right));
- left = angles(1);
- %counter = counter + 1;
- end
- end
- end
- theta = angles(ceil(end/2));
- %If we don't hit by the time we reach this angle, start reducing velocity.
- if theta <= 3
- v = v_hist(end)-10;
- else v = vmax;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement