-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compass fluctuation and unstable values. #3
Comments
Please, check the latest commit and test it out to see if the issue still exists. It's been a while I got the chance to look into this project. Also I've posted an answer on Stackoverflow. Please check and accept the answer if it helps. |
The problem is with LPF in the _angle method. When magnetometer's "y" goes from positive values to negative rapidly, the LPF.next() recieves greatly different values. Some close to 0 degrees, some close to 360. So the input to LPF might look somthing like this: 0, 357, 2, 350 etc. It can't keep up. And that's why the image starts to oscillate. |
Any solution for this? how to solve? |
I have introduced hysteresis like behavior into the response. Added the _hysteresis method for that. But I have also changed a few other things, like inside the _angle method I simply return the atan with an angle between -180 to 180. I don't rotate it to be between 0-360. And the subscription is expo based. I have also edited the compass image, so that North is pointing to the right side on it, this way I don't have to rotate it with another 90 degrees inside the code. So don't just copy that one method, cause it won't work like that with original code. :D
This can still become unstable for a second if you turn it around too much. |
it is still the same. even my App hangs after i nevigate to compass |
Is there any method to flush the LPF and start a new when it approaches 0 ? |
Thank you for the compass I was looking for the same. But on the real device, it is getting fluctuated and the values also are unstable. Please help me out. Also tried Low Pass Filter as per the stack solution https://stackoverflow.com/questions/57308560/smooth-orientation-compass-using-react-native-sensorss-magnetometer.
The following added screen is of stable device.
The text was updated successfully, but these errors were encountered: