I am currently estimating position of a car using kalman filtering using GPS,magnetometer and wheel pulse rotation.
I use magnetometer and wheel rotation pulse(for distance i know how much distance each pulse covers) to predict next position and i correct it using GPS data.
So far so good.
The problem is some car’s dont give me wheel rotation pulse, so i have to go for another source for distance. The device i’m using also has 3 axis accelerometer so i was wondering if i could use accelerometer for distance to predict next position.
I am awre of the integral error that builds up over time but here since im only interested in absolute distance and not cummulative distance, the integral error should not matter right?
If this can be achieve – I have 2 questions

Since its car distance estimation, the z direction of accelerometer is not required i suppose, so using just x parameter of accelerometer data will suffice for distance measurement?

Also, should i use the following equation for distance than double integral?
Displacement = u* t + (att)
where u is initial velocity, a is acceleration and t is time
A sample code for performing integration in c++ will be very useful as well
Source: Windows Questions C++