9 axis IMU to find speed and displacement

Hi there community,

I am currently doing a self project to better understand the use of 9axis IMU and physics + to improve my coding. My project is targeted more toward measuring the speed and distance travel by a toy car. With many forum and research article read I was able to obtain the linear acceleration (compensate gravity) thru the help of madgwick. So now i am struck with my next step which is obtaining the velocity. I have done integration as shown in the code attached, i obtaining the result i want it increase as i move the car and decrease when it stop however the drifting problem was pretty bad due to error accumulated . For my use case i just want to know if the car is moving or so it does not have to be a definite 0 (due to the limitation of low cost sensor) but must be close to 0.1~0.7 as i can set a threshold to indicate the motion of the car.

So recently I have come across an article on instantaneous velocity meaning to calculate velocity every time interval however due to my limitation in coding i was not able to achieve this part hence will like to seek advice from your guys on how i can implement it with my current code!

thank you in advance

For my use case i just want to know if the car is moving

Measuring the vibration should tell you whether it is moving or not.

This article explains why the "linear acceleration" approach won't work: http://www.chrobotics.com/library/accel-position-velocity

For help with code, post a complete program that can be compiled, explain what it should do, and what it does instead.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.