Turn Signal design#
Turn Signal decider determines necessary blinkers.
Purpose / Role#
This module is responsible for activating a necessary blinker during driving. It uses rule-based algorithm to determine blinkers, and the details of this algorithm are described in the following sections. Note that this algorithm is strictly based on the Japanese Road Traffic Law.
Assumptions#
Autoware has following order of priorities for turn signals.
- Activate turn signal to safely navigate ego vehicle and protect other road participants
- Follow traffic laws
- Follow human driving practices
Limitations#
Currently, this algorithm can sometimes give unnatural (not wrong) blinkers in complicated situations. This is because it tries to follow the road traffic law and cannot solve blinker conflicts clearly in that environment.
Parameters for turn signal decider#
| Name | Unit | Type | Description | Default value |
|---|---|---|---|---|
| turn_signal_intersection_search_distance | [m] | double | constant search distance to decide activation of blinkers at intersections | 30 |
| turn_signal_intersection_angle_threshold_degree | deg | double | angle threshold to determined the end point of intersection required section | 15 |
| turn_signal_minimum_search_distance | [m] | double | minimum search distance for avoidance and lane change | 10 |
| turn_signal_search_time | [s] | double | search time for to decide activation of blinkers | 3.0 |
| turn_signal_shift_length_threshold | [m] | double | shift length threshold to decide activation of blinkers | 0.3 |
| turn_signal_remaining_shift_length_threshold | [m] | double | When the ego's current shift length minus its end shift length is less than this threshold, the turn signal will be turned off. | 0.1 |
| turn_signal_remaining_distance_to_bound_threshold | [m] | double | Distance from ego vehicle's front edge to the far-side boundary of the target merging lane. The turn signal will be turned off when the value is less than the threshold. | 1.3 |
| turn_signal_on_swerving | [-] | bool | flag to activate blinkers when swerving | true |
| turn_signal_roundabout_on_entry | [-] | string | turn signal on entry to roundabout. "None", "Left", "Right" | "None" |
| turn_signal_roundabout_entry_indicator_persistence | [-] | bool | whether to keep the indicator on after entering the roundabout. If true, the indicator will be kept on until the exit point. If false, the indicator will be turned off after entering the roundabout. | false |
| turn_signal_roundabout_on_exit | [-] | string | turn signal on exit from roundabout. "None", "Left", "Right" | "Left" |
| turn_signal_roundabout_search_distance | [m] | double | constant search distance to decide activation of blinkers at roundabouts | 30.0 |
| turn_signal_roundabout_angle_threshold_degree | deg | double | angle threshold to determined the end point of roundabout required section | 15.0 |
| turn_signal_roundabout_backward_depth | [-] | int | maximum number of lanelets to look back when determining the backward length for roundabout turn signal logic. Set to -1 for unlimited depth. | 50 |
Note that the default values for turn_signal_intersection_search_distance and turn_signal_search_time is strictly followed by Japanese Road Traffic Laws. So if your country does not allow to use these default values, you should change these values in configuration files.
Inner-workings / Algorithms#
In this algorithm, it assumes that each blinker has two sections, which are desired section and required section. The image of these two sections are depicted in the following diagram.
These two sections have the following meanings.
- Desired Section#
- This section is defined by road traffic laws. It cannot be longer or shorter than the designated length defined by the law.
- In this section, you do not have to activate the designated blinkers if it is dangerous to do so.
- Required Section#
- In this section, ego vehicle must activate designated blinkers. However, if there are blinker conflicts, it must solve them based on the algorithm we mention later in this document.
- Required section cannot be longer than desired section.
When turning on the blinker, it decides whether or not to turn on the specified blinker based on the distance from the front of the ego vehicle to the start point of each section. Conversely, when turning off the blinker, it calculates the distance from the base link of the ego vehicle to the end point of each section and decide whether or not to turn it off based on that.
For left turn, right turn, avoidance, lane change, goal planner and pull out, we define these two sections, which are elaborated in the following part.
1. Left and Right turn#
Turn signal decider checks each lanelet on the map if it has turn_direction information. If a lanelet has this information, it activates necessary blinker based on this information.
- desired start point
The
search_distancefor blinkers at intersections isv * turn_signal_search_time + turn_signal_intersection_search_distance. Then the start point becomessearch_distancemeters before the start point of the intersection lanelet(depicted in green in the following picture), wherevis the velocity of the ego vehicle. However, if we setturn_signal_distancein the lanelet, we use that length as search distance.
- desired end point Terminal point of the intersection lanelet.
- required start point Initial point of the intersection lanelet.
- required end point The earliest point that satisfies the following condition. \(\theta - \theta_{\textrm{end}} < \delta\), where \(\theta_{\textrm{end}}\) is yaw angle of the terminal point of the lanelet, \(\theta\) is the angle of a required end point and \(\delta\) is the threshold defined by the user.
2. Avoidance#
Avoidance can be separated into two sections, first section and second section. The first section is from the start point of the path shift to the end of the path shift. The second section is from the end of shift point to the end of avoidance. Note that avoidance module will not activate turn signal when its shift length is below turn_signal_shift_length_threshold.
First section
- desired start point
v * turn_signal_search_timemeters before the start point of the avoidance shift path.
- desired end point Shift complete point where the path shift is completed.
- required start point Avoidance start point.
- required end point Shift complete point same as the desired end point.
Second section
- desired start point Shift complete point.
- desired end point Avoidance terminal point
- required start point Shift complete point.
- required end point Avoidance terminal point.
3. Lane Change#
- desired start point
v * turn_signal_search_timemeters before the start point of the lane change path.
- desired end point Terminal point of the lane change path.
- required start point Initial point of the lane change path.
- required end point Cross point with lane change path and boundary line of the adjacent lane.
4. Pull out (Start Planner)#
- desired start point Start point of the path of pull out.
- desired end point Terminal point of the path of pull out.
- required start point Start point of the path pull out.
- required end point Terminal point of the path of pull out.
Note
The blinker also deactivate based on the remaining lateral distance to the target lane boundary.
If this distance is smaller than the configurable parameter turn_signal_remaining_distance_to_bound_threshold, the blinker will turn off immediately.
5. Goal Planner#
- desired start point
v * turn_signal_search_timemeters before the start point of the pull over path.
- desired end point Terminal point of the path of pull over.
- required start point Start point of the path of pull over.
- required end point Terminal point of the path of pull over.
6. Roundabout#
For roundabout scenarios, the turn signal decider handles both entry and exit turn signals based on the roundabout attribute in the lanelet map. The roundabout functionality supports the following configurations:
Entry Turn Signal:
- desired start point:
v * turn_signal_search_timemeters before the start point of the roundabout entry lanelet. - desired end point: Terminal point of the roundabout entry lanelet (or exit lanelet if
turn_signal_roundabout_entry_indicator_persistenceis enabled). - required start point: Initial point of the roundabout entry lanelet.
- required end point: The earliest point that satisfies the following condition. \(\theta - \theta_{\textrm{end}} < \delta\), where \(\theta_{\textrm{end}}\) is yaw angle of the terminal point of the lanelet, \(\theta\) is the angle of a required end point and \(\delta\) is the threshold defined by the user. (This is the same as the right/left turn signal logic.)
Exit Turn Signal:
- desired start point: Start point of the roundabout exit lanelet (or from a lanelet with
enable_exit_turn_signalattribute if found). - desired end point: Terminal point of the roundabout exit lanelet.
- required start point: Initial point of the roundabout exit lanelet.
- required end point: The earliest point that satisfies the following condition. \(\theta - \theta_{\textrm{end}} < \delta\), where \(\theta_{\textrm{end}}\) is yaw angle of the terminal point of the lanelet, \(\theta\) is the angle of a required end point and \(\delta\) is the threshold defined by the user.(This is the same as the right/left turn signal logic.)
Special Features:
- Indicator persistence: When
turn_signal_roundabout_entry_indicator_persistenceis enabled, the entry turn signal remains active until the vehicle exits the roundabout.
Example parameter settings based on country-specific rules#
| Country | Entry (turn_signal_roundabout_on_entry) |
Exit (turn_signal_roundabout_on_exit) |
Entry indicator persistence (turn_signal_roundabout_entry_indicator_persistence) |
Notes |
|---|---|---|---|---|
| Japan | "None" | "Left" | false | |
| Germany | "None" | "Right" | false | |
| South Korea | "Left" | "Right" | false |
Blinker conflicts#
When ego vehicle has to activate several blinkers, it uses the following rules to decide which blinker to activate. Note that this algorithm is based on the Japanese Road Traffic Law, so it may not be suitable for other countries. When it comes to handle several blinkers, it gives priority to the first blinker that comes first. However, this rule sometimes activate unnatural blinkers, so turn signal decider uses the following five rules to decide the necessary turn signal.
- pattern1
- pattern2
- pattern3
- pattern4
- pattern5
Based on these five rules, turn signal decider can solve blinker conflicts. The following pictures show some examples of this kind of conflicts.
- Several right and left turns on short sections#
In this scenario, ego vehicle has to pass several turns that are close each other. Since this pattern can be solved by the pattern1 rule, the overall result is depicted in the following picture.
- Avoidance with left turn (1)#
In this scene, ego vehicle has to deal with the obstacle that is on its original path as well as make a left turn. The overall result can be varied by the position of the obstacle, but the image of the result is described in the following picture.
- Avoidance with left turn (2)#
Same as the previous scenario, ego vehicle has to avoid the obstacle as well as make a turn left. However, in this scene, the obstacle is parked after the intersection. Similar to the previous one, the overall result can be varied by the position of the obstacle, but the image of the result is described in the following picture.
- Lane change and left turn#
In this scenario, ego vehicle has to do lane change before making a left turn. In the following example, ego vehicle does not activate left turn signal until it reaches the end point of the lane change path.