ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# IMU linear acceleration to position

Hey guys,

I have IMU 3dm_GX2 and I want to get position from it. I know that there will be accumulated error and will not be accurate but I need to get the best out of it. I excluded the gravity effect from linear acceleration

     acceleration_x = (msg->linear_acceleration.x + 9.81 * sin(pitch)) * cos(pitch);
acceleration_y = (msg->linear_acceleration.y - 9.81 * sin(roll))  * cos(roll);


so whats is the best way for integrating linear acceleration twice because the ordinary integration is very bad.

     Velocity_x= Velocity_old_x+acceleration_x*dt;
x_pos += Velocity_x*dt;


edit retag close merge delete

You should implement an Inertial Navigation Stabilized (or Strapdown) Platform algorithm to get a sort of reliability.

have same issue. Any help to find implementation of that?

Sort by » oldest newest most voted Integrating acceleration twice to get position is terrible. I think you're discovering just how bad it actually is.

additionally, your current approach integrates the acceleration without taking into account any possible rotation of the sensor, which means that your results will probably be terrible if the sensor rotates at all.

If you have gyro or compass data from the 3dm_GX2, you may be able to feed all of your data into something like a kalman filter to get better results.

more

Hi. I have almost the same problem. And checking your inputs, you are taking a velocity value, where is it coming from? And how do you exclude the gravity effect ???

I will try using Kalman filter also I think it will be complicated. I considered the yaw because my model is for a car with yaw

    Velocity_x= Velocity_old_x+acceleration_x*dt;
Displacement_x += Velocity_x*dt;

x_pos = (Displacement_x * cos(yaw));
y_pos =  (Displacement_x * sin(yaw));

more

This is not the movement model for a car. You need to incorporate the yaw when you compute displacement, to get dx and dy, and then integrate x and y separately.

is this right ?

     Displacement_x +=Velocity_x*cos(yaw)*dt;

x_pos += Velocity_x*Displacement_x;


its not displacment its dx ?

1

.

dx = velocity * dt * cos(yaw);
dy = velocity * dt * sin(yaw);
x_pos += dx;
y_pos += dy;