Hi there,
GyroscopeNoiseFilter (previously: JitteryGyroFixForCardboard) is a module to reduce/eliminate the noise in unstable gyroscope that are found in some phones like the Moto G 2nd gen or Huawei Ascend G7. Basically, the app does the noise smoothing that app devs do, but here this module uses a system hook to apply the noise smoothing preprocessing for all apps, but the main goal here is specifically to remove jitter, not drift (although the filters may help, but there's no sensor fusion, yet).
This is particularly interesting for virtual reality (VR) or head-tracking apps because a noisy gyroscope will produce a feeling of dizzyness and nausea, but this can also be interesting for any app using the gyroscope because the output will be a lot smoother and accurate (particularly when the phone is held still).
The module was originally wrote by Kjos and the repo lives here:
https://github.com/Kjos/XposedJitteryGyroFix
The thread that started the module is on Reddit:
https://www.reddit.com/r/GoogleCardboard/comments/335ins/fix_for_jittery_gyroscopes_such_as_moto_g
Here is the latest version of the module, v1.4 (also attached to this thread):
https://github.com/lrq3000/XposedJitteryGyroFix/releases/download/v1.4/GyroscopeNoiseFilter_v1.4.apk
The module is also available directly from the Xposed repo:
http://repo.xposed.info/module/net.kajos.gyronoisefilter
=== DESCRIPTION ===
The gyroscope is the main sensor for head tracking / virtual reality apps.
However, it's common for phones' gyroscopes to be noisy, which in practice shows as jitter, and this can create a dizzyness feeling and nausea, particularly when standing still (the "camera" still moves around just like if you were at sea).
Android now offers "virtual" sensors, which use a method known as sensor fusion to avoid those noisy outputs by combining several sensors (usually: gyroscope, accelerometer, magnetometer).
However, it's up to each app dev to use these virtual sensors, and to implement further post-processing to smooth the sensor and reduce the noise.
This module adopts another approach: it hooks directly to the hardware gyroscope and it preprocess every outputs with smoothing filters before relaying the data to the apps.
Therefore, the noise is reduced or even eliminated of the gyroscope's output for every apps.
=== OPTIONS ===
This module currently implements a few different strategies to filter and reduce noise, which can be used complementary or alone (each option can be disabled):
1. Filter type: type of the filter that will be applied to reduce noise in the gyroscope output.
2. Filter size: the number of samples to use to compute the filtering. Usually, the bigger the filter is, the less jitter there will be but at the expense of some lag.
3. Filter optional value: value of the constant that configures some types of filters such as lowpass or additive smoothing.
4. Minimum value change threshold: prevents the phone from registering the new sensor's values if the difference to the median is smaller than the given threshold.
5. Stationary minimum value threshold: when stationary, prevents the sensor from moving if the change is below the given threshold (this is similar to min value change but here it only affects the stationary state, when you are not moving).
6. Rounding precision: round all sensor's values to the given decimal.
Options can be changed on-the-fly without having to restart the phone, and are instantly applied to the sensor, so that you can switch between this option screen and a VR app to test for the parameters that reduce the jitter the most for you.
Click to expand...
Click to collapse
I'm looking for feedback before we submit to the Xposed repo, so if you have any idea of a feature or if you spot a bug, feel free.
We are also looking for better filters, currently the best performing two types are the median filter and the one order low-pass filter, so if there's someone with some experience with noise reduction on the gyroscope (not the accelerometer), I'd be very interested to get some advices about that!
/EDIT: update v1.4.
Also, we found a great opensource app called GyroscopeExplorer (kudos to the dev) which implements all kinds of sensor fusion and with a very good documentation, so that's a great source of info to implement advanced filters, but, although they smooth the movement's noise and drifting issues, they do not fix jitter at all, so for the moment we won't implement these advanced filters. We are now focusing on supporting more apps, particularly the ones using the new Cardboard NDK API to access virtual sensors (this bypasses the usual SensorManager).
Sorry, I forgot to attach the APK directly to the thread, like it's usually done around here. That's now done.
Very interesting module.
I wonder if this would give better results when doing Photospheres with the Google Camera app.
Also, does this have any meaningful impact on cpu usage and battery draining ?
thanks!
edgrd said:
Very interesting module.
I wonder if this would give better results when doing Photospheres with the Google Camera app.
Also, does this have any meaningful impact on cpu usage and battery draining ?
thanks!
Click to expand...
Click to collapse
I never made Photospheres with the Google Camera app, but if it uses the Gyroscope and you experience some jitter, then the module should help yes.
About CPU, the module is quite light on resources. The exact usage mostly depends on the filter type and filter size, with the low-pass filter being the lightest on CPU (only a few additions and multiplications, so it's negligible). All the other options such as the "minimum value change" only do a single calculation so their CPU usage is also negligible. However, if you use the mean or median filters and with a big filter size (like 1000), you may notice a very very small CPU usage, but it will still be very low (the time of a summation over an array of the size you specified, so it's not that big).
I have experienced some small (but still perceived) input lag using the default filter (median), switching to the lightest one and decreasing filter size to 8 fixed it
Would be nice if this module was presented more as an improvement / upgrade to the default gyroscope output, other than a simple fix
And after the app matures a little bit, you could make it available on the Play store too, so more people get this benefit
thanks again :good:
Good idea, but I can’t make head or tail of it. Maybe you ought to include simple preset/config… (sophisticated, uniform, simple & powerful, extreme…etc.), so that punters with Cardboards don’t spend a week scratching their heads on figuring out values, stationary thresholds and precisions.
I get nauseous using both DK2 and smartphone HMDs - don’t know if it’s me or noisy gyroscopes.
Thank's for the feedback everyone
@edgrd: yes the median filter smoothes the gyroscope more but it adds a delay proportionally to the filter's size. The low-pass filter does not add any perceptible delay, and the filter size does not matter (it only uses the previous gyroscope's value, so the filter size is always 1. I have yet to find the calculation for a bigger low-pass filter - but it works already very well as it is).
Indeed this is more an improvement now than a fix, that's why we renamed the app now to GyroscopeNoiseFilter
@Lord Childe: thank's for the idea of presets, I thought about that but however I can't think of a way to provide presets, since the values you set entirely depends on your own gyroscope's values. So for the moment, it is advised to just try out different values and you can switch back and forth to a VR app of your choice to instantly see the effect. Maybe we could do some kind of automatic calibration (eg, don't move your smartphone for a few seconds and this will automatically detect the values of the jitter).
Personally, on my Huawei Ascend G7, I use the low-pass filter and the stationary minimum value change set at 0.2. All the others are at default. And yes, this helps greatly to reduce the nausea for me (because when the phone still moves while you are standing still, this produces a feeling similar to being sea-sick).
Does not work on Cyanogenmod 12.1 Moto G 2nd Gen
Hi folks,
Tried to get it working on my Moto G 2nd Gen running Cyanogenmod 12.1. I can set the values but the Google Cardboard app does not seem to be taking the filtered values.
I tried running the Gyroscope Explorer app and if I enable Mean Smoothing, the app (Gyroscope Explorer) shows smooth values. But still has no effect on the cardboard app.
arindammanidas said:
Tried to get it working on my Moto G 2nd Gen running Cyanogenmod 12.1. I can set the values but the Google Cardboard app does not seem to be taking the filtered values.
Click to expand...
Click to collapse
Yes indeed, this is the issue we are currently working on. It seems that there are currently two ways to get the head's position: using SensorManager/SystemSensorManager, or using the Cardboard SDK's own method. The latter seems to completely bypass the SensorManager, which is the usual way of accessing the gyroscope's values. Most cardboard's apps are still using the SensorManager to access the gyroscope, so for these apps, our module works correctly. But for newer cardboard's apps using the Cardboard SDK orientation provider, our module does not work.
This is a pretty tough problem, and I never developped a Cardboard's app. If someone with experience with developping a Cardboard app can give some help with some advices, this would really help us a lot!
We just updated the module, Arindammanidas. Please try the latest version (v1.5) and see if this fixes your issue:
http://repo.xposed.info/module/net.kajos.gyronoisefilter
https://github.com/lrq3000/XposedJitteryGyroFix/releases/tag/v1.5
If it doesn't fix your issue, please tell us what app and what version doesn't work with our module. We are aware that there are still a few apps that may not work, in particular Cmoar Cinema Pro v4.3 (but version Free is OK). We don't yet know why (the source is closed).
/EDIT: we narrowed down the issue, and it seems that only apps using Unity3d along with the Durovis Dive SDK for head tracking are not supported. It seems it's because they use their own native library to manipulate the sensors, so I'm not sure we can do anything about these apps...
I just uninstalled Xposed! I'll flash it back and report! Thanks a lot.
lrq3000 said:
We just updated the module, Arindammanidas. Please try the latest version (v1.5) and see if this fixes your issue:
http://repo.xposed.info/module/net.kajos.gyronoisefilter
https://github.com/lrq3000/XposedJitteryGyroFix/releases/tag/v1.5
If it doesn't fix your issue, please tell us what app and what version doesn't work with our module. We are aware that there are still a few apps that may not work, in particular Cmoar Cinema Pro v4.3 (but version Free is OK). We don't yet know why (the source is closed).
Click to expand...
Click to collapse
Hi, I tried out version 1.5 and it still gives me jitters in the google cardboard app demos. Probably the cardboard app is reading from somewhere else?
Which google cardboard app? Do you mean the treasurehunt? Normally, treasurehunt is supported. Is it another app you are talking about?
lrq3000 said:
Which google cardboard app? Do you mean the treasurehunt? Normally, treasurehunt is supported. Is it another app you are talking about?
Click to expand...
Click to collapse
I was talking about the demos on the cardboard app itself. When you open the Google Cardboard app, you have an option for some demos e.g. Windy Day, Google Earth etc.
These still have jitters.
You're correct, I totally forgot about those demo apps and I didn't try them. We will see what we can do. Thank you for the feedback.
Is there any way to reduce drift when using photosphere or taking panorama photographs in Google camera?
Hello, I have a 'lenovo k3 note "with android 5.0.1, this phone has no physical gyroscope, makes a software simulation using other sensors.
I've been playing some value to your program and seems to improve a bit, but keeps moving image when this stop.
I can change the way you treat the sensor data? Even without one hardware.
Moto G 2014
For those with a Moto G 2nd generation, what are your settings?
Dear developers.
Is it possible to put an inversion of some of the axes in this module?
Some Chinese smartphones (for example ZOPO ZP998, iOcean x8), the gyroscope's axis is inverted, and the manufacturer ignores requests to fix it.
AKSU78 said:
Dear developers.
Is it possible to put an inversion of some of the axes in this module?
Some Chinese smartphones (for example ZOPO ZP998, iOcean x8), the gyroscope's axis is inverted, and the manufacturer ignores requests to fix it.
Click to expand...
Click to collapse
Wow, I was about to post the same because I was impressed someone managed to change gyroscope values. Yes, I have the same problem, my spanish smartphone comes with the X axis inverted, so the sensor fusion makes strange things (gyroscope and magnetometer/accelerometer read oppossite values), although I think this could be another app instead of adding it to your noise filter one (because in my phone there's no jittery, only a changed axis. It could be solved by the developers, but at this time there's no patch).
Thanks a lot!