Glad I have more than six weeks with you.
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 23-05-2007, 19:06
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Accelerometer use

Hello,

I have seen in more than one place where people have used an accelerometer to integrate into a gyro signal, cancelling drift. Umm...how?

I have no idea what the algorithm would be.

Thanks for any insight you can provide,
JBot
__________________
Aren't signatures a bit outdated?
  #2   Spotlight this post!  
Unread 23-05-2007, 19:17
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: Accelerometer use

not sure, but could you offset or blend the gyro values with the accel values to give heading? or for every degree off on the accel, take a percentage off of the gyro value. although, unless your robot is on its side, there shouldn't be too much drift or error in the gyro. honestly, for most applications you should be fine. it's kind of like a compass: it's accutate until you're near the earth's poles, then it's useless. my guess is that there shouldn't be much gyro error on a slant, but if there is, i can't really see how an accel would help that much....i'm guessing that a gyro would be sufficient; i havn;t heard of any complaints of drift....

if worse comes to worse, juat make a joystick button that, when pressed, resets the gyro heading angle. that way, if something really goes wrong, you could reset it. or, a fail-safe for that, substitute raw joystick values to the motor, skipping the gyro completely.
__________________


  #3   Spotlight this post!  
Unread 23-05-2007, 21:51
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,529
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: Accelerometer use

Just yesterday I was reading on a combat robots forum about how to do that... I'll look for a link now...

I've been out of the more advanced programming for a while so I'm not entirely sure, but I think he compared the accelerometer's reading to the rate of rotation, or the derivative of that (rate makes more sense to me...). Could someone expand on this?
  #4   Spotlight this post!  
Unread 23-05-2007, 22:32
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Accelerometer use

I've heard of people using a "Kalman Filter" to integrate gyro and accelerometer readings, but I don't know if I'm remembering right or how you would do it.

A search found this wiki entry.

What are you suing it for?
__________________
Eric Haskins KC9JVH
  #5   Spotlight this post!  
Unread 24-05-2007, 00:14
Alex.Norton's Avatar
Alex.Norton Alex.Norton is offline
Fidgetting
no team
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Ft. Collins, Colorado
Posts: 190
Alex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud of
Send a message via AIM to Alex.Norton Send a message via MSN to Alex.Norton
Re: Accelerometer use

We have used an accelerometer for the last 3 years to cancel drift on our drive system. I don't know if there is any integration involved, however I believe the we do use a PD loop to get rid of the drift.

We feed a desired value and an incoming offset into the PD loop to get the drive motor correction. I know that there is some calculations that the code does to determine the incoming offset but I don't have the code in front of me.

I'll either look into it or get someone who knows the code better to post sometime soon.

Alex
  #6   Spotlight this post!  
Unread 24-05-2007, 00:31
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,079
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Accelerometer use

I've been contemplating this for a while too, as I used the difference between the two values coming back from the encoders on the drive train for detecting and preventing drift. However, in threory*, the acceleration measured from the accelerometer can be used as a internal GPS system. With a known starting speed (0 m/s) when the robot initializes, and with a known acceleration each time through the loop, you should be able to ascertain the exact speed and direction of your robot at any time.

With the initial velocity, acceleration, and time, you can use simple physics to determine the final velocity. If you keep a running counter in your code to track time between executions of the loop, as well as the output speed from the previous time through the loop, you can keep running this code to find the current velocity of the robot, as well as the distance covered from the previous location.

If you include the gyro, it gets a lot more complicated, as now you have to deal with trigonometry and more vectors, but you still should be able to run your current data through physics equations to get the current location, orientation, and position of the robot relative to the origin.

* I've never actually tried this; this is just an educated guestimate from what "should" be feasible on paper. Whether the controller is powerful enough to handle that many floating-point math problems (co-processor anyone?) is another story. I apologize if what I wrote here is really off-base.
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.
  #7   Spotlight this post!  
Unread 24-05-2007, 01:12
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Accelerometer use

What exactly are you trying to do?

Combining a singly gyro and a single accelerometer is fantastic for giving position and direction on a non-holonomic (aka KitBot) robot. Unfortunately, it doesn't sound like that is what you want.

Canceling noise is hard. Canceling drift is harder. Noise assumes that the data we are getting back is essentially Gaussian, which means we can do fun filtering . Drift is inherently more evil, as it implies that the sensor tends to one side. I don't know of a good way to handle drift without using some side-band information. In other words, if your sensor has drift, something else better compensate for it.

One thing you might consider doing is finding out when you KNOW your gyro better be reading 0s. If you ain't moving, you ain't spinning. Perhaps you should keep a note of how your gyro handles sitting still, convert that to a DC offset, and subtracting it out.

Another method (less good) is to make your accelerometer into a craptacular gyro. Place it as far forward or backward as you can, in the middle of the bot, and rotate it to point side to side. Now when you spin, the accelerometer picks it up. However, it also picks up when you get slammed into, and it totally bombs for accuracy because it in no way compensates for your turning radius.

More info = more answers.
  #8   Spotlight this post!  
Unread 24-05-2007, 03:10
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Accelerometer use

Well I'm guessing you could place the accelerometer so that it is perpendicular to the direction your robot travels.
When the accelerometer reads ~0 you are at your 0 acceleration reading f or the Gyro(there is often a gap between true 0 and 127). This way you could recenter the gyro in real time. I would probably integrate the accelerometer reading for a few seconds and if it steadily sums to a 0 reading then you can be fairly sure the data is correct and that the current gyro reading is also a 0.

Furthermore you know that the accelerometer isn't biased towards a single side, so when you turn in two different directions you can figure out how much bias is in the gyro by looking at the integrals of the accelerometer over time and based on this you can probably calculate how to re-scale the gyro output by comparing the two different sets of integrals for each side.

I don't think noise should be too much of a problem, we are taking so many readings per second that if it is fairly random it will average out to zero over a short period.

I'm assuming the accelerometer supports acceleration in two directions??? is this true?
__________________
Team 701

Last edited by Salik Syed : 24-05-2007 at 03:18.
  #9   Spotlight this post!  
Unread 24-05-2007, 08:19
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Accelerometer use

Quote:
Originally Posted by Salik Syed View Post
Well I'm guessing you could place the accelerometer so that it is perpendicular to the direction your robot travels.
When the accelerometer reads ~0 you are at your 0 acceleration reading f or the Gyro(there is often a gap between true 0 and 127). This way you could recenter the gyro in real time. I would probably integrate the accelerometer reading for a few seconds and if it steadily sums to a 0 reading then you can be fairly sure the data is correct and that the current gyro reading is also a 0.

Furthermore you know that the accelerometer isn't biased towards a single side, so when you turn in two different directions you can figure out how much bias is in the gyro by looking at the integrals of the accelerometer over time and based on this you can probably calculate how to re-scale the gyro output by comparing the two different sets of integrals for each side.

I don't think noise should be too much of a problem, we are taking so many readings per second that if it is fairly random it will average out to zero over a short period.

I'm assuming the accelerometer supports acceleration in two directions??? is this true?
Yes. I assume that he will be using the kit accelerometer which is a DAA.
  #10   Spotlight this post!  
Unread 24-05-2007, 10:18
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Accelerometer use

Quote:
Originally Posted by artdutra04 View Post
...in threory*, the acceleration measured from the accelerometer can be used as a internal GPS system...
* I've never actually tried this; this is just an educated guestimate from what "should" be feasible on paper...
You're talking about an Inertial Navigation System. GPS relies on external references; INS is fully self-contained.

Other people have tried it on FIRST robots. There's too much noise (mechanical, mostly) for anyone to have made it work reliably...yet.
  #11   Spotlight this post!  
Unread 24-05-2007, 14:02
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Accelerometer use

Here is some info on a Filter you can use to help cancel out noise if you are interested:
http://en.wikipedia.org/wiki/Kalman_filter

It is kind of dense and hard to understand, but I think it would be possible to implment if you got some outside help.

You may also be interested in page 668 of this article:
http://robots.stanford.edu/papers/thrun.stanley05.pdf

I think it might be better to get creative and come up with your own way of filtering out noise, you can use multiple sources (Gyro, Encoders, accelerometer) and based on correlations figure out which ones are accurate and which ones aren't
__________________
Team 701
  #12   Spotlight this post!  
Unread 24-05-2007, 14:58
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Accelerometer use

Quote:
Originally Posted by Salik Syed View Post
I think it might be better to get creative and come up with your own way of filtering out noise, you can use multiple sources (Gyro, Encoders, accelerometer) and based on correlations figure out which ones are accurate and which ones aren't
I am reasonably sure that that is exactly what a Kalman Filter does: Take a whole bunch of noisy measurements and boil them down into one less noisy measurement. Unfortunately, I think that using an accelerometer as a noisy gyro is weak at best. I do like the use of encoders though.

Please take what I say with a hefty grain of salt, as my education for Kalman filters is hilariously spotty. I was helping to interview candidates for a position at Olin, and as a result I heard 4 or 5 introductions to SLAM (Simultaneous Localization and Mapping). Each professor would then gloss over Kalman Filtering with varying degrees of success.

I think it would be a great project to do a white paper on Kalman Filtering as applied to an IMU for FIRST. Take a kit bot, add a gyro, accelerometer and a pair of encoders. This gives you some degree of redundancy, as either the gyro/accelerometer pair or the encoder pair could do all of the work. Then you can combine their data for a more robust system.

Enjoy
  #13   Spotlight this post!  
Unread 28-05-2007, 16:48
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Accelerometer use

If anyone is interested here is an excellent (and much easier to understand) paper on kalmann filtering :
http://www.cs.unc.edu/~welch/media/pdf/maybeck_ch1.pdf
__________________
Team 701
  #14   Spotlight this post!  
Unread 28-05-2007, 18:00
ZZII 527's Avatar
ZZII 527 ZZII 527 is offline
"Scale Electric Vehicle"
AKA: Shane Colton
FRC #0097
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Cambridge, MA
Posts: 366
ZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond reputeZZII 527 has a reputation beyond repute
Send a message via AIM to ZZII 527
Re: Accelerometer use

Quote:
Originally Posted by Salik Syed View Post
If anyone is interested here is an excellent (and much easier to understand) paper on kalmann filtering :
http://www.cs.unc.edu/~welch/media/pdf/maybeck_ch1.pdf
I've seen that chapter referenced before so I'm glad someone posted it. I'll have to do more than just skim through it at some point, but I have a question:

The Kalman filter seems to deal with noise - specifically Gaussian white noise. That is, given two estimates of a state, say position, and a general idea of how noisy the estimates are, it will yield an optimal combination with less error than either of the two estimates alone. How does this apply to drift? Drift would seem to violate the Gaussian noise assumption, since the mean estimation error (not zero), integrated in time, is what causes the drift in the first place. That is, you could have a very clean signal that has still drifted away from the true position due to the integration. Wouldn't you still need a zero reference at some point?

I like the idea of using the accelerometer to signal a zero-reference update. It can tell when you are not spinning, so why not recalibrate the gyroscope to zero velocity then. Of course, that doesn't help with position directly. Also consider a vertical example: Say you want to cancel drift from the gyro on a Segway's primary axis. With a two-axis accelerometer oriented so that the third axis is the gyro axis, you can be fairly certain of when you are not moving because the resultant acceleration from both axes will be just gravity. When you see this condition for more than some period of time, recalibrate the gyroscope based on the trig of the two accelerometer readings. I'm thinking you can also do this on the fly with some trickier math, but I'm not sure.
__________________
MIT Mechanical Engineering
>> College Mentor, Team 97: Cambridge Rindge and Latin School with The Edgerton Center, MIT Mechanical Engineering, Bluefin Robotics, and Draper Laboratory
>> Alumnus, Team 527: Plainedge HS

Last edited by ZZII 527 : 28-05-2007 at 20:17.
  #15   Spotlight this post!  
Unread 29-05-2007, 00:18
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Accelerometer use

Yes, you're right. A kalmann filter is only really effective when dealing White Gaussian noise. The noise we are dealing with in the gyro is still of this quality, It is integrated over time yes, but the noise in the measurement from the gyro itself is not non-gaussian. Based on this principle as the time variable increases the probability distribution of the estimate produced by the gyro "widens" ... it's measurement simply becomes more and more unreliable. Now if the Gyro happened to have different levels of noise at different levels of acceleration we would have a real problem... but it since the noise distribution from the sensor itself is white and gaussian Kalmann filtering will work. (not as effectively of course... but it can be used)

BTW
For those of you who don't know what that is here's a simple explanation:
White noise basically means that the noise in the current state has no bearing on noise in the next. Basically it means that the noise is "random".
Gaussian relates to the amplitude of the noise. A gaussian distribution is basically a "bell curve". If noise is gaussian it means the probability distribution of the amplititude of the noise will be a bell shaped gaussian curve.

I don't think there's an effective way to account for drift using Kalmann filters alone, Although since you know when you are standing still (with almost 100% certainity) you can basically give the Gyro a very narrow probability distribution at the start along with the somewhat wide distribution of wheel encoders, then as you build a better model through the kalmann filter re-adjust the gyro bias to lineup with your best estimate (using measurement from both sources: wheel encoders AND gyro itself). It's rough at best but certainly better than just integrating the gyro to read an angle.

Also the Kalmann filter does take into account integrated estimation error by basically "widening" the probability distribution over time, if a gyro is off by a little bit it's error will be summed over time... This is how it can be used when dealing with velocities
__________________
Team 701

Last edited by Salik Syed : 29-05-2007 at 00:34.
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
If you have to use dial-up, don't use NetZero JBotAlan Chit-Chat 7 18-12-2006 01:39
Ethics 101: To re-use or not to re-use? aaeamdar General Forum 87 07-12-2006 19:10
Accelerometer railerobotics Programming 1 27-01-2006 02:59
Accelerometer buss Electrical 1 09-01-2005 00:10
Accelerometer Use Doug G Programming 2 15-12-2004 09:06


All times are GMT -5. The time now is 12:48.

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