# Homework Help: Velocity from Acceleration

Tags:
1. Jul 17, 2017

### Ash_Sdr

1. The problem statement, all variables and given/known data
Given Ax,Ay,Az . I need to find the Vx,Vy,Vz ... The Coordinate Frame is Vehicle Axis System .. I have actual Speed to compare once i get the Vx,Vy,Vz .... The vehicle starts from the rest i.e Speed is zero and Accelerations are sampled at 0.05 seconds///

This is not a homework question

2. Relevant equations
Vx = Vix + integration(Ax*dt)
Vy = Viy + integration(Ay*dt)
Vz = Viz + integration(Az*dt)

V = sqrt(Vx^2 + Vy^2 + Vz^2)

3. The attempt at a solution

I have done the steps above with Initial velocity components as zero and did get some solution (Vx,Vy,Vz) , But they are not matching with that of actual speed .

If I just plot Vx and actual Speed , Its following the same trend as actual Speed of vehicle but has higher values...
What I am assuming is that , Do I need to do any coordinate conversion as it is Vehicle Body frame to Navigation frame.. Kind of... Please comment on this

Please let me know if anyone needs the data and also the Code which i wrote to calculate the velcoity

2. Jul 17, 2017

### Staff: Mentor

Yes, the data and code would be of help. Can you post it using the [ code ] tags?

3. Jul 17, 2017

### Ash_Sdr

t = 0.05;
% Initial velocity components are zero
Vx(1) = 0 + Ax(1)*t;
Vy(1) = 0 + Ay(1)*t;
Vz(1) = 0 + Az(1)*t;

for i = 2:length(Ax)
Vx(i) = Vx(i-1) + (Ax(i)+Ax(i-1))*t*0.5;
Vy(i) = Vy(i-1) + (Ay(i)+Ay(i-1))*t*0.5;
Vz(i) = Vz(i-1) + (Az(i)+Az(i-1))*t*0.5;
end

I have attached the complete MATLAB Code as a AccelTest.txt .. Please rename the extension to .m

#### Attached Files:

File size:
624 bytes
Views:
89
• ###### AccelTest.txt
File size:
624 bytes
Views:
29
4. Jul 17, 2017

### Ash_Sdr

And I have attached the Data file "AccelData_StartWithZeroSpeed" . please add .mat extension to it

#### Attached Files:

• ###### AccelData_StartWithZeroSpeed.txt
File size:
53.3 KB
Views:
32
5. Jul 17, 2017

### Staff: Mentor

Is there a reason you are averaging the acceleration like that?

6. Jul 17, 2017

### Ash_Sdr

You mean the Current and Previous Acceleration values ..... Trying out different ways of doing... Since these are raw accelerations, would averae out some noise...

but I did use Current acceleration and tried it .. IT didn't work either... And I used the discrete time integrator block in simulink with trapezoidal rule method and I got pretty much the same results ...

7. Jul 17, 2017

### haruspex

Can you attach the data in a more generic format, so it does not require matlab? Maybe .csv?

8. Jul 18, 2017

### Ash_Sdr

I have added the AccelData ... Its a csv file... You can rename the extension .txt to .csv to load it up in excel. Thanks

#### Attached Files:

• ###### AccelData.txt
File size:
251.9 KB
Views:
94
9. Jul 19, 2017

### haruspex

Sorry for the slow reply - was busy.

Two things...
1. You have only provided the acceleration data. I can compute speeds from that, but you have not given me the actual speed data to compare wit
2. The accelerations jump around hugely from one reading to the next. This says your time intervals are too long to get an accurate measure of velocity.

10. Jul 19, 2017

### Ash_Sdr

The AccelData.txt has four columns... Ax,Ay,Ax,Speed.... Time intervals are too long as in ??/ It was 0.050 seconds and from Vehicle CAN ... (in vehicle coordinate system)

11. Jul 20, 2017

### haruspex

Ok, I was misled by the way the initial speeds are all zero, when the accelerations say they should not be.

Try this in a spreadsheet, starting with cols A to D as in the file you posted.
Col E = the speeds from integrating the accelerations
Col F = computed speed minus actual
Col G = change between consecutive values in col F
Plot col G in a chart (points only, small icons).

I observe that
1. There are periods where this produces a steady horizontal line, but not on the y-axis.
E.g. 0-300, 6730-7300, 10670-11590, 11840-end.
These imply a systematic error in the measured acceleration. E.g. for 10670-11590, the offset hovers around 0.015. That is, the discrepancy between calculated speed and actual speed is growing at 0.015 every 0.05 seconds, so the acceleration measured is persistently wrong by 0.3. The other horizontal periods imply different systematic errors.
The systematic error for 0-300 is clearest. From the zero actual speeds, these should obviously all be zero accelerations, but they are measured at around -0.4.

2. Elsewhere, there is a general and rather broad scatter from -0.05 to +0.05.

3. Quite often, there is a near-vertical burst of dots going out as far as -0.27 to +0.2.
Intriguingly, some bursts rise then fall in what looks like a parabolic arc. See e.g. 8749-8755.

In summary, there appear to be some issues with the accelerometer.

12. Jul 20, 2017

### Ash_Sdr

****************************************************************************************

Thanks for your reply. I did exactly as you said and it seems that there is some bais with accelerations .. Since these accelerations are extracted from a Vehicle CAN bus and I assume vehicle calculates the acceleration using wheel ticks (this is my thought which can be wrong.)

I quickly took some more data from a High Grade IMU at 0.01 seconds of delta time and applied the same algorithm .. Good thing is that the IMU provides , A_Forward,A_Lateral,A_Down ,V_Forward,V_Lateral,V_Down , V_north , V_East , V_down and Speed..... My calculated V_Forward is Kind of matching with V_foward which IMU gives .. But Calculated V_Lateral doesnt even match with that of actual.. Do you have any suggestion for me on that. ? And regarding V_Down , IMU adds 1g of value to it. (as per the data)
But as per the documentation , Speed is vector addition of V_North and V_East..... DO u have any idea how I can convert my Vx to V_North.... Here is the CSV File if you might want to look into.. Its called IMUData.csv

#### Attached Files:

• ###### IMUData.xlsx
File size:
2 MB
Views:
39
13. Jul 21, 2017

### haruspex

Please clarify what lateral velocity means. My assumption would have been that forward and lateral are defined in terms of current direction of movement, but then that would mean forward velocity equals speed and lateral velocity equals zero.

The heading units are radians, not degrees. The same is likely true of roll and pitch.
With that correction, the lateral acceleration closely matches the yaw rate (rate of change of heading) multiplied by the forward velocity - which is as should be.

Edit:
I can think of two reasons why there may be some lateral velocity recorded:
1. Some misalignment between the true forward direction of the vehicle and the direction the sensor is taking as forward.
Plotting lateral velocity against speed would give a straight line, the slope being the angle mismatch. At speeds above 5, this is roughly true, but the mismatch only appears to be about 0.007 radians. In principle, we could adjust all the forward and lateral velocities and accelerations accordingly, but it hardly seems worth it.​
1. Skidding.
At speeds below 5, the graph is much more erratic. It could be skidding, but it would be strange that this occurs at the low speeds, not the high ones.​

Last edited: Jul 22, 2017
14. Jul 23, 2017

### haruspex

Perhaps you mistakenly thought the lateral velocity is simply the integral of the lateral acceleration.
Except for the two possibilities I mentioned in post #13, the lateral acceleration should consist of centripetal acceleration. This only changes direction; it does not lead to lateral velocity.
I'm wondering how the sensor you used determines lateral velocity. Perhaps it computes the expected centripetal acceleration from rate of change of heading x forward speed, subtracts that from measured lateral acceleration, and integrates whatever remains. If so, the reported lateral velocity could be just an accumulation of rounding error. That would be strange, but I struggle to understand how it gets these numbers.

Last edited: Jul 23, 2017