|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Inverse Trig in Java ME
I've found myself in a bit of a pickle. I need to write a calculation that involves some inverse trig for our robot, and the embedded version of Java that the cRIO uses (Java ME) does not have the inverse trig functions of the Java SE Math library.
How have other teams moved past this limitation? |
|
#3
|
|||
|
|||
|
Re: Inverse Trig in Java ME
Another possibility is javalution: http://javolution.org/core-java/targ...ocs/index.html I have never compared this with mathutils, but it might be worth exploring too.
|
|
#4
|
|||
|
|||
|
Thanks for all the help!
![]() |
|
#5
|
||||
|
||||
|
Re: Inverse Trig in Java ME
Depending on how you intend to use the trig function, another option is to write a simple routine that gives an approximate but "close enough" answer.
For example, our robot uses a leadscrew to adjust the tilt angle of our climbing mast. There is an encoder attached to the end of the leadscrew so we can measure the distance it has traveled and use the cosine rule to convert this to an angle for the drivers. However to convert from leadscrew distance to angle requires using the acos() function. Since the range of leadscrew distances are limited by the physical system, our programmers approximated the function using a piecewise linear approximation implemented as a lookup table. While the results are approximate they are close enough for visual display. This approach is fairly common practice in embedded software, and can be used safely if you do proper error analysis. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|