diff --git a/cardinal-android/app/src/main/java/earth/maps/cardinal/routing/FerrostarWrapper.kt b/cardinal-android/app/src/main/java/earth/maps/cardinal/routing/FerrostarWrapper.kt index 34920236158a1a9b18ba7eb7756545e751435691..e37001da42d6c2f55fd1c82847e207a770e9294b 100644 --- a/cardinal-android/app/src/main/java/earth/maps/cardinal/routing/FerrostarWrapper.kt +++ b/cardinal-android/app/src/main/java/earth/maps/cardinal/routing/FerrostarWrapper.kt @@ -121,11 +121,11 @@ class FerrostarWrapper( httpClient = OkHttpClientProvider(OkHttpClient()), locationProvider = locationProvider, navigationControllerConfig = NavigationControllerConfig( - waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0), - stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u), - arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u), - routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0), - snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE + waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE), + stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()), + arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()), + routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION), + snappedLocationCourseFiltering = COURSE_FILTERING ), foregroundServiceManager = foregroundServiceManager, ) @@ -152,14 +152,27 @@ class FerrostarWrapper( httpClient = OkHttpClientProvider(OkHttpClient()), locationProvider = locationProvider, navigationControllerConfig = NavigationControllerConfig( - waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0), - stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u), - arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u), - routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0), - snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE + waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE), + stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()), + arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()), + routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION), + snappedLocationCourseFiltering = COURSE_FILTERING ), foregroundServiceManager = foregroundServiceManager ) core.spokenInstructionObserver = androidTtsObserver } + + companion object { + const val WAYPOINT_ADVANCE_RANGE = 100.0 + const val STEP_ADVANCE_DISTANCE_TO_END = 30u + const val STEP_ADVANCE_DISTANCE_AFTER_END = 5u + const val STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u + const val ARRIVAL_STEP_ADVANCE_DISTANCE = 30u + const val ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u + const val ROUTE_DEVIATION_MINIMUM_ACCURACY = 15u + const val ROUTE_DEVIATION_MAX_DEVIATION = 50.0 + val COURSE_FILTERING = CourseFiltering.SNAP_TO_ROUTE + + } }