Forward and backward movement detection with IMU

1.9k views Asked by At

We have an embedded device mounted in a vehicle. It has accelerometer, gyrosopce and GPS sensors on board. The goal is to distinguish when vehicle is moving forward and backward (in reverse gear). Sensor's axis are aligned with vehicle's axis. Here's our observations:

  • It's not enough to check direction of acceleration, because going backwards and braking while moving forward would show results in the same direction.
  • We could say that if GPS speed decreased 70 -> 60 km/h it was a braking event. But it becomes tricky when speed is < 20 km/h. Decrease 20 -> 10 km/h is possible when going both directions.
  • We can't rely on GPS angle at low speeds.

How could we approach this problem? Any ideas, articles or researches would be helpful.

2

There are 2 answers

0
Shahab Kalantar On

This is not an easy problem to solve. The suggestion by "Mohamed Taher Alrefaie" is not relevant at all. One way to approach this problem is to fuse more than one heuristic that can cross-validate each other. for example, the path of the GPS sensor gives valuable information: if you estimate the tangent to the path (only the X-Y components of the GPS position), you'll see straightaway that direction reversal can be easily detected by looking for a zero-crossing of the tangent with a very high peak. This, of course, assumes that you know the initial direction of movement. Now, combine this with your accelerometer heuristic and you'll have a much more reliable solution.

1
Mohamed Taher Alrefaie On

You are looking for Attitude and heading reference system implementation. Here's an open source code library. It works by fusing the two data sources (IMU and GPS) to determine the location and the heading.

AHRS provides you with roll, pitch and yaw which are the angles around X, Y and Z axises of the IMU device.

There are different algorithms to do that. Examples of AHRS algorithms are Madgwick and Mahony algorithms. They will provide you with quaternion and Eurler angles which can easily help you identify the orientation of the vehicle at any time.

This is a cool video of AHRS algo running in real time.

Similar question is here.

EDIT

Without Mag data, you won't get high accuracy and your drift will increase over time.

Still, you can perform AHRS on 6DoF (Acc XYZ and Gyr XYZ) using Madgwick algorithm. You can find an implementation here. If you want to dive into the theory of things, have a look at Madgwick's internal report.

Kalman Filter could be an option to merge your IMU 6DoF with GPS data which could dramatically reduce the drift over time. But that requires a good understanding of Kalman Filters and probably custom implementation.