feat(mobile): jitter-resistant step advance via entry+exit condition - #66
Merged
Conversation
Switches Ferrostar's stepAdvanceCondition from DistanceToEndOfStep (single 10m threshold) to DistanceEntryAndExit (30m entry + 5m exit). The user must enter the zone near the maneuver and then travel past it before advancing, which prevents premature advance from GPS jitter near intersections. Values follow the Ferrostar docs' recommended defaults; route deviation tracking still catches users who skip a maneuver entirely.
The arrival flow in map_screen.dart waits for TripStatus.complete to play "you have arrived" TTS, fire haptics, switch the camera to arrived mode, and show ArrivedSheet. Ferrostar only emits .complete after the final step advances, which with stepAdvanceManual() requires an explicit advanceToNextStep() call. Nothing in the repo ever calls that, so arrival never fired. Switch arrivalStepAdvanceCondition to stepAdvanceDistanceToEndOfStep (30m, matching the Ferrostar docs' recommended default) so the trip auto-completes when the user reaches the destination and the existing arrival UI runs.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes to Ferrostar's
NavigationControllerConfigin packages/ferrostar_flutter/ios/ferrostar_flutter/Sources/ferrostar_flutter/Serialization.swift:1. Jitter-resistant step advance
Switch
stepAdvanceConditionfromDistanceToEndOfStep(single 10m threshold) toDistanceEntryAndExit. The user must enter the zone near a maneuver and travel past it before the step advances, which prevents premature advance from GPS jitter at intersections.Values lifted from the Ferrostar docs' recommended defaults. Users who skip a maneuver entirely still get rerouted via the existing
routeDeviationTracking.2. Fix: arrival screen never fired
While reviewing the config, found that
arrivalStepAdvanceCondition: stepAdvanceManual()was preventing the arrival flow from ever running. The app's map_screen.dart:367 listens forTripStatus.completeto play "you have arrived" TTS, fire haptics, switch the camera to arrived mode, and showArrivedSheet. WithstepAdvanceManual(), Ferrostar's final step never advances on its own — it requires an explicitadvanceToNextStep()call, which nothing in the repo makes.Switched to:
Now
TripState.completefires automatically when the user reaches the destination, driving the existing arrival UI.Test plan
just dev-ios-device <DEVICE>and ride a route with several turns; verify steps advance just past each maneuver, not before