Skip to content

Commit

Permalink
fix target object checking mechanism
Browse files Browse the repository at this point in the history
Signed-off-by: ismetatabay <[email protected]>
  • Loading branch information
ismetatabay committed Aug 27, 2024
1 parent af50a92 commit f463428
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions control/autoware_autonomous_emergency_braking/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,20 +827,19 @@ void AEB::createObjectDataUsingPointCloudClusters(
obj.distance_to_object = std::abs(dist_ego_to_object);

const Point2d obj_point(p.x, p.y);
// Check if the object is in the predicted path for AEB or not
if (!std::any_of(ego_polys.begin(), ego_polys.end(), [&obj_point](const auto & ego_poly) {
return bg::within(obj_point, ego_poly);
})) {
obj.is_target = false;
}
// Add all objects located in the expanded area to the object list for tracking
for (const auto & ego_poly : expanded_ego_polys) {

Check warning on line 837 in control/autoware_autonomous_emergency_braking/src/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

AEB::createObjectDataUsingPointCloudClusters increases in cyclomatic complexity from 16 to 17, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 837 in control/autoware_autonomous_emergency_braking/src/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Excess Number of Function Arguments

AEB::createObjectDataUsingPointCloudClusters increases from 5 to 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
if (bg::within(obj_point, ego_poly)) {
objects.push_back(obj);
break;
}
}

// Check if the object is in the predicted path for AEB or not
if (!std::any_of(ego_polys.begin(), ego_polys.end(), [&obj_point](const auto & ego_poly) {
return bg::within(obj_point, ego_poly);
})) {
obj.is_target = false;
}
}
}

Expand Down

0 comments on commit f463428

Please sign in to comment.