No atan() method in FRC version of java

I am trying to program a swerve drive, and I need to use atan(), but netbeans always says it doesn’t exist in my class. Yes I know there is getDirection() on the joystick, but I need to manipulate numbers after taking them from the joystick.

Thanks in advance

Alex

Alex:

Take a look in the com.sun.squawk.util.MathUtils package. There are implementations of many of the J2SE math functions, including atan() and atan2(), in there.

Team 20 had the same problem. We ended up writing a Talyor approximation and reflecting it about the axis to produce our own atan2 function.

What is the import line I need to use? I tried ‘import com.sun.squawk.util.MathUtils;’ and that did not work. I have yet to learn what Taylor series are in detail, so that would be a project for down the road.

Ok well I figured it out. I needed to call MathUtils.atan(). I wasn’t using MathUtils befroe. Thanks for the input though everybody.

What are you using the atan() function for?
If you are going to have negative numbers for the input, it may be better to use atan2(x,y).

Did you mean to say atan2(y,x)? Or does Java really reverse the order like Excel does. Say it ain’t so.

**

Sorry, that was a typo.
Here is the actual function header:


double atan2(double y, double x) ;

I am using it to calcluate the desired angle of a wheel in a swerve configuration. I calculate the x and y components of the vector representing each wheel. Getting the magnitude (speed) is easy, but without atan, the angle was going to be a challenge.

Taylor expansion is not the best tool to use for this purpose.

See the discussion about ATAN2 nonlinear model fitting here:

http://www.chiefdelphi.com/media/papers/2390

**

I spent the summer porting a fixed point math library to Arm’s Thumb2 assembly, and learned a lot when I hit the arc-trig functions. At the high school level, suffice it to say that these functions are very-not-polynomials and therefore hate Taylor series expansions. At the college level, suffice it to say that if I ever teach numerical approximations the final exam will be to approximate arcsine.