The device will be an Android phone with standard gyroscope / accelerometer. With those two sensor types, is it possible to satisfy the above requirements?
My thoughts so far: An accelerometer alone cannot achieve this, since given any set of values for an instant in time, it is not possible to separate the gravitational and spacial acceleration components. And I can't get my head round how a gyroscope could help resolve that. Are there any clever formulas / algorithms which would manage this?
Thanks
Roll is rotation on the X-axis, which means the object is rotated to the right or left: If the accelerometer is tilted right, the roll will be a positive angle (between 1° to 180°). If the accelerometer is tilted left, the roll will be a negative angle (between -1° to -180°).
A gyroscope is a device that uses Earth's gravity to help determine orientation. Its design consists of a freely-rotating disk called a rotor, mounted onto a spinning axis in the center of a larger and more stable wheel.
Combining 3D accelerometers and gyroscopes This can be accomplished with a sensor fusion strategy. Sensor fusion techniques combine sensory data from disparate sources and generate information that has less uncertainty, or more accuracy.
Accelerometer Versus GyroscopeAccelerometers measure linear acceleration (specified in mV/g) along one or several axis. A gyroscope measures angular velocity (specified in mV/deg/s). If we take our accelerometer and impose a rotation to it (i.e., a roll) (Figure 8), the distances d1 and d2 will not change.
An easy way to combine accelerometer and gyroscope data is by the use of a complementary filter. This way, you don't have problems with drift from the gyroscope and noise from the accelerometer. It is also much easier to understand and use than a Kalman filter.
You will calculate the angle from the gyroscope using an integral. And for the accelerometer you will use a tan2 function to determine the position of the gravity vector. The complementary filter would then combine these two angles as follows:
angle = 0.98*(angle + gyroData*dt) + 0.02*accAngle
Notice how you only take a fraction of the accelerometer data (just enough to compensate for the drift). You will thus use the gyroscope data for fast changes, but on the long run, you will keep following the mean value of the accelerometer angle calculation so that you don't drift.
I hope this helps. If you need more info and a C code example, I wrote an article about it here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With