|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
Re: No atan() method in FRC version of java
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. |
|
#3
|
||||
|
||||
|
Re: No atan() method in FRC version of java
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.
|
|
#4
|
||||
|
||||
|
Re: No atan() method in FRC version of java
Quote:
See the discussion about ATAN2 nonlinear model fitting here: http://www.chiefdelphi.com/media/papers/2390 |
|
#5
|
|||
|
|||
|
Re: No atan() method in FRC version of java
Quote:
|
|
#6
|
|||
|
|||
|
Re: No atan() method in FRC version of java
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.
|
|
#7
|
|||
|
|||
|
Re: No atan() method in FRC version of java
Ok well I figured it out. I needed to call MathUtils.atan(). I wasn't using MathUtils befroe. Thanks for the input though everybody.
|
|
#8
|
|
Re: No atan() method in FRC version of java
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). |
|
#9
|
||||
|
||||
|
Re: No atan() method in FRC version of java
Did you mean to say atan2(y,x)? Or does Java really reverse the order like Excel does. Say it ain't so.
|
|
#10
|
|
|
Re: No atan() method in FRC version of java
Quote:
Here is the actual function header: Code:
double atan2(double y, double x) ;
|
|
#11
|
|||
|
|||
|
Re: No atan() method in FRC version of java
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java Simulator for FRC | feverittm | Java | 3 | 27-04-2010 03:52 |
| Java VisonChaser method | Robototes2412 | Java | 0 | 15-02-2010 15:19 |
| Java FRC API | davidthefat | Java | 3 | 11-02-2010 06:49 |
| Event Driven Development for FRC-Java | spartango | Java | 5 | 05-01-2010 11:52 |
| FRC Java 2010 Documentation | alivemyst | Java | 11 | 07-09-2009 19:03 |