Skip to content

130. Vehicle to Ego lane change interaction watcher

Watcher location: $FTX_PACKAGES/common/scenarios/scenario_behavior_watcher_kpi/

Defines the lane change behavior of the Ego and any vehicle in the scenario.

130.1 Lane change watcher

This watcher emits an interval when the vehicle starts a lane change and ends the interval when the vehicle completes or aborts a lane change.

The following example shows a watcher that creates intervals when the vehicle changes a lane. A watcher type, lane_change_watcher, is created and the watcher, lane_change_watcher_call is instantiated from that watcher type. A watcher data struct, lane_change_watcher_data, is also created to record the actor_id, interval_count, start lane, and target lane of the vehicle. The following sections walk you through this code to show how watchers are defined and instantiated.

OSC2 code: watcher that creates intervals when any vehicle changes the lane
--8<-- Example 1 in "vehicle_to_ego_lane_change_interaction_watcher_ex.osc"

The following is a visualization of intervals displayed in the Foretify debugger, where the watcher intervals are shown in teal color. This example shows the intervals emitted for the vehicle when it is changing a lane.

Start interval: The vehicle change lane start.
End interval: The vehicle completes or aborts the lane change.

Figure 1: Example for vehicle lane change

Figure 2: Example for Ego lane change

130.1.1 KPI

The performance metrics and the data items captured during the test execution are as follows:

Name/Item Description Range Unit / Type
actor_id The Unique identification number of the vehicle int
interval_count The sum of the interval counts of the actor changing a lane int
start_lane The initial lane of the vehicle before changing the lane int
target_lane The final lane of the vehicle after changing the lanes int
lane_change_side The lane change side of the vehicle av_side
lane_change_end_condition The lane change end condition which can be incomplete, completed, or aborted enum
number_of_lane_changes_completed The number of lane changes completed int

130.2 Interaction Watcher

This watcher emits an interval when any vehicle is within a time_gap of 0 to 5 seconds and/or a distance of -4 to 4 meters from the Ego. The interval starts when the vehicle and the Ego start changing lanes and ends when either of them completes the lane change.

The following example shows a watcher that creates intervals when the Ego changes a lane. A watcher type, interaction_watcher, is created and the watcher, vehicle_to_ego_lane_change_interaction_watcher is instantiated from that watcher type. A watcher data struct, interaction_watcher_data, is also created to record the actor_id, vehicle_actor_id, interval_count, time gap between the Ego and the vehicle, distance between the Ego and the vehicle, and interval count. The following sections walk you through the code to show how watchers are defined and instantiated.

OSC2 code: watcher that creates intervals when any vehicle changes the lane at the same time as the Ego
--8<-- Example 2 in "vehicle_to_ego_lane_change_interaction_watcher_ex.osc"

The following is a visualization of intervals displayed in the Foretify debugger, where watcher intervals are shown in teal color. This example shows the intervals emitted for vehicles when they are changing lanes simultaneously with the Ego.

Every vehicle changing lanes at the same time as the Ego generates an interaction with the Ego.

Start interval: Both the Ego and the vehicle change lanes.
End interval: One of the vehicles completes the lane change.

130.2.1 KPI

The performance metrics and the data items captured during the test execution are as follows:

Name/Item Description Range Unit / Type
actor_id The Unique identification number of the Ego int
vehicle_actor_id The Unique identification number of the vehicle int
interval_count The sum of the interval counts of the actor changing the lanes int
ego_distance_to_vehicle The distance from the Ego to the vehicle meter
ego_time_gap_to_vehicle The time gap from the Ego to the vehicle second
interaction_watcher_duration The sum of the interval durations during the interaction between the Ego and the vehicle second
interaction_count The total count of interactions between the Ego and the vehicle int