SHARE
TWEET

Untitled

a guest Sep 17th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top