Go to Post There is beauty in pure simplicity. - artdutra04 [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 28-12-2012, 13:31
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

The Atmega2560 should be able to handle anything robot related thrown at it short of video processing. We used one this past summer for the sparkfun AVC.

video here.
This involved:
  • bringing in the info from a GPS and a gyro.
  • Doing all control loops for autonomous navigation.
  • Tunable parameters over a wireless link.
  • Send telemetry information over the wireless link for debugging

However, beware that the Arduino does not support double precision math. Everything is done single precision floating point.
__________________
-Borna Emami
Team 0x27
Reply With Quote
  #2   Spotlight this post!  
Unread 28-12-2012, 15:07
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,995
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: Sasquatch Robot Controller powered by Arduino

Quote:
Originally Posted by BornaE View Post
However, beware that the Arduino does not support double precision math. Everything is done single precision floating point.
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.



Reply With Quote
  #3   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
  #4   Spotlight this post!  
Unread 28-12-2012, 15:46
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Sasquatch Robot Controller powered by Arduino

Quote:
Originally Posted by BornaE View Post
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.
This is really really common in embedded systems.

The compiler allows a Double because it's a valid, common type, but converts it to Float because it can't do Double math in hardware. I'm not actually sure that the Arduino's processor is doing any float math in hardware, so the single Float you ended up using could have been a software float (I'm not sure).

Usually it's in the SW toolchain documentation, and fairly easy to miss.

As for the gyro, it's probably much more efficient to do the math as a signed int or long and stay in ADC counts as long as possible. Unit conversion (especially divides) are usually very expensive operations on embedded systems, so they usually make up units to use signed or unsigned integer math in whatever units are convenient. This leads to heavy use of ADC counts as real units, percent as a signed char (127 being 100%), and angles as 'brads' (0-255 for a circle of 360 degrees). Also, for precision, many algorithms for embedded systems focus on using the less expensive bit shift rather than divides.

All of this cRio programming has made everyone really lazy with their math. It also seems to make it OK to add tons of layers of abstraction with no care about efficiency. It makes me sad to see relatively simple robot code running at only 50hz or so (realistically slow for a control loop) use the entire processor, without thinking about vision.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
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


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

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