View Single Post
  #6   Spotlight this post!  
Unread 13-02-2009, 14:22
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,060
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Finding distance using accelerometer..

Quote:
Originally Posted by SL8 View Post
Thanks, but I should of made myself clearer.
I am asking for help on the actual programming in labview.
And about the gyro, is it absolutely necessary?
I thought that the axis rotated with the the accelerometer.
I'm not looking for actual position so much as just knowing the actual distance traveled.
What are you struggling with? Do you understand the math behind it? If so I would highly suggest using a c block to do it in, yes you can use LV code but I have always found it rather poor for representing math. (It is just too expanded)

If you want to know the distance you traveled along a given axis and not your position you could probably do w/o a gyro. If you want to do any sort of positioning I would suggest using a gyro.

Now, Eric is correct when he says they have to be mounted flush, the exception being that you could write code to auto zero it at the beginning of a match.

Your code is going to look similar to this:
Code:
vel //Your old velocity
pos //Old position

pos = pos + old_vel*dt+ 1/2(a*dt^2)
vel = vel+a*dt
Please note that your dt is how often this code executes, so if you execute every 4 milliseconds dt will be .004 (assuming in seconds) The trick is that the accelerometer (KOP one at least) puts out a value in g's which is equal to 9.81 m/s^2 so you will have to convert that number before you put it into that equation. Good luck.
__________________




.
Reply With Quote