-
Notifications
You must be signed in to change notification settings - Fork 318
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
User course view lurches to the side when performing a maneuver #1949
Comments
This suggested solution makes sense at tight maneuvers, but per team conversation this might not make sense on curvy roads where we sometimes see a similar issue. We're currently not sure that this suggested solution fixes the root problem. Next steps are for @frederoni & @JThramer to dig into the problem and see if we have a better idea of the ideal solution for the root problem, for example incorporating additional control points on an adaptive basis. |
In other words, We also see similar behavior along curvy roads, and keeping that setting on wherever the road isn’t perfectly straight would result in poor performance. So @frederoni proposed getting interpolated locations (perhaps using navigation-native or Turf), so that we aren’t so dependent on the granularity with which the road has been mapped. That would also address #1908, where we spin the camera the wrong way when making a fast sharp turn – frame-by-frame positioning itself won’t help because the shortest path around a circle still goes the wrong way. At its core, the problem here is about screen coordinates rather than geographic coordinates, so any approach based on |
mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift Lines 270 to 273 in 64f07b7
But we don’t want to affect the map’s frame rate in doing so: mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift Lines 292 to 297 in 64f07b7
Similar to #1731, we never want UIView animation when the camera changes due to course tracking. It would be ideal if we could just do this whenever the course changes:
But unfortunately, due to the lack of concurrent animations in the map SDK, that would preempt any desirable animations used to interpolate between location updates: mapbox/mapbox-gl-native#3625 (comment). Interpolating locations won’t actually help with the specific scenario above, at a standard turn, because the location is more or less atomic. What’s changing is the course, so we’d need to interpolate course updates. UIView animation would still be a fallback for when there isn’t enough course interpolation. |
I did a quick route following test with UIView animations disabled and positioning the course view on a frame by frame basis at all time including puck transformations. The interpolation is a little jumpy once per second and the unsynchronized transformation makes the puck look like a motorcycle leaning in the corners, but the puck never leaves the route line by a single pixel.
This could potentially simplify things but I think the camera and puck would look very static. |
NavigationMapView.shouldPositionCourseViewFrameByFrame
keeps the user course view (puck) constrained to the map on each frame, but it only ever seems to be enabled in response to external changes to the map view rather than internal changes due to location updates. When this property was originally added in #402, the idea was that the map would lasso the puck and force-synchronize it with the map on each frame, rather than allowing it to roam free using its normal 1-second animation, in response to location updates. At some point, this distinction was lost.As a result of this omission, as the route takes a right turn, we send the puck to the right based on where the next location along the cross street is currently displayed on the map. That movement is animated with a duration of 1 second. But at the same time, we kick off a 1-second-long camera animation that rotates the map to look down the cross street. The effect is that the puck appears to lurch to the right before swinging back to the center of the map to meet the route line. This effect is exacerbated by the route simulation feature’s speedup factor, if specified.
At a glance, the fix appears to be simple: we already correctly synchronize the puck to the map when
NavigationMapView.shouldPositionCourseViewFrameByFrame
is enabled, but we need to enable that property viaNavigationMapView.enableFrameByFrameCourseViewTracking(for:)
when approaching a maneuver. There’s some existing logic along these lines, but it only adjusts the map view’s frame rate rather than keepingshouldPositionCourseViewFrameByFrame
enabled:mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift
Line 273 in 9e83261
mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift
Lines 295 to 296 in 9e83261
/cc @mapbox/navigation-ios
The text was updated successfully, but these errors were encountered: