Sensory fusion of accelerometer and gyroscope in 3D unity

I am trying to use my phone as a pistol aimed at a gyroscope. I will calibrate my phone or tablet in a specific orientation. This will shoot straight. Then, depending on the direction of rotation of the phone (left / right / up / down), the gun fires in that direction.

I am using a gyroscope. And it all works. Except for firing for about 30 seconds, the gyroscope slowly starts to drift left or right. So when I go back to the orientation that I have calibrated it no longer fires. Does anyone have experience writing an additional or Kalman filter to plan the gyroscope and accelerometer data to give better results in Unity 3D?

I found this online - http://www.x-io.co.uk/open-source-ahrs-with-x-imu/ . I seem to be doing exactly what I want. But I am using it wrong. I get better someday and sometimes get worse results. Anyone have any experience?

+3


source to share


1 answer


First, the gyroscope / accelerometer fusion will stabilize your tilt / tilt angles as gravity indicates which direction the earth is in. However, you cannot fix the "left / right" drift because the actual heading is unknown. Obtaining correct heading stabilization cannot be achieved with a gyroscope / accelerometer alone: ​​it requires additional information.

The example you provide (Madgwicks MARG / IMU filter) is a filter that can integrate magnetometers (north link), but it has two requirements to get good results:



  • The magnetometer has been correctly calibrated.
  • There are no magnetic field disturbances. This is usually not true if you are indoors or near power lines or metal structures.

An alternative is to use the video signal to get information about the optical flow, or detect if the phone is resting in a fixed position to compensate for gyro distortion from time to time.

0


source







All Articles