Go to Post You never really graduate out of FIRST.... - Gnomegirl [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 13-01-2008, 19:07
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Filtering out Vibration while using a KOP Accelerometer

So, this year, as the only programmer with experience, I figured I'd work on using an accelerometer to calculate distance for the autonomous mode. The Calculus behind this isn't hard, and the programming isn't either (in theory).

When I wrote the program, it compiled fine and the accelerometer seemed to give us pretty accurate data. We mounted the RC onto a cart and started walking with it through the halls, while using HyperTerm to take some data. We then took this data and plopped it into an excel graph, and to our surprise, got some messed up data! The accelerometer (both x and y) seemed to be super sensitive to shocks & vibrations. This was before the double integration too! We tried mounting the accelerometer in a piece of foam to help the shocks a bit, and that worked, but it didn't work well enough. We still can't get good data. I thought about doing a rolling average type of thing, but it seems that the data is averaged around 0 milliG's (512 on an analog input).

So does anyone have any ideas on how to make the data better? I want to use an accelerometer, because it gives the robots position based only on acceleration, rather than basing it on wheels, or other, more unreliable things...

(The loop is short enough to get a enough data points, and I did the integration right)
  #2   Spotlight this post!  
Unread 13-01-2008, 19:37
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: Filtering out Vibration while using a KOP Accelerometer

As you've found, what you want to do is not easy. The KOP accelerometers do a great job of detecting vibrations. Maybe you could mechanically filter the shocks by mounting the accelerometer to a heavy chunk of metal, which is then connected by foam or springs to the robot chassis. But I haven't heard of any teams successfully using only the accelerometer to do position tracking.
  #3   Spotlight this post!  
Unread 13-01-2008, 19:52
jleibs's Avatar
jleibs jleibs is offline
Computation and Neural Scientist
AKA: Jeremy Leibs
no team
 
Join Date: Jan 2008
Rookie Year: 2001
Location: San mateo
Posts: 19
jleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of light
Send a message via AIM to jleibs
Re: Filtering out Vibration while using a KOP Accelerometer

First of all, there's the obvious "search for accelerometer" and read a bunch of other threads. I'll let someone with more FIRST experience than I point you to the ones that are actually useful.

Second, make sure you are using timer interrupts, so that the change in time between measurements is reliable. (Once more, someone else can provide better advice than I as to how to make this happen).

Mounting the accelerometer in a piece of foam is a pretty good idea as a form of a mechanical low-pass filter.

I believe, there are some tricks that can be done with a capacitor to act as an electrical low-pass filter.

If that's not enough, you're going to have to add a software low-pass filter as well. An average of the past N samples is a suboptimal version of this, but at least a decent place to start. However, the problem with a software lowpass filter is that it can only operate at your processor frequency and I suspect the noise you are trying to filter out is at a higher frequency than your processor is running.

Out of curiosity could you post a plot showing one of the shocks that you believe to be throwing off your data?

Could anyone tell me a little bit more about the actual physical mechanism of the KOP accelerometers? Are these returning a continuous voltage that is proportional to acceleration, or are they clocked at some particular frequency?

Most accelerometers I have worked with return a digital delta-v, which is the integration of the acceleration over the time-step of their frequency of operation. This is clearly preferable to returning an instantaneous sample of acceleration. I'm a software guy and not an EE, so I don't tend to ask what's going on under the hood in so far as the amount of processing the accelerometer is actually doing.

In any case, believe it or not, basing your navigation on wheels tends to be a lot more robust than accelerometers. Though, in an ideal world, you would combine the two of them. I expect most teams have had pretty decent success combining encoder-based wheel odometry with using gyros to estimate rotation changes.
  #4   Spotlight this post!  
Unread 13-01-2008, 20:18
jleibs's Avatar
jleibs jleibs is offline
Computation and Neural Scientist
AKA: Jeremy Leibs
no team
 
Join Date: Jan 2008
Rookie Year: 2001
Location: San mateo
Posts: 19
jleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of light
Send a message via AIM to jleibs
Re: Filtering out Vibration while using a KOP Accelerometer

Ok... curiosity inspired me to do a little more digging...

The data sheet seemed like a good place to start.

Quote:
The user selects the bandwidth of the accelerometer using Capacitor CX and Capacitor CY at the XOUT and YOUT pins. Bandwidths of 0.5 Hz to 2.5 kHz can be selected to suit the application.
My suspicions of the usefulness of a capacitor were further confirmed by their explicit instructions to use one. What capacitor size have you chosen and what bandwidth are you trying to achieve?
  #5   Spotlight this post!  
Unread 13-01-2008, 20:27
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Re: Filtering out Vibration while using a KOP Accelerometer

Thanks for the advice. What do you guys think about taking the derivative of the acceleration and if it's too high just throwing the data over again. (I guess that's kind of a filter too, in a way)
I don't use a timer-based interrupt as I first planned, but am instead using the timer function in easy C to measure the time difference between calls... The timer is then reset to 0 to start the next time period.

I'll post our data a little later, I don't have it on my computer, it's on the robotics one.

I've read the spec sheet, but if I end up using a filter as they suggest, won't it take out things like the robot crashing into the wall and stuff like that. That would change the acceleration really fast. I mean, I can't assume I'm not going to hit anything in autonomous (hybrid) mode.

What bandwidth would you suggest?

Last edited by joshyboy9987 : 13-01-2008 at 20:38.
  #6   Spotlight this post!  
Unread 13-01-2008, 20:56
jleibs's Avatar
jleibs jleibs is offline
Computation and Neural Scientist
AKA: Jeremy Leibs
no team
 
Join Date: Jan 2008
Rookie Year: 2001
Location: San mateo
Posts: 19
jleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of light
Send a message via AIM to jleibs
Re: Filtering out Vibration while using a KOP Accelerometer

Quote:
Originally Posted by joshyboy9987 View Post
Thanks for the advice. What do you guys think about taking the derivative of the acceleration and if it's too high just throwing the data over again. (I guess that's kind of a filter too, in a way)
I don't use a timer-based interrupt as I first planned, but am instead using the timer function in easy C to measure the time difference between calls... The timer is then reset to 0 to start the next time period.

I'll post our data a little later, I don't have it on my computer, it's on the robotics

I've read the spec sheet, but if I end up using a filter as they suggest, won't it take out things like the robot crashing into the wall and stuff like that. That would change the acceleration really fast. I mean, I can't assume I'm not going to hit anything in autonomous (hybrid) mode.
Throwing out accelerations that have changed too much from the previous measurement is indeed a form of filter. I think this would generally be referred to as statistical filtering. The statistics govern how you define "too high", etc. There are some questions raised here though of what you use in place of this data, etc.

Since you are not forcing the time via a timer interrupt (which I suspect it is recommended that you figure out how to do), do you have an idea of what frequency your code is actually polling the accelerometer?

As far as filtering out things like robot crashes, there is always a trade off. However, there is a fundamental difference between what the accelerometer does in the presence of noise, and what it does when you hit a wall.

When you have the kind of shock noise you're seeing there should be a positive acceleration followed by a negative acceleration. Your robot, has, after all not actually changed its velocity. The problem is that I believe this is happening faster than the sampling time of your robot, and you are only catching one half of it since you can't sample that fast.

If your robot hits a wall, it ACTUALLY decelerates. There is a deceleration, and there is not an immediately following positive acceleration that would zero it out.

The capacitor is supposed to be chosen based on the frequency at which you are polling the accelerometer. It smooths things out such that they are at a rate you can sample them.

Now, when you smooth out a positive acceleration immediately followed by a negative acceleration, you get something close to 0.

However, when you smooth out just a negative acceleration by itself, you simply get a smaller negative acceleration. The fact that the acceleration is smaller reflects the fact that your sample time is longer and the fact that your total change in velocity is the same.

This SOUNDS right to me... but I havn't dealt with circuits at this level in a while. Someone with more experience at this level please correct me if I'm wrong
  #7   Spotlight this post!  
Unread 13-01-2008, 22:08
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Re: Filtering out Vibration while using a KOP Accelerometer

Yeah, I think everything you've said sounds right... I have a timer in Easy C that gives me the time every time I use GetTime so I use that to determine the time between polls. (You can't integrate w/o time!). I think we are polling it fast enough too, because we see both the positive and negative amplitudes when we graph our data. I was talking with one of our mentors and he said that I should use a lowpass filter on the signal (with a capacitor) and then take that and sample it as fast as possible. I guess the frequency of the sample should be 5-20 times what the filter bandwith is...

I'll see how it works tomorrow and let you know.. Thanks for the help. I'll see if I can post some graphs too...
  #8   Spotlight this post!  
Unread 13-01-2008, 22:19
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: Filtering out Vibration while using a KOP Accelerometer

I've done a lot of navigation systems for FIRST robots. I would highly recommend NOT using accelerometers for determinings distances. Double integrations are thrown off easily by small offset shifts (which are inevitable). We always used a non-driven wheel with an encoder located as close to the center of the robot as possible. We always had good results with that.
__________________
-
An ounce of perception is worth a pound of obscure.
  #9   Spotlight this post!  
Unread 13-01-2008, 22:25
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Re: Filtering out Vibration while using a KOP Accelerometer

Hmmm... The design team is gonna have a fit if I tell them to put an extra wheel on the robot, maybe I'll just make 'em deal with it.

But if I was to use an accelerometer, any ideas on how to make it work? The spec sheet says to use filters, so I guess I'll try that, but otherwise I might have to add some extra hardware..
  #10   Spotlight this post!  
Unread 13-01-2008, 22:53
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Filtering out Vibration while using a KOP Accelerometer

Quote:
Originally Posted by jleibs View Post
Ok... curiosity inspired me to do a little more digging...

The data sheet seemed like a good place to start.



My suspicions of the usefulness of a capacitor were further confirmed by their explicit instructions to use one. What capacitor size have you chosen and what bandwidth are you trying to achieve?
I believe the accelerometers in the FIRST KoP come built into a board, which includes the recommended components. I don't know the size, though. All of the included sensors are assembled onto boards for FIRST.
  #11   Spotlight this post!  
Unread 13-01-2008, 23:18
comphappy comphappy is offline
Registered User
AKA: Brennan Ashton
FRC #2605 (A2D_16)
Team Role: Leadership
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Bellingham, WA
Posts: 157
comphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to behold
Send a message via AIM to comphappy
Re: Filtering out Vibration while using a KOP Accelerometer

My impression from the FIRST rules is that I can not make my own electronics, unless it is on the OI, correct me if I am wrong, because i will just create an integrator circuit, and off load it all from the RC.
  #12   Spotlight this post!  
Unread 13-01-2008, 23:27
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Re: Filtering out Vibration while using a KOP Accelerometer

Yeah, we thought about just putting another micro on the robot so that it could handle the sensors and just output values to the RC to save some processor time, but there's not too much going on during hybrid mode...

You think they'd care if I just added two capacitors! I hope not, because you're right, the accelerometer comes with filters on board, but the signal needs to be filtered further.. (Data to follow...)
  #13   Spotlight this post!  
Unread 13-01-2008, 23:37
joshyboy9987 joshyboy9987 is offline
Registered User
FRC #0706
 
Join Date: Jan 2008
Location: Hartland, WI
Posts: 16
joshyboy9987 is an unknown quantity at this point
Re: Filtering out Vibration while using a KOP Accelerometer

Ok, here's the data... ax, ay are the accelerations after Easy C's getacceleration function. anx and any are the analog input values for x and y...

dx and dy are the distance traveled in the x and y directions. (They aren't right, which is the problem!) Every data point is about 25 ms apart. (I'm not positive about that one, but it's close to that...

It's in an excel workbook that's in a .zip file..
Attached Files
File Type: zip Acceleration data.zip (256.2 KB, 106 views)
  #14   Spotlight this post!  
Unread 14-01-2008, 00:55
ay2b's Avatar
ay2b ay2b is offline
Registered User
AKA: Andy
FRC #2928
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 1994
Location: Seattle, WA
Posts: 211
ay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant future
Re: Filtering out Vibration while using a KOP Accelerometer

Quote:
Originally Posted by comphappy View Post
My impression from the FIRST rules is that I can not make my own electronics, unless it is on the OI, correct me if I am wrong, because i will just create an integrator circuit, and off load it all from the RC.
Yes, you are wrong. You are allowed to have additional electronics on the robot. However, they are only allowed to connect to the RC's I/O ports (and to power) -- you cannot connect additional electronics to the spikes or victors.

See sections 8.3.6 & 8.3.8, especially <R53>, <R68> and <R81> through <R84>.
__________________

2011 - SD Quarterfinalists (980), LA Quarterfinalists (980)
2010 - LA (2404) Finalists (980), AZ Motorola Quality (980)
2009 - LA Semifinalists (980); Las Vegas Quarterfinalists (980); SD (2404); IRI #1 Seed, Finalist (980)
2008 - SD Quarterfinalists (980), LA Champions (980), LA Rookie Inspiration Award (2404); CalGames Finalists
2007 - So.Cal Finalists (980), SD Quarterfinalists (980); CalGames Finalists
2006 - So.Cal Regional Champion (4), Toronto Judge's Award Day 1 (4)
2005 - SVR Champions, Delphi "Driving Tomorrow's Technology" (980); AZ Xerox Creativity (980); So.Cal Finalists, RadioShack Innovation in Control (980); Championship Archimedes Division Semifinalists; IRI Finalists (980)
2004 - So.Cal Regional Champions, Leadership in Controls (980); AZ GM Industrial Design (980); Championship Galileo Division #2 Seed; IRI Champions
2003 - PNW Semi-finalists (488)
2002 - PNW Finalists (488)
2000 - X-bot / 488 - Mentor / Founder
1994 - Sunny Delight - Driver - champion
  #15   Spotlight this post!  
Unread 14-01-2008, 01:02
jleibs's Avatar
jleibs jleibs is offline
Computation and Neural Scientist
AKA: Jeremy Leibs
no team
 
Join Date: Jan 2008
Rookie Year: 2001
Location: San mateo
Posts: 19
jleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of lightjleibs is a glorious beacon of light
Send a message via AIM to jleibs
Re: Filtering out Vibration while using a KOP Accelerometer

TubaMorg, I can't verify for sure whether there are already capacitors in place as I don't have a KOP. The data sheet made it sound like the user choses the capacitor, so I figured it would have to be added by the user after the fact. But, if FIRST has mounted it on another board already, I guess there's a chance they did this for you. It would be nice if someone could verify this for sure (and what size capacitors FIRST decided to use).

With regards to an extra wheel for odometry. While adding an extra wheel can be useful things can definitely work by monitoring actual drive shafts. Your team probably just needs to add an encoder and not a whole extra wheel if most of your design is already being implemented.

I don't know about the legality adding your own custom circuits... I'd like to hear someone else chime in on where that falls within the rules.

I'll take a peek at the data when I get a chance.
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
EMI Filtering Mike Betts Electrical 1 06-03-2007 15:38
Using camera PWM out Cuog Programming 2 28-11-2005 14:17
Hall effect sensor Filtering magical hands Programming 5 13-02-2005 11:23
Content Filtering FRANK(WGH) IT / Communications 1 23-10-2004 09:21
Using Accelerometer with '04 controller sanddrag Control System 4 20-02-2004 12:18


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

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