Plotting Vehicle Path Based on Accelerometer Readings

In summary, the conversation discusses the problem of using an accelerometer to recreate the path of a model train on a set track. The strategy is to assume initial position and velocity to be 0 and then keep track of a velocity vector by performing coordinate translations and modifying the velocity and position values. However, due to the inaccuracy and noise of the accelerometer readings, the normal solution is to use a Kalman filter to get a smooth running average. Another method being explored is reducing the magnitude of the velocity vector at certain intervals to correct for drift. The conversation also mentions the need for directional information and the equation for calculating displacement from an accelerometer reading.
  • #1
Pugio
3
0
There's a problem I've been working on for a few days that I can't seem to resolve:


There is a model train going around a set track with a 2-D accelerometer mounted along the axis of the train. The accelerometer provides the current x/y acceleration values at a frequency of about once every 0.01 seconds.

Using just those values, I am trying to recreate the path of the train. I thought I had understood the problem, and it's solution, but I seem to be getting stuck somewhere.

My strategy is first to assume initial position and velocity to be 0. I then keep track of a velocity vector. For each line of data I first:

1. Perform a coordinate translation to translate the given acceleration vector from coordinates local to the train/accelerometer to a global coordinate system.
2. Modify my velocity by the new accel vector * delta t.
3. Modify my position by the velocity * delta t.

Since the velocity vector encodes the current orientation of the train, I can use that value to translate the local acceleration vectors into the global coordinate frame.

Ideally, by plotting each position point I should get a graph illustrating the path of the train.

This seems to work at first, but at some point the train looks like it almost jumps the tracks and sails off in a straight direction. Somehow, despite the fact that the acceleration vectors indicate some form of curve/turn, the velocity supersedes this and the train heads straight off to nowhere.

I've checked my code/algorithm many times, and I don't think this is a simple programming error. It seems as if I am not understanding an aspect of this problem. Maybe something to do with propagated error in the acceleration readings?

An example of the data:
Code:
t	x	y
0.01	-0.008	-0.002
0.02	-0.015	-0.003
0.03	-0.02	-0.003
0.04	-0.022	-0.003
0.05	-0.027	-0.002
0.06	-0.032	-0.001
0.07	-0.038	0
0.08	-0.042	0
0.09	-0.045	0


Any insight into this would be appreciated.
 
Physics news on Phys.org
  • #2
You have the correct method but it's difficult to do in practice.
The problem is that you have to integrate the accelration to get velocity and then integrate velocity to get position. But the accelrometers are inaccurate and noisy.
The normal solution is to average them with a Kalman filter but it is difficult to get a good position for very long without an external re-sync.
 
  • #3
Thanks for the info. I agree it may be impossible, given noise of the data, but I'd like to try.

I've never used a Kalman filter before, so I'm unsure how I would go about applying one to my data (there isn't some simple set of steps I can encode into a computer function, is there?)

I guess I've got my work cut out for me.
 
  • #4
Kalman filter is a technique for getting a smooth running average from constantly changing data.
It is either built into a library or you can write it from the description in wiki etc.
A cheap and simple version of a running average is to combine the new answer with the current value with sum weighting.

So if your new reading is xn and your current value is xc then you do, xc = (xc * 0.1) + (xn * 0.9)
You can choose the factor to adjust how much of the new value to use.
xc*0.9, xn*0.1 would only change the value a maximum of 10% on each reading so would give a very smooth result but it only changes slowly as you change direction.
xc*0.1, xn*0.9 would change more quickly but noisy values of xn would give you spikes.

You pick the ratio to give you the smoothing scale appropriate to how quickly your data should change. Obviously they have to add to 1.0 !
 
  • #5
Thanks for all of your help. You're right, the data is very noisy - even with continuous smoothing. I'm currently tinkering with a method whereby I reduce the magnitude of the velocity vector at certain intervals to correct for some of the drift. We'll see how it goes.

Thanks again.
 
  • #6
More or less, yeah, this is just the lack of stability with changing values. It's for the same reason that Euler's Method isn't very good at solving differential equations, and that's data drifting. When you do the Riemann sums, especially twice over, your data is going to drift crazily. Also, there may be some error when you convert from the Frenet frames to the global Euclidean frame. Especially considering that the Frenet frame is based on the approximation of the global Euclidean frame, no?

I'd have to see your coding, but yes, there's going to be a lot of forms of error that will creep in. Like mbg said though, there exists several smoothing and counter-error methods for numerical analysis. I'm not very familiar with numerical analysis, but it may be worthwhile picking up a copy of a tutorial or a textbook on it.
 
  • #7
Greetings.

I would appreciate if someone could demonstrate how the acceleration vector is calculated from the accelerometer's xyz-component readings, as in the first post above.

Look forward to a prompt response.wirefree
 
  • #8
Pugio said:
Using just those values, I am trying to recreate the path of the train. I thought I had understood the problem, and it's solution, but I seem to be getting stuck somewhere.

Without knowing the shape of the track you would also need directional information that the accelerometers do not provide. Although you might get clever and place accelerometers in two cars or at opposite ends of one car.
 
  • #9
wirefree said:
Greetings.

I would appreciate if someone could demonstrate how the acceleration vector is calculated from the accelerometer's xyz-component readings, as in the first post above.

Look forward to a prompt response.


wirefree

I see you dug up an old thread from two years ago.

For each axis, x = x0 + v0t + (1/2)at2

This is the instantaneous equation for displacement from an initial position x0 at time t=0, where the velocity at t=0 is v0.

In practical application, one would take acceleration readings at equal time intervals (if possible). The averaged acceleration over the time interval gives you a velocity change that you add to the old velocity value. The averaged velocity gives you a displacement change that you add to the old position.

In the real world, depending upon application, you would want to filter-out accelerometer noise, do curve fitting and compensate for all other real world effects on the instrumentation that introduce error.

This could take a lot of computational horse power depending on how long you can go with polynomial increasing positional error and how far off you can be.
 
  • #10
I seek a clarification with regards to the sample script available in the sensor framework documentation.

For every line of output from the accelerometer (e.g. X:3,Y:51,Z:8), this vector is with reference to an origin situated at which coordinate?

Look forward to prompt advise.


wirefree101
 
  • #11
As I'm aware from a brief education some smart phones contain a single three axis, "3D", accelerometer.

From physics class you might recall that for something sitting stationary on the earth, it is subject to an acceleration of about 32 feet per second^2.

What this accelerometer is good for is sensing tilt direction and small displacments.

For instance, for the phone sitting still and tilted, it can tell which way is down.

For motion involving revolution around the vertical-axis it will get lost.
It doesn't know which direction north is even if told.
 
Last edited:
  • #12
wirefree said:
I seek a clarification with regards to the sample script available in the sensor framework documentation.

For every line of output from the accelerometer (e.g. X:3,Y:51,Z:8), this vector is with reference to an origin situated at which coordinate?

Look forward to prompt advise.


wirefree101

That would be the case frame of the accelerometer. In this example the accelerometer is affixed to a train. That accelerometer case frame can easily be transformed to a structural frame based on the train.
 
  • #13
D H said:
That would be the case frame of the accelerometer. In this example the accelerometer is affixed to a train. That accelerometer case frame can easily be transformed to a structural frame based on the train.

I give up. What's a sensor framework? I thought it was some proprietary software advanced by one organization for use in smartphones.
 
  • #14
Phrak said:
I give up. What's a sensor framework? I thought it was some proprietary software advanced by one organization for use in smartphones.
I don't know what "sensor framework" wirefree was referring to. The original post was about accelerometers mounted on a train. wirefree also asked about the frame of reference in which accelerometer readings are referenced. That is the "case frame" of the accelerometer.
 
  • #15
D H said:
I don't know what "sensor framework" wirefree was referring to. The original post was about accelerometers mounted on a train. wirefree also asked about the frame of reference in which accelerometer readings are referenced. That is the "case frame" of the accelerometer.

oh, OK. That's what I'd thought maybe.

I'd considered this problem driving home, running several red lights in the process.

It doesn't seem possible, using 3 orthogonal accelerators, alone, to obtain positional information without sever presumptions on the motion of the object.

Even constrained to motion in two dimensions on the Earth, where one is vertical so that one dimension has an acceleration bias, it can be fooled: It's possible to always keep the object under a constant 1g acceleration while rotating it in the xz-plane.

It may think that it's standing still, say, but it's dropping and accelerating in the y direction.
 
  • #16
Do apologize. The sensor framework reference was out of context for this forum. It may nonetheless be found http://library.forum.nokia.com/inde...ID-D803F300-88E0-4A46-90E6-C540BA123ADF.html".

Unfortunately, my query remains explicitly unanswered. I will attempt to state it simply below using the train example.

Given:
1) Equation of a completely flat floor plane on which the train tracks rest
2) Normal to the floor plane
3) Accelerometer readings in the format "X:3,Y:51", generated periodically

Question:
For each reading of the accelerometer, would, or would not, it's dot product with the normal to the floor plane be zero?

Please feel free to answer in a binary yes/no. Look forward to a prompt response.


wirefree
 
Last edited by a moderator:
  • #17
Phrak said:
It doesn't seem possible, using 3 orthogonal accelerators, alone, to obtain positional information without sever presumptions on the motion of the object.
Except for the original heading it is.

Imagine you set off and accelerate 0-60 in 20seconds, the accelerometer can measure this and assuming no noise there is only one position and velocity you can end up at after this time. You then coast at 60mph for 60 secs, again this is sensed by 0 acceleration, and you must be 1 mile along the start direction, you then brake at a certain acceleration back to rest.[/QUOTE]
 
  • #18
wirefree said:
Question:
For each reading of the accelerometer, would, or would not, it's dot product with the normal to the floor plane be zero?

It would, of course.
 
  • #19
mgb_phys said:
Except for the original heading it is.

Imagine you set off and accelerate 0-60 in 20seconds, the accelerometer can measure this and assuming no noise there is only one position and velocity you can end up at after this time. You then coast at 60mph for 60 secs, again this is sensed by 0 acceleration, and you must be 1 mile along the start direction, you then brake at a certain acceleration back to rest.
I don't know what you're getting at. If you constantly accelerate in the x direction with a spinning accelerometer where the normal axis includes the x axis, it's useless for positional information.

To, at least theoretically, get positional information using accelerometers alone, you would need at least 3 individual 3 axis accelerometers.
 
Last edited:
  • #20
Phrak said:
I don't know what you're getting at. If you constantly accelerate in the x direction with a spinning accelerometer where the normal axis includes the x axis, it's useless for positional information.

To, at least theoretically, get positional information using accelerometers alone, you would need at least 3 individual 3 axis accelerometers.
If you have the accelerometers on rails (so you know the heading) then you can figure out where you are.

I think you either need gyros or magnetometers with it if you have more than 1 direction you could go as well as more than one orientation of the device.
 
  • #21
Pugio said:
There's a problem I've been working on for a few days that I can't seem to resolve:

...
Since the velocity vector encodes the current orientation of the train, I can use that value to translate the local acceleration vectors into the global coordinate frame.
...

What is the orientation?
Are the tracks flat or banded at the turns? Real tracks are often banked.
If they are flat and you know the velocity and Y acceleration, then you can compute the change in direction.
You should have orientation in there somewhere, and an initial orientation to start out with.

I think it might be going straight because you set it up to go straight.
 

Related to Plotting Vehicle Path Based on Accelerometer Readings

1. What is the purpose of plotting vehicle path based on accelerometer readings?

The purpose of plotting vehicle path based on accelerometer readings is to track and analyze the movement of a vehicle in order to gain insight into its speed, direction, and overall performance. This information can be used for various purposes such as improving driving techniques, diagnosing vehicle issues, and optimizing routes for efficiency.

2. How does an accelerometer work for vehicle path plotting?

An accelerometer is a sensor that measures the acceleration of a vehicle in three axes: x, y, and z. By recording the changes in acceleration over time, the accelerometer can determine the vehicle's movement and direction, which can then be used to plot its path.

3. What factors can affect the accuracy of plotting vehicle path based on accelerometer readings?

Several factors can affect the accuracy of plotting vehicle path based on accelerometer readings, including the quality of the accelerometer sensor, external forces such as wind or road conditions, and the vehicle's overall condition and performance. It is important to calibrate and maintain the accelerometer properly to ensure accurate readings.

4. Are there any limitations to using accelerometer readings for vehicle path plotting?

Yes, there are some limitations to using accelerometer readings for vehicle path plotting. Accelerometers can only measure linear acceleration, so movements such as turning or rotating may not be accurately captured. Additionally, extreme conditions such as sharp turns or sudden stops may affect the accuracy of the readings.

5. How can the data from plotting vehicle path based on accelerometer readings be used?

The data from plotting vehicle path based on accelerometer readings can be used for various purposes, including optimizing driving techniques, detecting and diagnosing vehicle issues, and improving overall vehicle performance. It can also be used in combination with other data sources, such as GPS, to create more detailed and accurate analyses of vehicle movements.

Similar threads

Replies
3
Views
959
Replies
4
Views
15K
  • Introductory Physics Homework Help
Replies
30
Views
654
  • Mechanical Engineering
Replies
3
Views
1K
Replies
5
Views
8K
Replies
8
Views
3K
  • General Math
Replies
11
Views
2K
Back
Top