Go to Post Right now that dream is sealed behind a few milimeters of plastic for most teams. - AllenGregoryIV [more]
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 16-01-2008, 18:55
Red Mage's Avatar
Red Mage Red Mage is offline
Owner of Holistic Omniscience
FRC #1546 (Chaos Inc)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: New York
Posts: 35
Red Mage is on a distinguished road
Send a message via AIM to Red Mage
Accelerometer help

Hey, my programming team (by which I mean my programming team--) wants to use an accelerometer for determining speed of the robot during autonomous mode and to determine if we've crashed, but the problem is I'm not sure how to handle the accelerometer in the code. I know the physics of it: Final Velocity=Initial Velocity+Acceleration*Time I don't know what the accelerometer returns and...that's about it. Could someone enlighten me. Thanks.
__________________
Don't Blink. Blink and you're dead. Don't turn your back. Don't look away. And don't Blink. Good Luck.
  #2   Spotlight this post!  
Unread 16-01-2008, 20:09
jee7s jee7s is offline
Texan FIRSTer, ex-frc2789, ex-frc41
AKA: Jeffrey Erickson
FRC #6357
 
Join Date: Nov 2007
Rookie Year: 1997
Location: Dripping Springs, TX
Posts: 313
jee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond repute
Re: Accelerometer help

You're more than half way there.

Since you understand the physics, you just need to translate that into program code. Using an interrupt-based timer will give you a good stable time interval.

To get acceleration, you simply need to read an ADC channel. That will give you a 10-bit representation of the voltage coming out of the accelerometer. Then, this number needs to be shifted and scaled to translate that 10-bit number into an acceleration.

Next, you need to view the velocity problem as the integration of acceleration. The physics you mention are a good approximation, and may work for the 15 seconds of autonomous/hybrid. Essentially, you need to have some variable in your program (probably a long) to accumulate the a-t product. That means to add the acceleration at each interval to the previous sum to get the velocity. If you want a more accurate result, there are many options. Read up on "numerical integration" in a calculus or signal processing book.

There are some caveats, though.

First, stick to the integer (and related) data types. Resist the temptation to go to floating point to track the velocity, as floating point math is very inefficient on the PIC.

Second, if you turn, it will not be easy to translate the data after the turn to the data before the turn. Here, you would need a gyro to tell you the angle relative to your start.

Third, the accelerometer can be sensitive to noise and vibration. You'll probably need to build a filter to get rid of the noise, and you'll have to mount it on foam or other dampening material to minimize vibration.

-JEE
  #3   Spotlight this post!  
Unread 16-01-2008, 20:15
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: Accelerometer help

The kit accelerometer returns a voltage proportional to acceleration.

It's described on page 3 of the 2008 Sensors Manual

There is also a link there to the Product Webpage.

Bottom line: 2.5V output = no acceleration and it deviates from that at roughly 1000 mv/g.

I would not recommend using accelerometer if all you want is speed. Shaft encoders + the yaw-rate sensors will probably find you more success for autonomous navigation.

There are a large number of other threads on this exact topic. The search function is wonderful
  #4   Spotlight this post!  
Unread 30-01-2008, 18:49
Red Mage's Avatar
Red Mage Red Mage is offline
Owner of Holistic Omniscience
FRC #1546 (Chaos Inc)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: New York
Posts: 35
Red Mage is on a distinguished road
Send a message via AIM to Red Mage
Re: Accelerometer help

Thanks guys.
__________________
Don't Blink. Blink and you're dead. Don't turn your back. Don't look away. And don't Blink. Good Luck.
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
Accelerometer railerobotics Programming 1 27-01-2006 02:59
URGENT! We need help with the accelerometer lkdjm Electrical 5 11-02-2005 16:42
Accelerometer Connection Help crazykid234 Electrical 2 11-02-2005 08:23
URGENT! We need help with the accelerometer lkdjm Technical Discussion 0 08-02-2005 14:35


All times are GMT -5. The time now is 09:16.

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