View Single Post
  #12   Spotlight this post!  
Unread 26-01-2008, 16:52
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Gyro inconsistencies...

Quote:
Originally Posted by Jake M View Post
Settings and such...
-------------------
ADC Sample Rate of 1600Hz
32 ADC Samples per Update
Deadband set to 16 (Deadband and Bias double when resolution goes from 2048 to 4096)
Using ADXRS150
I will almost guarantee that the problem is caused by asymmetry in the ADC and being augmented by the dead band.

In general, any dead band on an integrator is not a good idea if you want accuracy in your results. See this whitepaper: http://www.chiefdelphi.com/media/papers/1449

It's been our experience that with a good bias routine you can expect less than 1/2 degree of heading drift over 15 seconds worth of autonomous operation. Just be sure to have a lot of resolution in your bias calculation.

Here is what I would suggest for a simple solution:

- For the bias routine, check the status of the disabled flag. As long as the robot is disabled, do a moving sum of the last 64 A/D samples. Make sure it is a moving sum, not average - this will make sense after the next step. See the following example code (put it in user_routines.c function Process_Data_From_Master_uP()):

Code:
if (disabledMode)
{
    bias = bias - biasBuffer[biasCounter] + gyroADC;
    biasBuffer[biasCounter] = gyroADC;
    biasCounter++;
    if (biasCounter > 63)
    {
         biasCounter = 0;
    }
}
just be sure to initialize all values in biasBuffer to 0 during code initialization.

- After the bias routine, take your A/D samples and multiply them by 64 (i.e. shift the bits left by 6 so that the bits are in the upper most bits of the variable.) The A/D reading is now in the same resolution as your bias. Now just subtract the bias from the left-justified A/D reading.

- Use the above bias adjusted value in your integral. Use a 32-bit variable for the integral. DO NOT right shift the new bias adjusted A/D reading or else you'll lose all of the resolution you gained in the bias.

Doing this should keep your heading drift very minimal over 15 seconds while it doesn't have the asymmetry problems associated with dead bands.

Good luck.
__________________
-
An ounce of perception is worth a pound of obscure.