Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function [v, theta] = calc_params(vmax, thetamax, v_hist, theta_hist, dist_hist)
  2. %UNTITLED Summary of this function goes here
  3. % Detailed explanation goes here
  4.  
  5.  
  6. angles = [1:45];
  7. left = angles(1);
  8. right = angles(end);
  9.  
  10. %counter = 1;
  11.  
  12. if theta_hist
  13.  
  14. for i = 1:length(theta_hist)
  15. if dist_hist(i) == 1
  16. angles = angles(find(angles == left):(find(angles == theta_hist(i))));
  17. right = angles(end);
  18. %counter = counter + 1;
  19. else
  20. angles = angles((find(angles == theta_hist(i))):find(angles == right));
  21. left = angles(1);
  22. %counter = counter + 1;
  23. end
  24. end
  25. end
  26.  
  27. theta = angles(ceil(end/2));
  28.  
  29. %If we don't hit by the time we reach this angle, start reducing velocity.
  30. if theta <= 3
  31. v = v_hist(end)-10;
  32. else v = vmax;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement