Junction Behavior
junction_behavior moves a vehicle through a junction, observing the rules of the junction. The junction behavior uses information coming from the junction sensor. A junction can have a traffic light, stop sign, or yield sign, or it can be an intersection without a sign. When determining the approaching junction, the sign on which the behavior acts is checked and affects further actions of the vehicle. The behavior supports flashing red light and interprets it identically to a Stop sign.
| Field name | Type | Description | Default |
|---|---|---|---|
| enable | bool | When true, junction_behavior is enabled; when false, it is disabled | true |
| distance_from_stop_line | length | The distance between the vehicle front and the stopping line (negative value would mean passage of the line) | [0.5..2]meter |
| yellow_light_stop_deceleration_threshold | acceleration | The vehicle will stop for the Yellow traffic light only if the required deceleration is below this value | [2..3]mpsps |
| same_time_arrival_resolution | time | When a vehicle arrives at the junction, if the time gap relative to other vehicles arriving at the same time is smaller than the same_time_arrival_resolution, the vehicle will behave as if the arrival was simultaneous. If all vehicles have the same traffic sign priority, the 4-way-stop junction rules (according to US traffic laws) will determine which vehicle goes first |
[0.5..2]second |
The behavior moves the vehicle through the junction by reacting to the following information and rules:
-
Traffic Lights: The vehicle will stop for red traffic lights; its reaction to a yellow traffic light is determined by the parameter
yellow_light_stop_deceleration_threshold(it will stop if the deceleration needed is lower than the threshold and go ahead if not).The following examples are just a few from a wide range of behaviors of handling various special traffic light states. Further examples will be added in the future.
-
Example 1: The red_flashing traffic light state. A red flashing traffic light is handled like a stop sign.
-
Example 2: The unknown traffic light state. If a traffic light is in an unknown state, it is treated as switched off and handled as if it does not exist.
-
Example 3: Unprotected left turn on a traffic light junction If the traffic light is in an unprotected left state (i.e., green bulb without an arrow), the vehicle will yield to any approaching vehicles that cross the junction.
-
-
Stop Signs: At stop signs, the vehicle will stop and allow other vehicles with conflicting trajectories to pass if they do not have a stop sign on their entry leg or arrived at the junction earlier by at least the
same_time_arrival_resolution. In a 4-way stop situation where multiple vehicles arrive at the same time, the vehicle will follow the traffic rules in the following order:-
Yield to any vehicle on the right.
-
Yield to straight traffic in case the vehicle wants to turn across the path of the vehicle driving straight.
-
Yield to traffic turning right in case the vehicle wants to turn left across that path of vehicles turning right.
-
-
Yield Signs: In case of a yield sign, the vehicle will yield for other vehicles coming from another direction and conflicting with the path of the vehicle.
By default, the junction behavior is enabled.
keep(car.ftx_driver.junction_behavior.enable == true)
To configure when vehicles are considered to arrive at the same time and therefore follow the rules described above at a 4-way stop, you can adapt the parameter same_time_arrival_resolution:
extend top.main:
def post_plan() is also:
car.ftx_driver.junction_behavior.same_time_arrival_resolution = 0.02s
See complete example: Configure when vehicles are considered to arrive at a junction at the same time.
You can call update_config to update the behavior_param value for the junction behavior parameters at run time. For more information, see Updating driver behavior parameters at the run time.