Skip to content

Commit

Permalink
introduce early break to reduce computation time
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
  • Loading branch information
danielsanchezaran committed Jun 18, 2024
1 parent 4b6a201 commit 723ad9b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions control/autoware_autonomous_emergency_braking/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ void AEB::createObjectDataUsingPredictedObjects(
if (collision_points_bg.empty()) continue;

// Create an object for each intersection point
bool collision_points_added{false};
for (const auto & collision_point : collision_points_bg) {
const auto obj_position =
tier4_autoware_utils::createPoint(collision_point.x(), collision_point.y(), 0.0);
Expand All @@ -685,7 +686,11 @@ void AEB::createObjectDataUsingPredictedObjects(
obj.velocity = (obj_tangent_velocity > 0.0) ? obj_tangent_velocity : 0.0;
obj.distance_to_object = std::abs(dist_ego_to_object);
object_data_vector.push_back(obj);
collision_points_added = true;
}
// The ego polygons are in order, so the first intersection points found are the closest
// points. It is not necessary to continue iterating the ego polys for the same object.
if (collision_points_added) break;
}
});
}
Expand Down

0 comments on commit 723ad9b

Please sign in to comment.