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 Jun 3, 2024
1 parent 9764147 commit 3d57a61
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -917,11 +917,21 @@ BehaviorModuleOutput StaticObstacleAvoidanceModule::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 3d57a61

Please sign in to comment.