Skip to content

Commit

Permalink
fix(avoidance): don't output turn signal if there is huge lateral dev…
Browse files Browse the repository at this point in the history
…eation

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed May 17, 2024
1 parent f35348c commit 6298906
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions planning/behavior_path_avoidance_module/src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,11 +913,21 @@ BehaviorModuleOutput AvoidanceModule::plan()
ignore_signal_ = is_ignore ? std::make_optional(uuid) : std::nullopt;
};

const auto is_large_deviation = [this](const auto & path) {
constexpr double THRESHOLD = 1.0;
const auto current_seg_idx = planner_data_->findEgoSegmentIndex(path.points);
const auto lateral_deviation =
motion_utils::calcLateralOffset(path.points, getEgoPosition(), current_seg_idx);
return std::abs(lateral_deviation) > THRESHOLD;
};

// turn signal info
if (path_shifter_.getShiftLines().empty()) {
output.turn_signal_info = getPreviousModuleOutput().turn_signal_info;
} else if (is_ignore_signal(path_shifter_.getShiftLines().front().id)) {
output.turn_signal_info = getPreviousModuleOutput().turn_signal_info;
} else if (is_large_deviation(spline_shift_path.path)) {
output.turn_signal_info = getPreviousModuleOutput().turn_signal_info;
} else {
const auto original_signal = getPreviousModuleOutput().turn_signal_info;

Expand Down

0 comments on commit 6298906

Please sign in to comment.