View Single Post
  #4   Spotlight this post!  
Unread 17-02-2008, 11:44
jacobhurwitz jacobhurwitz is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Maryland
Posts: 45
jacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura about
Re: reducing sensativity of joystick for precision?

Quote:
Originally Posted by BigJ View Post
An easy way to stay away from the floating-point math is to do the calculations yourself, round to integers, and make a lookup table. There are way to accomplish these ideas in code though, through using bigger numbers to save precision while making calculations.
The disadvantage of a look-up table is that it is extremely difficult to change if the function doesn't work well. Imagine having to change 256 array entries! You can use the cubic code that Eagle gives above or your own quadratic code (which our team uses), while still staying away from floating-point math.

As long as you put all your division at the end of the line, everything will be integer operations and shouldn't take much longer than a LUT.