You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let should_advance_waypoint = ifletSome(waypoint) =
remaining_waypoints.first(){let current_location:Point = snapped_user_location.coordinates.into();let next_waypoint:Point = waypoint.coordinate.into();// TODO: This is just a hard-coded threshold for the time being.// More sophisticated behavior will take some time and use cases, so punting on this for now.
current_location.haversine_distance(&next_waypoint) < 100.0}else{false};
Note this is especially problematic in light of #285. Solving #285 without first addressing this Waypoint arrival logic would mean "completing" the trip too early in my case.
Proposed Solution
My first attempt at "more sophisticated behavior" is not all that sophisticated:
#[derive(Debug,Copy,Clone)]#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]#[cfg_attr(feature = "wasm-bindgen", derive(Deserialize,Tsify))]#[cfg_attr(feature = "wasm-bindgen", tsify(from_wasm_abi))]pubenumWaypointAdvanceMode{/// Automatically advances when the user's location is close enough to the [`Waypoint`]#[cfg_attr(feature = "wasm-bindgen", serde(rename_all = "camelCase"))]DistanceToWaypoint{/// Distance to the waypoint, measured in meters, at which to advance.distance:u16,/// The minimum required horizontal accuracy of the user location, in meters./// Values larger than this cannot trigger an advance.minimum_horizontal_accuracy:u16,},}implDefaultforWaypointAdvanceMode{fndefault() -> Self{WaypointAdvanceMode::DistanceToWaypoint{distance:100,minimum_horizontal_accuracy:10,}}}
pub struct NavigationControllerConfig {
/// Configures when navigation advances to the next step in the route.
pub step_advance: StepAdvanceMode,
+ /// Configures when navigation advances to the next Waypoint in the route.+ pub waypoint_advance: WaypointAdvanceMode,
...
}
The text was updated successfully, but these errors were encountered:
Yeah, I think this is a good idea. Thanks for the thorough write-up! I'd welcome a PR for it (sounds like you're working on one based on the commits).
You can also have a look at RouteDeviationTracking, which is quite similar structurally, but also adds a custom variant with arbitrary user-supplied logic. We should probably do this for StepAdvanceMode too (idk why I didn't think of that earlier). I think that'd minimally solve every conceivable problem by providing hooks for arbitrary logic app-side. And of course we can always refine the defaults, built-in behaviors, etc.... "Ship sane defaults, but keep it flexible" is my north star.
When a
RouteStep
should be considered complete, is a question answered by StepAdvanceModeSimilarly, we should have a way to customize arrival logic for
Waypoint
- currently it's hardcoded to "within 100 meters".https://github.com/stadiamaps/ferrostar/blob/adb74ca72fc749a8c0960d4fdd84ea539aee89dd/common/ferrostar/src/navigation_controller/mod.rs#L120C1-L130C27
Note this is especially problematic in light of #285. Solving #285 without first addressing this Waypoint arrival logic would mean "completing" the trip too early in my case.
Proposed Solution
My first attempt at "more sophisticated behavior" is not all that sophisticated:
The text was updated successfully, but these errors were encountered: