Author Topic: How to deal with gyro rate drift (not drift from integration)?  (Read 19839 times)

0 Members and 1 Guest are viewing this topic.

Offline bulkheadTopic starter

  • Full Member
  • ***
  • Posts: 102
  • Helpful? 0
How to deal with gyro rate drift (not drift from integration)?
« on: September 07, 2008, 03:26:16 PM »
The rate while stationary isn't a stable value and appears to change slowly over time.  I tried to maintain a dynamic "neutral" rate value but I find that it ends up counteracting the measurement.  I know that a gyro's rate readings integrated over time will drift; I plan to compensate for that type of drift (angle drift) by using an accelerometer.  But how can I deal with the gyro's rate drifting?

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #1 on: September 07, 2008, 03:33:27 PM »
Every time your robot stops moving, meaning no speed command or no observed wheel movement from encoders and low accelerator movement (you will always see some noise), resample no yaw rate for your gyro.

Offline Iron Man

  • Full Member
  • ***
  • Posts: 74
  • Helpful? 0
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #2 on: September 08, 2008, 07:32:51 AM »
resample yaw rate for gyro.

by this i'm assuming he means, attach your gyro to a large block of something, on a very low or no vibration surface and then collect data over a period of time while it's stationary, take the average of that data and subtract it from your gyro reading....

for a better more accurate explanation

kevin.org/frc has some great example gyro code and helpful Q&A

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #3 on: September 08, 2008, 08:00:55 AM »
Man gyros are made to sustain mechanical noise (vibration) without drifting...
BUT high frequency noise may corrupt after all your reading...

So before attaching the gyro to the main body think of placing it using Velcro tape or so a double sided tape with some kinda of foam in it...
Thus reduce gyro drift...

Also gyro drift is created by inertia... You can NOT unfortunately avoid this... But with testing and measuring you can see
how much is the gyro drift caused my inertia and with proper coding almost minimize the effect...

I got an acrobatic chopper and messed up with it's gyro a little... guess that I would have made a much better myself
but could take days so I stayed at the mommy configuration... But not too long... hehehe

What's your application, it could help us a lot if we knew...


Best of Regards, Lefteris
Greece
For whom the interrupts toll...

Offline bulkheadTopic starter

  • Full Member
  • ***
  • Posts: 102
  • Helpful? 0
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #4 on: September 09, 2008, 12:03:10 AM »
I'm working on an a filter to combine accelerometer and gyro data to approximate tilt angle for a balancing robot.

My problem is that if i "zero" the gyro's rate output, it will need rezeroing after a few minutes as it appears to slowly and randomly drift (even if I just let the gyro just sit on the table).  For a balancing robot, there is no chance to stop and "rezero" occasionally.  I'm looking for a way (in the code) to dynamically rezero the rate somehow.

Again, the rate, not the integrated angle (which I expect can be fixed with the accelerometer's absolute angle measurement), is drifting.  I didn't expect this to happen.

I'm using the sparkfun 5-DoF IMU with an 8-bit ADC.

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #5 on: September 09, 2008, 05:59:29 AM »
I am working on a similar robot but didn't had a chanse to play around with the sensors yet. I have from Sparkfun a 2 axis accelerometer and a 1 axis gyro with analog outputs. I am waiting on my motors to arrive and I'll build the encoders for them and then build the chassis. I should get playing with the sensors after I'll get the LCD installed so I don't have to be tyed to the computer all the time. If you have some advice, please share it!
Check out the uBotino robot controller!

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #6 on: September 09, 2008, 03:32:15 PM »
You need to dynamically get data... You don't mind if the gyro drifts... You only mind the
angular speed and acceleration... You can rezero the gyro before the measurement...

How many ms do you have to wait... guess if it is electronic not much more than 50ms... which is good...

You can do other thing too...
First check the accelerometer... if the reading are +/- 2 the same let's say... tell it to check the gyro...
If the gyro drifted... then rezero... if not then you go on...
also... you have an analog output for the gyro eee? If you use AVR you can have 10bit resolution...
If you use other ADC you can get better... For sure....
Just check that the update time is >1ms for the ADC...
ADC are very fast these days.... You won't have any problem with this...
Just use as much resolution as you can and the gyro output offers... This IS critical...

What else.... mmm..... Don't know really...
I knew a guy that tried a balancing robot with gyros and accelerometer and failed due to update time...
and ended up using two QRD1114 with analog outputs to make the robot balance...

Of course this also depends on the size of your application...

Hope I was able to help you, and be able to help you out again...

Best Regards, Lefteris
GReece
For whom the interrupts toll...

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #7 on: September 09, 2008, 08:54:00 PM »
Sounds like you need some kind of Bayesian Filter. From what I grok of the subject (I've been studying, but not implementing yet... I'm a slow learner  :-[) A Gausian method like a Kalman Filter should get you most of the way there. The hard but fun part will be understanding the dynamics of the system.
« Last Edit: September 09, 2008, 08:55:39 PM by JesseWelling »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #8 on: September 16, 2008, 11:46:17 AM »
Its impossible to eliminate drift in a mobile robot sensor. Just something you have to accept:
http://www.societyofrobots.com/robot_faq.shtml#robot_accuracy_tradeoff

Offline joshuagiraffe14

  • Beginner
  • *
  • Posts: 1
  • Helpful? 0
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #9 on: May 08, 2009, 11:57:34 AM »
Sorry for bumping an old thread, but I recently started working on a balancing robot of my own. I believe it should be possible to accomplish balance with just a gyro. If you calculate where the balance Should have been according to how the robot reacted to the last application of power to the wheels, then you should be able to correct for drift, right? if you've made any progress on your project let me know

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: How to deal with gyro rate drift (not drift from integration)?
« Reply #10 on: May 30, 2009, 11:44:23 AM »
I believe it should be possible to accomplish balance with just a gyro. If you calculate where the balance Should have been according to how the robot reacted to the last application of power to the wheels, then you should be able to correct for drift, right?
Hmmm, but reaction is dependent on vehicle acceleration, terrain, etc. You can get it to work with a gyro on flat terrain for a short period of time on a slowly accelerating robot, until drift gets too severe.

 


Get Your Ad Here

data_list