|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Plotting Location w/ Accellerometer Project
Invictus programmer here!
The other day i was doing some research on the Kinect sensor and found out that it has a 3-axis accelerometer in it. I'm thinking that it would be a neat project we could discuss/accomplish in this thread if we were to use the accelerometer data to calculate the "x" movement on the field and "z" movement on the field. Since we don't really need "y" values, we can toss them out. We can use a time interval of about 100ms to calculate distance traveled with this equation: D=1/2at^2 where a is the accelleration and t is the time interval. After that, the only problem would be displaying a small diagram on the LV dashboard that has an aerial view of the field and a scale model robot that changes position every 100ms on the field diagram, based on the change in distance of the "x" and "z" values. Anybody up to the challenge? |
|
#2
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
but how is the kinect related to this? Can't it be done with the KOP accelerometer too? BTW in what units is the output of the accelerometer? m/s^2, etc.. |
|
#3
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
D = ½at2 + Vot ... and that formula is valid only if "a" is constant over the time interval. Hate to be a party pooper, but... Due to the double integration, tiny errors in "a" will rapidly accumulate so that the computed position will quickly diverge from the true position. Trapezoidal integration will help somewhat: Given t, x, v, and a at some point in time, and anew at some later point in time tnew, proceed as follows: dt = tnew - t; vnew = v + dt*(anew+a)/2; xnew = x + dt*(vnew+v)/2; Last edited by Ether : 28-09-2013 at 13:13. |
|
#4
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
Quote:
What if the time variable was such a very short amount of time, like 50ms, and you just took the average acceleration over that time period? |
|
#5
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
Quote:
Play around with it in a spreadsheet or Maxima or Octave or SciLab and see for yourself. |
|
#6
|
|||
|
|||
|
Re: Plotting Location w/ Accellerometer Project
If you want to play with this, it may be worth checking to see if your laptop has an accelerometer in it. I know that my last Mac laptop did. It was used to park the hard drive before it landed during a fall.
If so, you can read that accelerometer in LV and play a bit. I looked on the Apple app store and there are a number of free apps that let you see the accelerometer data and let see their interpretation of the data. As for using this on the robot, the key cases to think about are the ones where the floor is uneven. Sitting still, the robot and its accelerometer are tilted. Gravity's 1g is no longer in the pure Z direction. It is imparting a force on the other axes. If your code doesn't calibrate and ignore this, it looks like the robot is constantly accelerating in the uphill direction. If you do calibrate it for that tilt, then drive the robot a foot and stop it again, the floor is likely tilted a new direction. Once again, sitting still, you will accelerate uphill. It is an interesting problem, and accelerometers are certainly useful on the robot, but integrating them to identify speed or location without isolating them from the force of gravity is quite hard. Greg McKaskle |
|
#7
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Yes, thanks Greg, I should have included LV in my earlier post.
|
|
#8
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
As for the tilt, if we had a gyro on there, and re-calculated the "down" direction whenever we weren't level, would that help fix the tilt problem? I mean, this year, the floor was totally level, but i guess it would go nuts if we get tipped or something. |
|
#9
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Also, I talked to my Physics teacher and he said that using this equation for each axis would work:
d=1/2at2+Vot But we would have to get "vo" from the equation: Vf=vo+at Also, we talked about the case where the robot is turning, putting acceleration on the axis tangent to the curve and he used these few equations: ac=(Vt2)/r r=(Vt2)/ac wf=wo+xt rx=a I wasn't ale to make sense of it all, but if someone can explain, this may be able to, somewhat, work! |
|
#10
|
|||
|
|||
|
Re: Plotting Location w/ Accellerometer Project
The use of ac = (Vt2)/r and the other equations only apply if the robot is moving in a circle. I do not know the skill of your drivers, but most drivers I have seen do not drive in circles. The Vt refers to the velocity of the object tangential to the acceleration.
The wf = w0 + xt is similar to vf = v0 + at. It is the rotational velocity of a body under constant rotational acceleration. x is the rotational acceleration in radians/(s2). In circular motion, velocity, acceleration, and position can be related to their rotational analogues by dividing by the radius. Another interesting idea (that may be completely wrong) is to use a gyro with the forward position to create a set of vectors that might be used to find position in a polar system. |
|
#11
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
The code for trapezoidally integrating an acceleration to get distance was given in this thread in an earlier post. If your acceleration is in a plane (the plane of the floor), use the same concept to get your position in the plane: Given t, x, y, vx, vy, ax, and ay at some point in time, and axnew aynew at some later point in time tnew*, compute vxnew vynew xnew and ynew as follows: dt = tnew - t;... where x,y is the location of the accelerometer in the fixed plane of the floor. Note that you will have to convert your accelerometer signal from the vehicle reference frame to the fixed x,y reference frame of the floor, using the gyro to do the coordinate rotation. As stated earlier, the errors will accumulate quickly and the computed position will diverge from the true position. *Just to be absolutely clear for those who may be new to this: tnew is not one giant step from t. It is a very small integration time step (say 20ms) later than t. The repetition of this calculation over time is known as numerical integration. Last edited by Ether : 01-10-2013 at 15:54. |
|
#12
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
Quote:
Using trapezoidal integration, would that eliminate the errors? Or is there anther way to do it without the problems you describe? I've read that with robotic probes that go into caves and such, they use this kind of plotting system, an accelerometer and a gyro.. |
|
#13
|
|||
|
|||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
|
|
#14
|
||||
|
||||
|
Re: Plotting Location w/ Accellerometer Project
Quote:
|
|
#15
|
|||
|
|||
|
Re: Plotting Location w/ Accellerometer Project
I was looking for a decent app on the iPhone that would work to experiment with. The closest I can come to is one called Vibration. I was using it to measure how the cell phone buzzed and compare that to an external accelerometer reading.
Anyway, the app will show the three axes and it calibrates to subtract out gravity at the initial orientation. If you leave the phone sitting still and run a five second recording, you should get relatively flat lines and that's expected. The integrated area should be zero. If you run the app and move the phone to the left and right, you'll see similar cancellation. But it probably won't quite zero. Next, during a sample recording, walk from your chair to the front door. Each step looks like a heartbeat, on each axis. And yeah, they sort of cancel out, but where is my predictor of my acceleration that tells me how far I walked. It is a tiny bump at the beginning of that heartbeat signal. Then run a sample and simply tilt the device a bit. You'll see that a five or ten degree tilt offsets the line quite a bit. And worse, it stays there for the entire sample. The integration of the tilt is huge. Anyway, if you can find the app, or something similar, it is helpful in understanding why IMUs are hard. After all, if it was easy, the phone or Garmin would do this instead of or in addition to GPS. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|