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(autonomous_emergency_braking): add sanity chackes (#8998) #1570

Merged
merged 1 commit into from
Oct 1, 2024
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
17 changes: 14 additions & 3 deletions control/autoware_autonomous_emergency_braking/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ bool AEB::checkCollision(MarkerArray & debug_markers)
const auto ego_polys = generatePathFootprint(path, expand_width_);
std::vector<ObjectData> objects;
// Crop out Pointcloud using an extra wide ego path
if (use_pointcloud_data_ && !points_belonging_to_cluster_hulls->empty()) {
if (
use_pointcloud_data_ && points_belonging_to_cluster_hulls &&
!points_belonging_to_cluster_hulls->empty()) {
const auto current_time = obstacle_ros_pointcloud_ptr_->header.stamp;
getClosestObjectsOnPath(
path, ego_polys, current_time, points_belonging_to_cluster_hulls, objects);
Expand Down Expand Up @@ -667,6 +669,9 @@ void AEB::generatePathFootprint(
const Path & path, const double extra_width_margin, std::vector<Polygon2d> & polygons)
{
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
if (path.empty()) {
return;
}
for (size_t i = 0; i < path.size() - 1; ++i) {
polygons.push_back(
createPolygon(path.at(i), path.at(i + 1), vehicle_info_, extra_width_margin));
Expand All @@ -676,8 +681,11 @@ void AEB::generatePathFootprint(
std::vector<Polygon2d> AEB::generatePathFootprint(
const Path & path, const double extra_width_margin)
{
std::vector<Polygon2d> polygons;
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
if (path.empty()) {
return {};
}
std::vector<Polygon2d> polygons;
for (size_t i = 0; i < path.size() - 1; ++i) {
polygons.push_back(
createPolygon(path.at(i), path.at(i + 1), vehicle_info_, extra_width_margin));
Expand All @@ -690,7 +698,7 @@ void AEB::createObjectDataUsingPredictedObjects(
std::vector<ObjectData> & object_data_vector)
{
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
if (predicted_objects_ptr_->objects.empty()) return;
if (predicted_objects_ptr_->objects.empty() || ego_polys.empty()) return;

const double current_ego_speed = current_velocity_ptr_->longitudinal_velocity;
const auto & objects = predicted_objects_ptr_->objects;
Expand Down Expand Up @@ -863,6 +871,9 @@ void AEB::cropPointCloudWithEgoFootprintPath(
const std::vector<Polygon2d> & ego_polys, PointCloud::Ptr filtered_objects)
{
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
if (ego_polys.empty()) {
return;
}
PointCloud::Ptr full_points_ptr(new PointCloud);
pcl::fromROSMsg(*obstacle_ros_pointcloud_ptr_, *full_points_ptr);
// Create a Point cloud with the points of the ego footprint
Expand Down
Loading