# 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;
```

Thanks in advance

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?