Skip to content

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.

  • 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:

    1. Yield to any vehicle on the right.

    2. Yield to straight traffic in case the vehicle wants to turn across the path of the vehicle driving straight.

    3. 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.

OSC2 code: controlling junction_behavior
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:

OSC2 code: changing the time during that two vehicles are considered as arriving at the same time
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.