Skip to content

Commit

Permalink
fix(avoidance): apply logic only for non-parked vehicle
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Apr 25, 2024
1 parent 4de89c0 commit b69170a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,15 @@ bool isNeverAvoidanceTarget(
if (object.behavior == ObjectData::Behavior::MERGING) {
object.reason = "MergingToEgoLane";
if (
isOnRight(object) &&
isOnRight(object) && !object.is_parked &&
object.overhang_points.front().first > parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"merging vehicle. but overhang distance is larger than threshold.");
return true;
}
if (
!isOnRight(object) &&
!isOnRight(object) && !object.is_parked &&
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
Expand All @@ -599,15 +599,15 @@ bool isNeverAvoidanceTarget(
if (object.behavior == ObjectData::Behavior::DEVIATING) {
object.reason = "DeviatingFromEgoLane";
if (
isOnRight(object) &&
isOnRight(object) && !object.is_parked &&
object.overhang_points.front().first > parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"deviating vehicle. but overhang distance is larger than threshold.");
return true;
}
if (
!isOnRight(object) &&
!isOnRight(object) && !object.is_parked &&

Check warning on line 610 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Conditional

isNeverAvoidanceTarget has 4 complex conditionals with 8 branches, threshold = 2. 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.
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
Expand Down

0 comments on commit b69170a

Please sign in to comment.