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.
-
Initializes instance of
MainPathSearchOptions
.Throws
invalidSearchTime
ifsearchTime
is negative.Declaration
Swift
public init( searchTime: Measurement<UnitDuration> = Defaults.pathSearchTime, searchDistancePolicy: PathSearchDistancePolicy = Defaults.pathSearchPolicy ) throws
-
Initializes instance of
MainPathSearchOptions
.Throws
invalidSearchTime
ifsearchTime
is negative.InitializationError.invalidMinDistanceAhead
ifminDistanceAhead
is negative.Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public init( searchTime: Measurement<UnitDuration> = Defaults.pathSearchTime, searchDistancePolicy: PathSearchDistancePolicy = Defaults.pathSearchPolicy, minDistanceAhead: Measurement<UnitLength> ) throws
-
Contains default values for
See moreMainPathSearchOptions
.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 (seeExplicitDistancePolicy
).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 toInt.max
in meters.Note
The value ofminDistanceAhead
must be correlated with the value ofsearchDistancePolicy
. For example:- With a custom
searchDistancePolicy
defined toExplicitDistancePolicy
and ansearchDistance
of 10 km (instead of the default 2 km), using a smallminDistanceAhead
(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 asearchDistancePolicy
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>
- With a custom
-
An error that occurs during the creation of the instance.
See moreDeclaration
Swift
public enum InitializationError : Error