View Single Post
  #16   Spotlight this post!  
Unread 12-07-2011, 23:56
Aren Siekmeier's Avatar
Aren Siekmeier Aren Siekmeier is offline
on walkabout
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: 대한민국
Posts: 735
Aren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond repute
Re: Cartesian to angle

Quote:
Originally Posted by Ether View Post
Does anyone know what the FRC versions of LabVIEW, C++, and Java do?
I'm pretty sure LabVIEW has two different atan commands in its Math/Trig library (which I believe is supported on the cRio). The first takes a float which should be your y/x value, and then spits out theta on the interval (+pi/2, -pi/2) relative to +X (note the inability to deal with infinite slope, one of the problems avoided by the other command). The other takes an x and a y separately, then does all the logic for you to return theta on the interval [0,2pi) from +X. To find the angle from +Y, you can subtract 90 (careful of wrapping, if it matters), or feed y in for x and -x in for y (the second one is waaaaay better).

Edit: Theta is counter-clockwise from reference point, of course. All x and y inputs are on [-1, 1] as one would expect on a unit circle.

Edit: And now I see that you asked for clockwise from +Y. Simply flip your inputs around the y-axis: give it y for x and +x for y.

Last edited by Aren Siekmeier : 13-07-2011 at 00:00.