Go to Post To put it simply: An adult coach impacts a team for two minutes. An adult mentor impacts a team for a lifetime. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 19-02-2010, 08:20
dwodrich dwodrich is offline
Registered User
FRC #1706
 
Join Date: Dec 2008
Location: Wentzville
Posts: 45
dwodrich has a spectacular aura aboutdwodrich has a spectacular aura aboutdwodrich has a spectacular aura about
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2010, 10:48
Doug Norman's Avatar
Doug Norman Doug Norman is offline
Registered User
no team (National Instruments)
Team Role: Engineer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Austin, TX
Posts: 137
Doug Norman will become famous soon enoughDoug Norman will become famous soon enough
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2010, 10:52
dwodrich dwodrich is offline
Registered User
FRC #1706
 
Join Date: Dec 2008
Location: Wentzville
Posts: 45
dwodrich has a spectacular aura aboutdwodrich has a spectacular aura aboutdwodrich has a spectacular aura about
Re: Any sucess using a accelerometer to measure distance

Quote:
Originally Posted by Doug Norman View Post
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.
Yes, considered encoders, but with mecanums and traveling any direction, I'm not sure they would be very accurate ether. The any direction part makes an idler hard and the mecanum slip make encoders on the transmission hard.
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2010, 11:49
Kennersoft Kennersoft is offline
Registered User
FRC #0079
 
Join Date: Feb 2006
Location: Clearwater, FL
Posts: 6
Kennersoft is an unknown quantity at this point
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2010, 14:35
dwodrich dwodrich is offline
Registered User
FRC #1706
 
Join Date: Dec 2008
Location: Wentzville
Posts: 45
dwodrich has a spectacular aura aboutdwodrich has a spectacular aura aboutdwodrich has a spectacular aura about
Re: Any sucess using a accelerometer to measure distance

Quote:
Originally Posted by Kennersoft View Post
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.
Thanks, this helps. Are you using a timed loop or just delays in the code to get the timing you want.

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?
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2010, 16:59
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,372
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
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.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #7   Spotlight this post!  
Unread 27-02-2010, 13:00
Kennersoft Kennersoft is offline
Registered User
FRC #0079
 
Join Date: Feb 2006
Location: Clearwater, FL
Posts: 6
Kennersoft is an unknown quantity at this point
Re: Any sucess using a accelerometer to measure distance

Quote:
Originally Posted by billbo911 View Post
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.
This is true, but if you're tracking your robot's attitude (heading, pitch, and roll) you can compensate for that. We have that in our code, and it even "calibrates" itself on startup by reading the current gravity.

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.
Reply With Quote
  #8   Spotlight this post!  
Unread 27-02-2010, 17:05
dwodrich dwodrich is offline
Registered User
FRC #1706
 
Join Date: Dec 2008
Location: Wentzville
Posts: 45
dwodrich has a spectacular aura aboutdwodrich has a spectacular aura aboutdwodrich has a spectacular aura about
Re: Any sucess using a accelerometer to measure distance

Quote:
Originally Posted by Kennersoft View Post
This is true, but if you're tracking your robot's attitude (heading, pitch, and roll) you can compensate for that. We have that in our code, and it even "calibrates" itself on startup by reading the current gravity.

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.
I'd love to take a look at it maybe I can help clean it up?
Reply With Quote
  #9   Spotlight this post!  
Unread 16-07-2010, 20:50
pasini pasini is offline
Registered User
no team
 
Join Date: Jul 2010
Location: Brasil
Posts: 1
pasini is an unknown quantity at this point
Thumbs up Re: Any sucess using a accelerometer to measure distance

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
Reply With Quote
Reply


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
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


All times are GMT -5. The time now is 22:03.

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