203. Speed Limit Watcher
The speed_limit watcher monitors the current speed limit of the road the Ego drives on. It is based on the speed limit of the road element. Its primary purpose is to provide insight into the speed limit on the road. It uses the map.get_speed_limit() function to get the speed limit and detect any changes over time.
This watcher triggers when the road's speed limit changes, providing valuable context for interval-based analysis. For periods where the speed limit is unknown, the parameter create_interval_for_unknown_speed_limit controls whether an interval is created. If enabled, an interval will be recorded to indicate that the speed limit was unknown during that time.
203.0.1 Start condition
The speed_limit evaluator checks the road speed limit at every top.w_clk using the function map.get_speed_limit(), which returns the current speed limit of the road that the vehicle is driving on. A new interval starts when the Ego enters a new speed limit of the road element and continues until the speed limit changes.
203.0.2 End condition
The active interval ends when the speed limit of the road element changes.
203.1 Plot
203.2 Configuration parameters
The following parameters can be configured to customize the evaluator's behavior.
| Parameter | Type | Unit | Description | Default Value | Range |
|---|---|---|---|---|---|
create_interval_for_unknown_speed_limit |
bool | Whether an interval is created when the speed limit is unknown | true |
203.3 Metrics
The following metrics are recorded and tracked by the evaluator.
| Metric | Type | Description | Range | Unit |
|---|---|---|---|---|
speed_limit |
speed | Speed limit of the road on which the Ego is driving | [0..150] | kph |
203.4 Log and Error Messages
No error messages found.
203.5 Usage
203.5.1 How to instantiate
The speed_limit watcher can be instantiated for any vehicle actor.
watcher speed_limit_watcher is speed_limit(vehicle: actor,
create_interval_for_unknown_speed_limit: ftlx_global_eval_config.ego_speed_limit_watcher_config.create_interval_for_unknown_speed_limit,
log_level: ftlx_global_eval_config.ego_speed_limit_watcher_config.log_level)
203.5.2 Set parameters at instantiation time
Pass parameters in the keep(...) binding at instantiation time, either from ftlx_global_eval_config or as explicit values.
watcher speed_limit_watcher is speed_limit(vehicle: sut.car):
keep(create_interval_for_unknown_speed_limit == true)
keep(log_level == ftlx_global_eval_config.ego_speed_limit_watcher_config.log_level)
203.5.3 Define and use a custom parameter set
A new struct can be created to customize the watcher's parameters in a more organized and modular way.
const custom_speed_limit_config: speed_limit_watcher_config = new
set custom_speed_limit_config.create_interval_for_unknown_speed_limit = true
set custom_speed_limit_config.log_level = trace_level
watcher custom_speed_limit_watcher is speed_limit(vehicle: sut.car,
create_interval_for_unknown_speed_limit: custom_speed_limit_config.create_interval_for_unknown_speed_limit,
log_level: custom_speed_limit_config.log_level)
203.5.4 Disabling the watcher
To disable the watcher, set the enabled flag to false in the speed_limit_watcher_config struct.
const speed_limit_watcher_config: speed_limit_watcher_config = new
set speed_limit_watcher_config.enabled = false
203.6 Additional information
All parameters are required, but you don't need to customize all of them.
For any parameter you don't customize with set, the default value defined in speed_limit_watcher_config is used.