I’m using Compass to set the yaw of a camera on iOS. It’s working, but the precision of the heading readings are 1 degree. This results in “notchy” rotation.
iOS supports getting finer resolution for the heading via the headingFilter property on CLLocationManager. In a test iOS app, I set this to 0.1, and get heading values every 0.1 degree instead of the default 1 degree.
Is there a way to set this in Unity? Alternatively, I thought I could create a patch for the generated Xcode project. Is there an easier way to configure platform specific things like this?
I have not tried it… but maybe you can use the “raw” values:
And to get better stabilisation… my thinking is, maybe, to also use the gyro:
Maybe with low pass filtering on the compass, and high pass filtering on the integrated gyro value.
A offset in the gyro heading will be canceled by the high pass filtering.
A Linkwitz–Riley filter will probably give a reasonable flat response, when adding them together.
I’ve looked at the raw values, but they’re noisy and I haven’t yet come up with a way to interpret them. But it’s certainly worth a look.
Yes, we’re using the gyro to control a camera and are trying to mitigate gyro drift on the yaw axis. I haven’t heard of the Linkwitz–Riley filter, thanks! A lot of folks talk about using Kalman or complementary filters to fuse accelerometer and gyro data.
I’m going to try to make a small Unity plugin to get access to the higher resolution magnetometer heading. I’m seeing that value drift my iphone too, but more slowly than the gyro drift.