-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Implement Responsive User Location Tracking Mode #2049
Comments
Could it be added as an annotation? |
@bleege Is the issue that there is too many events? |
i made a lowpass filter in #1968 which could be used |
in addition to some minimal time / angle diff |
I think you should move out the setDirection call from updateMap to the onCompassChange event. |
Yes. |
@bleege How does iOS handle that? |
Exactly. We need to put a regulator / distance filter on updates to location or specifically that a certain amount of distance / time needs to elapse before updating the dot on the map. |
I was getting confused between location/GPS events and map position change events. |
In #2409 I'm cleaning up the |
Have you tried sampling input/direction (I've used a constant rate of 15-20 times per second, but we could likely go lower) instead of trying to process or filter all events? I've done this in the past for handling user input from a gyroscope and accelerometer more smoothly in JavaScript, where it was previously choking on large bursts of minor change events. Sample code at https://github.com/mikemorris/gyrocopter/blob/master/gyrocopter.js |
Hmm I might have accidentally removed the user tracking stuff in #2002, but the code is still there in git history so perhaps we can have a go at making it really good this time. Lets start with just location/GPS (and heading?) tracking and work on compass after. Should we also hit the UI side of getting our GPS dot looking better? |
Im thinking we eventually want a few modes (start with first two):
Also do we make touch events cancel tracking (separate for rotation and pan events). Or leave that up to the app via the listening events. |
Discussed with @bleege, |
I'm working on this again, because I have noticed 2 bugs on current progress that need to fixed asap |
To clarify above:
|
The new camera API from @bleege will help resolve remaining issue on this ticket: #3396 contains the fix for animated location updates with user tracking mode enabled. Todo list to close this issue:
|
Is this working correctly now? Currently when I try to set up tracking in the onCreate it draws the blue marker in the top left corner, digging through the code on git I found that this was because the position of the marker is being set relative to the mapview by dividing width and height by 2 (height and width would be 0 while onCreate is being called). I altered my code to include a button I could press to start tracking in order to bypass the problem, however even though the screen is centred on the correct position, the blue dot does not draw to the screen. In the UserLocationView class and in the update method, why are you setting the blue marker position by dividing the screen/height width by 2 to find the centre point of the screen. Why not use the latitude and longitude to draw the marker like you would with a regular addMarker call or a screen centre? If the code even worked properly, wouldn't moving around the map with user input reposition the blue dot in the wrong place i.e. keep it in the centre of the screen no matter where the user navigates to on the map? |
@Buckley404, reading through your comment I believe you are using the incorrect method. If you want the user location to show on the map in similar fashion as a marker you should call nMapView.setMyLocationEnabled(true); instead of: nMapView.setMyLocationTrackingMode(MyLocationTrackingMode.TRACKING_FOLLOW); Let me know if you have any other questions. |
One thing I need to add to this is that current |
Thanks again @tobrun, I'll recheck my code after work however I think I was using both methods. I must have just confused myself. FYI google might just be setting minimum thresholds for when the compass should be affected by gyro. |
@Buckley404 I have been trying to mimic their behaviour for quite some time and I now believe that Google is doing something different than just using the sensors as we are doing. |
The User Location tracking mode (None, Follow, Bearing) was disabled in #1856 as the User Location dot was being updated on the main UI thread. The core logic is there, but it needs to be implemented in a more efficient way so that the UI remains responsive.
/cc @erf
The text was updated successfully, but these errors were encountered: