Skip to content

Commit 947960a

Browse files
danielsanchezaransaka1-s
authored andcommitted
add turn_signal_remaining_shift_length_threshold
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent c7d8f2c commit 947960a

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
@@ -18,6 +18,7 @@
1818
turn_signal_minimum_search_distance: 10.0
1919
turn_signal_search_time: 3.0
2020
turn_signal_shift_length_threshold: 0.3
21+
turn_signal_remaining_shift_length_threshold: 0.1
2122
turn_signal_on_swerving: true
2223

2324
enable_akima_spline_first: false

planning/behavior_path_planner/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/src/behavior_path_planner_node.cpp

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

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

planning/behavior_path_planner_common/include/behavior_path_planner_common/parameters.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct BehaviorPathPlannerParameters
5858
double turn_signal_search_time;
5959
double turn_signal_minimum_search_distance;
6060
double turn_signal_shift_length_threshold;
61+
double turn_signal_remaining_shift_length_threshold;
6162
bool turn_signal_on_swerving;
6263

6364
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
@@ -622,7 +622,6 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
622622
const double current_shift_length, const bool is_driving_forward, const bool egos_lane_is_shifted,
623623
const bool override_ego_stopped_check, const bool is_pull_out) const
624624
{
625-
constexpr double THRESHOLD = 0.1;
626625
const auto & p = parameters;
627626
const auto & rh = route_handler;
628627
const auto & ego_pose = self_odometry->pose.pose;
@@ -681,7 +680,9 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
681680
}
682681

683682
// If the vehicle does not shift anymore, we turn off the blinker
684-
if (std::fabs(end_shift_length - current_shift_length) < THRESHOLD) {
683+
if (
684+
std::fabs(end_shift_length - current_shift_length) <
685+
p.turn_signal_remaining_shift_length_threshold) {
685686
return std::make_pair(TurnSignalInfo{}, true);
686687
}
687688

0 commit comments

Comments
 (0)