1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Velocity from Acceleration

  1. Jul 17, 2017 at 3:24 PM #1
    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. jcsd
  3. Jul 17, 2017 at 3:26 PM #2

    berkeman

    User Avatar

    Staff: Mentor

    Yes, the data and code would be of help. Can you post it using the [ code ] tags?
     
  4. Jul 17, 2017 at 3:32 PM #3
    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:

  5. Jul 17, 2017 at 3:35 PM #4
    Here is the DATA File... Please add te

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

    Attached Files:

  6. Jul 17, 2017 at 3:57 PM #5

    berkeman

    User Avatar

    Staff: Mentor

    Is there a reason you are averaging the acceleration like that?
     
  7. Jul 17, 2017 at 4:27 PM #6
    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 ...
     
  8. Jul 17, 2017 at 5:05 PM #7

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Can you attach the data in a more generic format, so it does not require matlab? Maybe .csv?
     
  9. Jul 18, 2017 at 1:42 PM #8

    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:

  10. Jul 19, 2017 at 10:10 PM #9

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    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.
     
  11. Jul 19, 2017 at 10:55 PM #10
    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)
     
  12. Jul 20, 2017 at 1:24 AM #11

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    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.
     
  13. Jul 20, 2017 at 11:26 AM #12



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

    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:

  14. Jul 21, 2017 at 11:40 PM #13

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    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 at 2:12 AM
  15. Jul 23, 2017 at 2:29 AM #14

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    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 at 4:18 AM
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Velocity from Acceleration
Loading...