Skip to content

Commit 6e5d597

Browse files
feat(behavior_path_planner_common,turn_signal_decider): add turn_signal_remaining_shift_length_threshold (#7160)
add turn_signal_remaining_shift_length_threshold Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent 1b5a6b2 commit 6e5d597

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

planning/behavior_path_planner/config/behavior_path_planner.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
turn_signal_minimum_search_distance: 10.0
1818
turn_signal_search_time: 3.0
1919
turn_signal_shift_length_threshold: 0.3
20+
turn_signal_remaining_shift_length_threshold: 0.1
2021
turn_signal_on_swerving: true
2122

2223
enable_akima_spline_first: false

planning/behavior_path_planner/src/behavior_path_planner_node.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ BehaviorPathPlannerParameters BehaviorPathPlannerNode::getCommonParam()
260260
p.turn_signal_search_time = declare_parameter<double>("turn_signal_search_time");
261261
p.turn_signal_shift_length_threshold =
262262
declare_parameter<double>("turn_signal_shift_length_threshold");
263+
p.turn_signal_remaining_shift_length_threshold =
264+
declare_parameter<double>("turn_signal_remaining_shift_length_threshold");
263265
p.turn_signal_on_swerving = declare_parameter<bool>("turn_signal_on_swerving");
264266

265267
p.enable_akima_spline_first = declare_parameter<bool>("enable_akima_spline_first");

planning/behavior_path_planner_common/docs/behavior_path_planner_turn_signal_design.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ Currently, this algorithm can sometimes give unnatural (not wrong) blinkers in c
2020

2121
## Parameters for turn signal decider
2222

23-
| Name | Unit | Type | Description | Default value |
24-
| :---------------------------------------------- | :--- | :----- | :--------------------------------------------------------------------------- | :------------ |
25-
| turn_signal_intersection_search_distance | [m] | double | constant search distance to decide activation of blinkers at intersections | 30 |
26-
| turn_signal_intersection_angle_threshold_degree | deg | double | angle threshold to determined the end point of intersection required section | 15 |
27-
| turn_signal_minimum_search_distance | [m] | double | minimum search distance for avoidance and lane change | 10 |
28-
| turn_signal_search_time | [s] | double | search time for to decide activation of blinkers | 3.0 |
29-
| turn_signal_shift_length_threshold | [m] | double | shift length threshold to decide activation of blinkers | 0.3 |
30-
| turn_signal_on_swerving | [-] | bool | flag to activate blinkers when swerving | true |
23+
| Name | Unit | Type | Description | Default value |
24+
| :---------------------------------------------- | :--- | :----- | :------------------------------------------------------------------------------------------------------------------------------ | :------------ |
25+
| turn_signal_intersection_search_distance | [m] | double | constant search distance to decide activation of blinkers at intersections | 30 |
26+
| turn_signal_intersection_angle_threshold_degree | deg | double | angle threshold to determined the end point of intersection required section | 15 |
27+
| turn_signal_minimum_search_distance | [m] | double | minimum search distance for avoidance and lane change | 10 |
28+
| turn_signal_search_time | [s] | double | search time for to decide activation of blinkers | 3.0 |
29+
| turn_signal_shift_length_threshold | [m] | double | shift length threshold to decide activation of blinkers | 0.3 |
30+
| 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 |
31+
| turn_signal_on_swerving | [-] | bool | flag to activate blinkers when swerving | true |
3132

3233
Note that the default values for `turn_signal_intersection_search_distance` and `turn_signal_search_time` is strictly followed by [Japanese Road Traffic Laws](https://www.japaneselawtranslation.go.jp/ja/laws/view/2962). So if your country does not allow to use these default values, you should change these values in configuration files.
3334

planning/behavior_path_planner_common/include/behavior_path_planner_common/parameters.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct BehaviorPathPlannerParameters
5454
double turn_signal_search_time;
5555
double turn_signal_minimum_search_distance;
5656
double turn_signal_shift_length_threshold;
57+
double turn_signal_remaining_shift_length_threshold;
5758
bool turn_signal_on_swerving;
5859

5960
bool enable_akima_spline_first;

planning/behavior_path_planner_common/src/turn_signal_decider.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,6 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
615615
const double current_shift_length, const bool is_driving_forward, const bool egos_lane_is_shifted,
616616
const bool override_ego_stopped_check, const bool is_pull_out) const
617617
{
618-
constexpr double THRESHOLD = 0.1;
619618
const auto & p = parameters;
620619
const auto & rh = route_handler;
621620
const auto & ego_pose = self_odometry->pose.pose;
@@ -674,7 +673,9 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
674673
}
675674

676675
// If the vehicle does not shift anymore, we turn off the blinker
677-
if (std::fabs(end_shift_length - current_shift_length) < THRESHOLD) {
676+
if (
677+
std::fabs(end_shift_length - current_shift_length) <
678+
p.turn_signal_remaining_shift_length_threshold) {
678679
return std::make_pair(TurnSignalInfo{}, true);
679680
}
680681

0 commit comments

Comments
 (0)