-
Notifications
You must be signed in to change notification settings - Fork 103
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
The positioning will be erratic at night #90
Comments
Hi @junyay! Yeah this is an ongoing problem with more recent iOS versions, in that the CLLocations tend to lie dramatically about horizontalAccuracy in some indoor conditions. The location will be 100+ metres from the real location (sometimes several hundred metres or more), but the horizontalAccuracy will be 10-30 metres. Obviously wildly wrong horizontalAccuracy values. Those mess up LocoKit / LocomotionManager's sleep/wake cycles, causing incorrect wakeups and recording of imaginary paths during longer stationary periods (eg at home overnight). Ultimately it needs to be fixed by the Location Services team at Apple, but filing bug reports with them is usually pure futility. So in the meantime I built the Trust Factor system into LocoKit, which is designed to learn when to distrust the reported horizontalAccuracy values. Unfortunately for LocoKit's Trust Factor system to work you need user feedback, marking drifting samples as stationary, then the CoordinateTrustManager needs to be run as a background task each day to update the calculated CoordinateTrust (Trust Factor) values. Have a look at the related code in Arc Mini to get a feel for what's needed. An alternative workaround, until Apple sort it at their end, could be to modify LocomotionManager's |
I'm very appreciative of your response. I'm glad to hear that you have already modified the desiredAccuracy in startSleeping according to my suggestion, and there was no issue of positioning drifting on the first day. If you encounter any other problems in the future, feel free to consult me anytime. I wish you all the best! |
Hello, after several days of testing, we still found that the positioning is unstable. Should we adjust the value of desiredAccuracy to make it more precise? |
Yes you could try forking LocoKit and in your fork edit the |
I have already tried setting it to 100, but the effect was not satisfactory. Maybe I should try a more precise value? |
Hmm. I think if you set it much lower it will impact energy/battery use. I think the next step would be to increase the sample smoothing, to reduce the risk of bad location updates causing wakeups from sleep mode. In ActivityBrain.swift, try changing these lines, by adding 2 to each: internal static let minimumWakeupConfidenceN = 6
internal static let minimumConfidenceN = 4
internal static let minimumRequiredN = 4 So try something like 8, 6, 6. There's also an iOS bug in current iOS versions that causes the Core Location to lie quite dramatically about horizontalAccuracy. For example it will provide CLLocations with horizontalAccuracy of 10, when the location is more than 100 metres from the real location. This iOS bug messes up the maths quite badly! And can persist for several minutes, when it happens. If the above changes don't help, then I suspect you'll be getting hit by the iOS bug. The bug only happens in some locations - typically taller buildings in built up city areas. Unfortunately so far there's nothing we can do to work around that iOS bug. Just have to wait and hope that Apple fix it in an iOS update someday. |
I am currently using pod management, and your ActivityBrain component is not open-source, so I cannot modify its value directly. |
Oh! LocoKit hasn't supported CocoaPods for along time! Or at least, the pods haven't been updated in years. Make sure you're using Swift Package Manager, and pulling from the head of core-ml branch. ActivityBrain and all of LocoKit has been fully open source for several years now. Presumably the last pod update still points to a version before that transition. |
At night, when the phone is in a static state, the positioning will be erratic and deviate more than 100 meters.
The text was updated successfully, but these errors were encountered: