-
Notifications
You must be signed in to change notification settings - Fork 47
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
Get accuracy of compass #4
Comments
@draperunner But if you DO know that it needs calibration, is there a way to calibrate it via the api ? It seems no-one has dealt with this problem. For the longest time I'm getting no answer here: https://stackoverflow.com/questions/50178675/how-can-i-calibrate-the-compass-with-a-native-react-api |
@pashute If you have the compass accuracy, you know the compass has been calibrated when its accuracy is high again. You could show the calibration instruction figure while the accuracy is below your chosen threshold. |
I don't understand your answer. Why will the accuracy go back up? Just by
me waving the phone in a figure 8?
Actually I'm showing my ignorance here. In the first place how does the
magnetometer know that it is inacurate?
בתאריך יום ד׳, 5 בספט׳ 2018, 14:05, מאת Mats Byrkjeland <
[email protected]>:
… @pashute <https://github.com/pashute> If you have the compass accuracy,
you know the compass has been calibrated when its accuracy is high again.
You could show the calibration instruction figure while the accuracy is
below your chosen threshold.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABsSM4SLfbv59XdDztchbhs-KMrA-C-Oks5uX6_egaJpZM4Q2M4i>
.
|
Yes. By moving your phone around like that, the compass will get calibrated automatically, without having to manually start a calibration process. Here's a good explanation of why it works: https://android.stackexchange.com/a/30341 |
and how does it know that it is out of calibration?
…On Thu, Sep 6, 2018 at 11:47 AM Mats Byrkjeland ***@***.***> wrote:
Yes. By moving your phone around like that, the compass will get
calibrated automatically, without having to manually start a calibration
process. Here's a good explanation of why it works:
https://android.stackexchange.com/a/30341
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABsSM7eYbG136U9RSnJe7sHlVtQIfJDVks5uYOEIgaJpZM4Q2M4i>
.
|
I exposed the headingAccuracy on ios. I got a reading of 25 and sometimes 35. Nothing in between. Walking 35 mins in a city. When major disturbances in magnetic field occurred it was not reflected in the accuracy value in any way. |
In order to check whether the user needs to recalibrate the compass or not, it would be nice to get some information about the accuracy of the measurements.
It seems like
newHeading.headingAccuracy
on iOS andpublic void onAccuracyChanged(Sensor sensor, int accuracy)
on Android are the ways to get the accuracy. This could for instance be sent as a second parameter in the event handler callback:RNSimpleCompass.start(degree_update_rate, (degree, accuracy) => { ...
A problem is that "accuracy" is not the same thing on iOS and Android... Android uses four integer values, while on iOS uses floating point values that might be negative.
An alternative to getting the accuracy value is to dispatch an event when the compass is giving an invalid value, and will probably need calibration. This is when the accuracy is negative on iOS or 0 on Android.
What do you think?
The text was updated successfully, but these errors were encountered: