Go to Post You think you are building robots, but you are really building yourselves. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-10-2010, 20:52
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
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



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote
  #2   Spotlight this post!  
Unread 04-10-2010, 21:07
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-10-2010, 01:34
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-10-2010, 07:59
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
Re: No atan() method in FRC version of java

Quote:
Originally Posted by Jared341 View Post
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.
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.
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote
  #5   Spotlight this post!  
Unread 06-10-2010, 18:40
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
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.
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote
  #6   Spotlight this post!  
Unread 06-10-2010, 19:38
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
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).
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #7   Spotlight this post!  
Unread 06-10-2010, 20:23
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,088
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: No atan() method in FRC version of java

Quote:
Originally Posted by biojae View Post
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.



Reply With Quote
  #8   Spotlight this post!  
Unread 06-10-2010, 20:29
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: No atan() method in FRC version of java

Quote:
Originally Posted by Ether View Post
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:
Code:
double atan2(double y, double x) ;
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #9   Spotlight this post!  
Unread 09-10-2010, 14:59
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
Re: No atan() method in FRC version of java

Quote:
Originally Posted by biojae View Post
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).
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.
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote
  #10   Spotlight this post!  
Unread 11-10-2010, 14:15
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,088
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: No atan() method in FRC version of java

Quote:
Originally Posted by JewishDan18 View Post
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.
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



Reply With Quote
  #11   Spotlight this post!  
Unread 11-10-2010, 15:19
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: No atan() method in FRC version of java

Quote:
Originally Posted by Ether View Post
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 11:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi