Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(intersection_occlusion)!: react RTC disapproval and stop even if occlusion detection is OFF #6279

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tier IV, Inc.

Check notice on line 1 in planning/behavior_velocity_intersection_module/src/scene_intersection.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 1108 to 1106, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in planning/behavior_velocity_intersection_module/src/scene_intersection.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 4.64 to 4.42, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -735,9 +735,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (
!rtc_occlusion_approved && decision_result.occlusion_stopline_idx &&
planner_param.occlusion.enable) {
if (!rtc_occlusion_approved && decision_result.occlusion_stopline_idx) {

Check notice on line 738 in planning/behavior_velocity_intersection_module/src/scene_intersection.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Complex Conditional

reactRTCApprovalByDecisionResult no longer has a complex conditional. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
const auto occlusion_stopline_idx = decision_result.occlusion_stopline_idx.value();
planning_utils::setVelocityFromIndex(occlusion_stopline_idx, 0.0, path);
debug_data->occlusion_stop_wall_pose =
Expand Down Expand Up @@ -814,7 +812,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
const auto stopline_idx = decision_result.occlusion_stopline_idx;
planning_utils::setVelocityFromIndex(stopline_idx, 0.0, path);
debug_data->occlusion_stop_wall_pose =
Expand Down Expand Up @@ -857,7 +855,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
if (planner_param.occlusion.creep_during_peeking.enable) {
const size_t occlusion_peeking_stopline = decision_result.occlusion_stopline_idx;
const size_t closest_idx = decision_result.closest_idx;
Expand Down Expand Up @@ -895,7 +893,7 @@
"PeekingTowardOcclusion, approval = (default: %d, occlusion: %d)", rtc_default_approved,
rtc_occlusion_approved);
// NOTE: creep_velocity should be inserted first at closest_idx if !rtc_default_approved
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
const size_t occlusion_peeking_stopline =
decision_result.temporal_stop_before_attention_required
? decision_result.first_attention_stopline_idx
Expand Down Expand Up @@ -965,7 +963,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
const auto stopline_idx = decision_result.temporal_stop_before_attention_required
? decision_result.first_attention_stopline_idx
: decision_result.occlusion_stopline_idx;
Expand Down Expand Up @@ -1066,7 +1064,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
const auto stopline_idx = decision_result.occlusion_stopline_idx;
planning_utils::setVelocityFromIndex(stopline_idx, 0.0, path);
debug_data->occlusion_stop_wall_pose =
Expand Down Expand Up @@ -1110,7 +1108,7 @@
path->points.at(stopline_idx).point.pose, VelocityFactor::UNKNOWN);
}
}
if (!rtc_occlusion_approved && planner_param.occlusion.enable) {
if (!rtc_occlusion_approved) {
const auto stopline_idx = decision_result.occlusion_stopline_idx;
planning_utils::setVelocityFromIndex(stopline_idx, 0.0, path);
debug_data->occlusion_stop_wall_pose =
Expand Down
Loading