[HELP] distance detection from linear acceleration
I would like to ask for help.
We are trying to detect distance from linear acceleration data. I recorded a session with MetaBase, loging linear accelearation (100Hz). The MMR was on the desk, after 5sec i raised up about 30cm, after 5sec i put down on the desk and so on... So i only moved it in the Z axis.
This is the raw data i recieved (only Z):
As you see there is an offset about +0,02 g. Is it normal when using linear acceleration?
According to this document (https://nxp.com/docs/en/application-note/AN3397.pdf ) i made an offset correction (-0,021) from the avarage of the first 500 samles, made the filtering, moving avarage, integration for velocity, movement detection, and another integration for distance.
What i willing to see is something like this
But what i get is, that the upright move is ok, but when i put in back on the desk, it has an incemental offset:
Can you help me, what can be wrong? Is it because the offset? I attached the raw data i recieved.
Linear acceleration is calculated by transforming raw acceleration from sensor frame to a global frame using an estimated sensor orientation, and then subtracting gravity. This means that it is vulnerable to calibration errors in accelerometer, gyroscope and possibly magnetometer data, and to the quality of the sensor fusion algorithm used to estimate orientation/attitude.
What you describe above is most likely the result of integration of noise, especially if you integrate twice (to velocity, then to position). In general, 1-2 seconds of integration is enough to integrate noise to unusable levels.
If there is another source of velocity information, this problem may be harnassed. I recommend you search the literature for ZUPT (zero velocity update) algorithms to see how this is done for foot-placed IMUs/AHRSs.