Go to Post Figuring out how to do something is half of the fun. - Mike [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-03-2008, 12:16
rdaugherty rdaugherty is offline
Registered User
FRC #0435 (RoboDogs)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Raleigh, NC
Posts: 3
rdaugherty is an unknown quantity at this point
Re: Gyro Repeatability, Expected Drift ?

Team 435 can do a full lap plus in automode using the KoP gryo for both the turns and maintaining alignment while driving straight. We are using a modified version of Kevin's code. (QuickADC and only reading the gryo once every 26ms.)

Last year we were unsuccessful with using the gryo, the robot's momentum would carry it past the 90 turn and we were never able to get a consistent turn amount.
  #2   Spotlight this post!  
Unread 12-03-2008, 12:27
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

What sample rate are you running at?

In 2005, we ran many tests with sample rates from 200hz to 12800 hz. While we have since lost the raw data from the tests, the results were that we saw improvements in performance up to 1600hz and beyond that there were no noticeable improvements. We have since always used 1600hz and get results that are repeatable to within the accuracy of our measurement method.
  #3   Spotlight this post!  
Unread 12-03-2008, 12: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 Repeatability, Expected Drift ?

Dr. Brooks' marklars are wise and true

One of the best thing that you can do to help reduce the drift is use a very large average during disabled mode to get the sensor bias, and don't throw out resolution when you're done with the average.

I think I posted a similar example in a different thread within the last couple months, but here is an example of what you want to do.

- assume you want to use a 32-bit variable for your integral.

- Let's assume we want to use a 64 sample average to get the sensor bias. Use the following code to calculate your bias (do this code ONLY in disabled mode).

Code:
        
tempAngRate = Get_Analog_Value(angRate);
angRateBias = (angRateBias - angRateArray[angRateBiasCounter]) + tempAngRate;
angRateArray[angRateBiasCounter] = tempAngRate;
angRateBiasCounter++;
if (angRateBiasCounter > 63)
{
    angRateBiasCounter = 0;
}
- Once disable mode is over, the above angularRateBias value contains the bias of the sensor. Just note that it is a 64 sample SUM, but you can think of it as the average * 64. At this point you DO NOT want to divide by 64, since you would then be throwing out the "decimal portion". Just multiply you A/D sample by 64 to bring it up to the same resolution of the bias value. See the following code:

Code:
angRateValue = Get_Analog_Value(angRate);
robotHeading += (s32)angRateValue*(s32)64 - angRateBias
Now you have a nice integral with 6 bits worth of fractional-resolution. If you want your fractional portion to be 7 bits, use 128 samples in the average, etc.
__________________
-
An ounce of perception is worth a pound of obscure.
  #4   Spotlight this post!  
Unread 12-03-2008, 16:08
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

We do our averaging to get the bias in the pit where we can be sure
that the robot is not disturbed while the data is being taken. The
resulting number is then hard coded.

I will be heading to SanJose this evening, but I can post
snippets of the code I use from there and will be happy to do so.


[quote=Chris Hibner;717147]

One of the best thing that you can do to help reduce the drift is use a very large average during disabled mode to get the sensor bias, and don't throw out resolution when you're done with the average.

[\QUOTE]
  #5   Spotlight this post!  
Unread 12-03-2008, 17:47
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 Repeatability, Expected Drift ?

Quote:
Originally Posted by eugenebrooks View Post
We do our averaging to get the bias in the pit where we can be sure
that the robot is not disturbed while the data is being taken. The
resulting number is then hard coded.
We do ours immediately before every match by using the disabled_mode flag. In other words, we're running a moving average right up until they enable the robots. Since everyone is required to be off the field for the last few seconds before the match start, you're pretty much guaranteed to get have the robot undisturbed and still, and you get the bias as close to what you're going to have in the match.

The code is more or less:

Code:
static char runBais = 1;
if (disabled_mode && runBias)
{
    // run moving-average bias code
}
else
{
    // the bias has now been captured and is held
    // don't let the bias run again if the robot is disabled for a short period of time
    runBias = 0;
    // run integral code
}
__________________
-
An ounce of perception is worth a pound of obscure.
  #6   Spotlight this post!  
Unread 12-03-2008, 18:02
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

Not a bad way to go, but we average for about 15 seconds at 150hz.

We do check the drift of the integrated gyro in the pit and
redo the average whenever it starts drifting too much.

Eugene



Quote:
Originally Posted by Chris Hibner View Post
We do ours immediately before every match by using the disabled_mode flag. In other words, we're running a moving average right up until they enable the robots. Since everyone is required to be off the field for the last few seconds before the match start, you're pretty much guaranteed to get have the robot undisturbed and still, and you get the bias as close to what you're going to have in the match.

The code is more or less:

Code:
static char runBais = 1;
if (disabled_mode && runBias)
{
    // run moving-average bias code
}
else
{
    // the bias has now been captured and is held
    // don't let the bias run again if the robot is disabled for a short period of time
    runBias = 0;
    // run integral code
}
  #7   Spotlight this post!  
Unread 12-03-2008, 18:41
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

Quote:
Originally Posted by eugenebrooks View Post
Not a bad way to go, but we average for about 15 seconds at 150hz.
If you look at the output of the gyro using a scope or spectrum analyzer, you'll notice some significant fourier noise products above your 75Hz Nyquist frequency. This noise is aliased back into your 75Hz bandwidth, and certainly isn't Gaussian in nature. You might want to up your sampling frequency to the ~1600Hz sweet spot.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 12-03-2008, 19:00
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

Kevin,

Our gyro is set for a 40hz bandwidth, as I recall, and
it is working absolutey great. If I had a problem I
would borrow a scope and sort it out.

The first thing I would do to improve things would be
to add temperature compensation, and then power supply
voltage compensation, but these improvements do not appear
to be required for our use.

Eugene


Quote:
Originally Posted by Kevin Watson View Post
If you look at the output of the gyro using a scope or spectrum analyzer, you'll notice some significant fourier noise products above your 75Hz Nyquist frequency. This noise is aliased back into your 75Hz bandwidth, and certainly isn't Gaussian in nature. You might want to up your sampling frequency to the ~1600Hz sweet spot.

-Kevin
  #9   Spotlight this post!  
Unread 12-03-2008, 22:49
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

Our gyro works great... and never ceases to amaze me that it functions at all.

I mean... think about it for a minute. It's a little teeny piece of silicon, and who knows what else, and it knows its spinning. Amazing!

Gotta hand it to those Analog Devices guys...

And thanks to Kevin for speeding all of our development schedules along!

...

Hope you guys like the new and improved 1024 hybrid mode this week. Should be quite a show.

That, and... I think we've finally got enough complicated (messy) homebrew circuitry to make the display stop blanking out all the time now...

If any of you are at BMR and would like to discuss Hybrid mode, I'll be happy to discuss ideas/concepts with you. Just ask anyone on 1024 for "Q" and I'm sure they'll direct you.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #10   Spotlight this post!  
Unread 12-03-2008, 16:04
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Gyro Repeatability, Expected Drift ?

Quote:
Originally Posted by rdaugherty View Post
Team 435 can do a full lap plus in automode using the KoP gryo for both the turns and maintaining alignment while driving straight. We are using a modified version of Kevin's code. (QuickADC and only reading the gryo once every 26ms.)

Last year we were unsuccessful with using the gryo, the robot's momentum would carry it past the 90 turn and we were never able to get a consistent turn amount.
If you carefully tune the gyro, with no deadband, and use it as a
compass; you can feed the error in the heading back into the
motor power. It keeps the robot on track when it gets bumped,
and it automatically corrects for overshoot in turns.

Eugene
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Not what you expected VanMan Extra Discussion 17 05-03-2007 19:34
Preventing drift Salik Syed Programming 4 21-02-2006 00:08
Yaw Rate Sensor Drift? phrontist Control System 13 19-08-2004 10:55
More flipping then expected cyberknights195 General Forum 6 07-03-2004 15:52


All times are GMT -5. The time now is 11:34.

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