MainPathSearchOptions

public struct MainPathSearchOptions

Horizon search options for the main path.

These options specify the search distance policy PathSearchDistancePolicy and the search time for the main path. The main path is the path the user currently follows, extending along the most likely trajectory. The search distance policy and the search time define the extent of the main path.

To specify horizon options for the main path, create an instance of this class:

let mainPathSearchOptions = try MainPathSearchOptions(
    searchTime: .tt.minutes(10),
    searchDistancePolicy: ExplicitDistancePolicy(
        searchDistance: PathSearchDistance(
            maxHorizonLength: .tt.kilometers(5)
        )
    )
)

For more information on horizon paths see HorizonEngine.

For more information on horizon options see HorizonOptions.

The PathSearchDistancePolicy determines whether the horizon engine must search along the entire route (see RouteLengthPolicy) or within an explicitly specified distance (see ExplicitDistancePolicy).

The main path will be extended until search time and search distance have both reached their limits.

Lifecycle

Public

  • Contains default values for MainPathSearchOptions.

    See more

    Declaration

    Swift

    public enum Defaults
  • Path search time. 0 if the horizon options do not specify a path search time.

    Declaration

    Swift

    public let searchTime: Measurement<UnitDuration>
  • Path search distance policy. It determines whether the horizon engine must search along the entire route (see RouteLengthPolicy) or within an explicitly specified distance (see ExplicitDistancePolicy).

    Declaration

    Swift

    public let searchDistancePolicy: PathSearchDistancePolicy
  • The minimum length of the horizon ahead for which a horizon snapshot update is triggered. If the distance between the vehicle and the end of the horizon snapshot since the last snapshot update is less than this value, the client will receive a new horizon snapshot. If the explicit distance policy ExplicitDistancePolicy is used for the main path, a value for the minimum distance ahead that is greater than the main path search distance will result in the snapshot being updated on every tick. To trigger update of the horizon snapshot on every tick, regardless of the search distance policy used for the main path, define this parameter to Int.max in meters.

    Note

    The value of minDistanceAhead must be correlated with the value of searchDistancePolicy. For example:
    • With a custom searchDistancePolicy defined to ExplicitDistancePolicy and an searchDistance of 10 km (instead of the default 2 km), using a small minDistanceAhead (for example, 100 m) can cause the frequency of horizon snapshot updates to be very low.
    • With a minDistanceAhead set to 3 km, it makes sense to use a searchDistancePolicy that results in a horizon longer than the 3 km (whereas the default is 2 km). Otherwise the frequency of horizon snapshot updates is very high (snapshot updated on every tick).

    Declaration

    Swift

    public let minDistanceAhead: Measurement<UnitLength>

MainPathSearchOptions.InitializationError

  • An error that occurs during the creation of the instance.

    See more

    Declaration

    Swift

    public enum InitializationError : Error