-
Notifications
You must be signed in to change notification settings - Fork 313
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
Respect heading while walking #2215
Conversation
When rerouting a pedestrian, avoid restricting the route’s initial heading, since pedestrians can turn on a dime. Cleaned up an argument label.
Both RouteController and LegacyRouteController can store a heading, so now the Router protocol requires it publicly. Fixed an issue where RouteController ignored heading updates.
Prefer the heading over the course when reorienting the camera while walking. Added a heading argument to the method for transitioning the map camera and documented the method. The existing method signature without the extra argument was undocumented but used in examples, so it has been retained in deprecated form.
Is there currently a workaround like rotating the arrow dependent of the user location heading? Or is it not possible to change the arrow orientation from outside the box? |
Do you think this should also be applied to bikes? |
There isn’t currently a workaround, but this PR implements this behavior out of the box. Feel free to check out this branch and try it out – let us know what you think.
Not really, because I think it’s a bit of a sledgehammer specific to walking. A pedestrian on foot has a turning radius of 0 and can turn on a dime, whereas a cyclist may need to find a good place to turn around. Also, I’d be annoyed if I saw the map wiggle around to match my handlebar as I struggle to get going. 😅 I think there will be some opportunities for rerouting heuristics that benefit cyclists as well as pedestrians, but it probably will be orthogonal to using the magnetometer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! one comment.
.rawLocationKey: rawLocation, //raw | ||
] | ||
userInfo[.headingKey] = heading | ||
userInfo[.rawHeadingKey] = heading // heading snapping not yet implemented (an unnecessary?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAGNI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get rid of rawHeadingKey
, but that could be problematic if we ever do need to implement heading snapping for some reason. We’d want the non-raw
values to be snapped when a raw
value is available. That said, the comment refers to the prospect that heading snapping may not be especially useful.
Blocked by #2319 |
Closing this PR in favor of #3620. |
This PR contains these user-facing improvements to walking navigation:
and these developer-facing improvements:
RouteControllerNotificationUserInfoKey.headingKey
to the user info dictionary ofNotification.Name.routeControllerWillReroute
,Notification.Name.routeControllerDidReroute
, andNotification.Name.routeControllerProgressDidChange
notifications. Core Location treats heading as first-class state instead of subordinating it under location, because heading updates from the magnetometer come in at a different rate than location updates from the GPS receiver.heading
, so now the Router protocol requires it publicly. (Also fixed a latent issue where RouteController ignored heading updates. This issue didn’t matter previously because nothing was usingRouteController.heading
.)NavigationMapView.updateCourseTracking(location:camera:animated:)
method in favor of a publicly documentedNavigationMapView.updateCourseTracking(location:heading:camera:animated:)
argument to the method for transitioning the map camera. (The existing method signature without the extra argument was undocumented but used in examples, so it has been retained in deprecated form.)The user’s mode of transportation is determined by the current step’s
transportMode
, which is generally based on the routing profile but can be something else liketrain
orferry
for walking and cycling routes. The improvements above affect only the walking transport mode.To recap and to do:
Fixes #1942.
/cc @mapbox/navigation-ios @d-prukop