ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange

# 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.

( 2015-06-19 12:28:36 -0500 )edit

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

( 2021-09-21 01:43:17 -0500 )edit

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 ???

( 2016-05-26 08:40:24 -0500 )edit

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.

( 2015-06-22 08:39:14 -0500 )edit

is this right ?

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

x_pos += Velocity_x*Displacement_x;
( 2015-06-22 09:01:55 -0500 )edit

No. Why are you multiplying displacement and velocity?

( 2015-06-22 09:05:24 -0500 )edit

its not displacment its dx ?

( 2015-06-22 09:24:04 -0500 )edit
1

.

dx = velocity * dt * cos(yaw);
dy = velocity * dt * sin(yaw);
x_pos += dx;
y_pos += dy;
( 2015-06-22 09:33:55 -0500 )edit

Thank You I will try it.

( 2015-06-22 09:57:58 -0500 )edit