|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Any sucess using a accelerometer to measure distance
I understand they noise and will drift over time. We would like to just use one for measuring short distances in auto mode. So we are fine with reseting the accumulators and measuring 3 feet.
What we are having trouble with is getting any usable infromation out of the device. We have tried sampling the readings at the start and applying the average to get the reading "centered". But event then we seem to get alot of drift. We have been struggling with this for some time. We are currently using the I2C and this years accelerometer, but are now thinking we may need to got with one of the analog ones to more effectivly filter the signal. I have search high and low for soem example code and have not found much, any ideas of samples from this group? |
|
#2
|
||||
|
||||
|
Re: Any sucess using a accelerometer to measure distance
In general I'd take a look at the examples - there are several for accelerometers. But if I were measuring distance, I'm not sure I'd pick an accelerometer. Once you get good acceleration readings, you would then have to integrate once over time to get velocity, and then integrate velocity over time to get distance. That works great in physics class, but is a bit tricky in the real world. Have you considered using an encoder for measuring distance?
Early on we did some testing with accelerometers - it was difficult to simply measure velocity, let alone distance. |
|
#3
|
|||
|
|||
|
Re: Any sucess using a accelerometer to measure distance
Quote:
|
|
#4
|
|||
|
|||
|
Re: Any sucess using a accelerometer to measure distance
If you only want your robot's forward velocity, mount your accelerometer with the sensitive axis pointing forward, then you can do an average of a number of them to give you average acceleration over a time, then integrate based on that. For 15 seconds of autonomous, it should be stable enough.
We're using the kit 3-axis accel over I2C and set that up to measure at 200Hz (200 samples/sec), which we then accumulate 10 samples to integrate. The output is velocity at 20Hz. I added a little "distance traveled" item for our autonomous that integrates this 20Hz velocity to distance, with a reset flag that sets it back to 0. This allows for "drive forward 3 feet, turn 90*, drive forward 10 feet" style autonomous as you can reset the distance traveled after the turn. |
|
#5
|
|||
|
|||
|
Re: Any sucess using a accelerometer to measure distance
Quote:
So sounds like you are capturing acceleration 200 times per second. Then you are averaging every ten of them and multiplying by .05 to get velocity at 20Hz. I am guessing you are multiplying again to get distance traveled in the .05 of a second. Then you are accumulating that distance to get total traveled. Do you have any sample code I could let the team look at? |
|
#6
|
||||
|
||||
|
Re: Any sucess using a accelerometer to measure distance
If you truly want to measure distance with an accelerometer you need to be aware of one major obstacle, gravity sucks!
I know, that is a bit obtuse, but my point is, gravity will play a huge factor in getting accurate measurements. You see, if the accelerometer is even the slightest bit unlevel, gravity will be adding or subtracting from the values collected from the accelerometer. On top of that, if the mounting mechanism is not completely stable, with respect to the ground, then gravity's effect on the values will not be constant. So, as you might imagine, gravity will not be your friend if you try to take this approach. Please do not let me discourage you with this posting, it is only meant to make you aware that while measuring distance with an accelerometer is theoretically possible, it's accurate implementation is far from simple. |
|
#7
|
|||
|
|||
|
Re: Any sucess using a accelerometer to measure distance
Quote:
dwodrich, I do have sample code for you, except it's a mess right now since we're having to rewrite it a tad to reduce complexity. When some of the students can't follow what's going on I know I've got a problem. |
|
#8
|
|||
|
|||
|
Re: Any sucess using a accelerometer to measure distance
Quote:
|
|
#9
|
|||
|
|||
|
It is perfectly possible and simple to use an accelerometer to measure distance, with proper calculation.
CayennE-k has the technology. See it at CayennE-k Tecnologia www.cayenne.com.br Cheers Pasini |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Anyone using the Accelerometer ? | de_ | Sensors | 1 | 27-11-2009 14:44 |
| Finding distance using accelerometer.. | SL8 | NI LabVIEW | 5 | 13-02-2009 16:20 |
| how to find distance using two color servo camera? | Steelix4532 | General Forum | 4 | 06-02-2009 17:20 |
| Some ways to measure distance during autonomous | shamu1001 | Programming | 2 | 06-02-2006 15:24 |
| Using Accelerometer with '04 controller | sanddrag | Control System | 4 | 20-02-2004 12:18 |