Modularization
The Navigation SDK for iOS is only available upon request. Contact us to get started.
The architecture of the TomTom SDKs is modular, meaning that each navigation component is independent of the others. As a result, components can easily be replaced with ones from other sources or left out if they are not needed. That makes it easier to change the standard SDK to address a specific use case. These replaceable components are referred to as engines.
Orchestrator
The Navigation module depends on engines to orchestrate a pipeline after each location update. Different engines are used during different parts of the navigation flow, as shown in the following image.
The orchestrator contains two main checks to determine if the calculation should continue or stop for a given location update. After matching a location to the map and providing location context, the pipeline stops if navigation:
- is in free driving mode (there is no route)
- has previously detected a deviation from the route
If none of the conditions are met, the flow proceeds with calculating route progress. If, after this, no deviation has been detected, it will continue to calculate guidance, check for arrival, and replan the route if necessary.
Engines
The orchestrator works with the following engines:
LocationProvider
- Supplies location updates for navigation.MapMatchingEngine
- Improves the accuracy of a position by attempting to match it to a map or a route.RouteReplanningEngine
- Replans routes.GuidanceEngine
- Generates guidance for upcoming road maneuvers.RouteTrackingEngine
- Detects whether the driver is tracking a route.RouteProgressEngine
- Determines the progress made so far along the current route.ArrivalDetectionEngine
- Checks whether the route destination has been reached.
The LocationProvider
is part of the Location module.
All of the other engines are in the Navigation module.
Customized engines can be set during the configuration of TomTomNavigation
:
1let configuration = OnlineTomTomNavigationFactory.Configuration(2 navigationTileStore: try NavigationTileStore(config: NavigationTileStoreConfiguration(apiKey: "YOUR_TOMTOM_API_KEY")),3 locationProvider: customLocationProvider,4 routePlanner: routePlanner,5 routeReplanningEngine: customRouteReplanningEngine,6 guidanceEngine: customGuidanceEngine,7 mapMatchingEngine: customMapMatchingEngine,8 routeTrackingEngine: customRouteTrackingEngine,9 routeProgressEngine: customRouteProgressProviderEngine,10 arrivalDetectionEngine: customArrivalDetectionEngine11)1213let navigation = try OnlineTomTomNavigationFactory.create(configuration: configuration)
The location provider is the only engine that can also be changed and customized after the creation of TomTomNavigation
:
var navigation = navigationnavigation.locationProvider = locationProvider
Navigation snapshot
Navigation session data is passed between different engines and pipeline iterations using the NavigationSnapshot
.
The snapshot doesn’t contain all session data, just what other engines need as input (e.g., the RouteProgressEngine
uses the MapMatchingResult
to calculate the progress along the route). You can see the order that engines use data in the description of the orchestrator.
Because it provides other engines with input data, the navigation snapshot always contains current information about the navigation session, such as current location, matched location, and progress along a route. It is updated whenever new values are available.
The data is divided into the following classes:
LocationSnapshot
- contains information specific to location e.g., theMapMatchingResult
.ConfigurationSnapshot
- the navigation configuration, e.g., theUnitsSystem
used for guidance.Vehicle
- the current vehicle profile.TripSnapshot
- information about the current trip session, e.g., whether the driver deviated from the route or reached the destination.RouteSnapshot
- route-specific data such as theRoutePlan
,RouteProgress
, or visited waypoints.
The current navigation snapshot can be accessed using the TomTomNavigation.navigationSnapshot
property. Note that the snapshot is nil if the navigation is not yet started or has already been stopped.
Next steps
Since you have learned about our modular architecture, here are recommendations for the next steps: