View Single Post
  #28   Spotlight this post!  
Unread 28-12-2012, 15:32
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Re: Sasquatch Robot Controller powered by Arduino

Quote:
Originally Posted by Ether View Post
I'll toss this out to stir up the pot: if you need double precision floats for your FRC software, you should re-think what you're doing.

The problem is you can define a variable as double and it is stored in memory as a double however the math is done as single precision. No warnings from the compiler or anything that would tell you this is happening.

Main reason this was an issue was that I was using doubles to do GPS lat/longitude calculations and it was being rounded/truncated which was causing accuracy issue.
To fix this, I stored the GPS lat/long x 10^7 as a 32 bit integer and take the difference with integer math and do the rest in floating point.

Another place this may be useful is gyro integration and the offset. However single precision works fine.
__________________
-Borna Emami
Team 0x27
Reply With Quote