How to get Velocity from Linear accel?

Hi brother! need help to find the right Equation to get Velocity from the Accel sensor, I get linear Accel from the Accel sensor, which means hen sensor at rest ax = 0, ay = 0, az = 9.81 approx, so we need to remove gravity turms that's why I am confused. I found 2 different equations from ardupilot and other sources, please guide me!

  1. = velocity = prevVelocity + [rotMat_N_to_B * (meassureAcc - accBias) + gravity] * dt
    where gravity = [0, 0, -9.81]
    or

  2. = velocity = prevVelocity + gravity * dt - rotMat_N_to_B * (meassureAcc - accBias)
    where gravity = [0, 0, -9.81]

which equation is right 1 or 2?

In my opinion, 1 was right. Which one is right?

I don’t know what all the variables are but an acceleration is expressed in ms-2 whilst a speed is expressed in ms-1

So for coherence any acceleration needs to be multiplied by something representing time (seconds) to get a speed.

The second expression looks suspicious because you have variable names (meassureAcc - accBias)that sounds like acceleration that would not be multiplied by dt which sounds like a delta T so a Time. But as we don’t know what rotMat_N_to_B and if they are the same thing in both, is, it’s hard to be 100% sure

Hi bro, velocity are 3 dim vector[x, y, z]
rotMat_N_to_B are the rotation matrix world frame to body frame.
meassureAcc are accel which i get from sensor [x, y,z] vector

accBias are bias vector.

which I equation are right 1 or 2?

Yes I got you were using vectors

Then I agree with you that the second one is wrong just from a unit perspective -

This part is OK and in speed units

But the rest is just an acceleration and missing the time factor (multiply by dt).

May be part of that formula was coming from a code where they were sampling acceleration every second ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.