Using Android gyroscope instead of accelerometer. I find lots of bits and pieces, but no complete code

前端 未结 2 1940
猫巷女王i
猫巷女王i 2020-12-23 14:51

The Sensor Fusion video looks great, but there\'s no code: http://www.youtube.com/watch?v=C7JQ7Rpwn2k&feature=player_detailpage#t=1315s

Here is my code which jus

2条回答
  •  一生所求
    2020-12-23 15:32

    To the question where to find complete code, here's a default implementation on Android jelly bean: https://android.googlesource.com/platform/frameworks/base/+/jb-release/services/sensorservice/ Start by checking the fusion.cpp/h. It uses Modified Rodrigues Parameters (close to Euler angles) instead of quaternions. In addition to orientation the Kalman filter estimates gyro drift. For measurement updates it uses magnetometer and, a bit incorrectly, acceleration (specific force).

    To make use of the code you should either be a wizard or know the basics of INS and KF. Many parameters have to be fine-tuned for the filter to work. As Edward adequately put, these guys are doing this for living.

    At least in google's galaxy nexus this default implementation is left unused and is overridden by Invense's proprietary system.

提交回复
热议问题