-
Notifications
You must be signed in to change notification settings - Fork 7
Normalizer
A phone may be oriented differently in space. Like this:

or like this:

The values of sensors will be different for those two cases. Taking into account the gravity of Earth, the accelerometer sensor will show (x: 0, y: 1: z: 0) in the first case and (x: 0, y: 0: z: 1) in the second. Normalized value should show (x: 0, y: 0: z: 1) in both cases. The algorithm will find out current orientation of the phone relative to the ground and rotate axes.
For gyroscope the same rule must be applied. Whenever the phone rotates, the algorithm will show rotation relative to the ground, no matter what angle the phone has.
The data will be normalized to the following state:
- Z - is the axis perpendicular to the Earth, positive vector is directed to the center of Earth
- Y - is the axis parallel to the Earth. Positive vector direction equals the direction of car speed vector
- X - is the axis parallel to the Earth. Positive vector is perpendicular to the Y vector (car direction) and has 90 degrees angle clockwise relative to it.
At the first glance, the algorithm must not always try to adapt to the changing position of a phone. It should correct the position once in a time and then just fix it for a while. Otherwise any acceleration will cause the algorithm to change its vectors.