Skip to content

Commit

Permalink
feat(autoware_detected_object_validation): set validate distance in t…
Browse files Browse the repository at this point in the history
…he obstacle pointcloud based validator (autowarefoundation#9663)

* chore: add validate_max_distance_m parameter for obstacle_pointcloud_based_validator

Signed-off-by: Taekjin LEE <[email protected]>

* chore: optimize object distance validation in obstacle_pointcloud_validator

Signed-off-by: Taekjin LEE <[email protected]>

* chore: add validate_max_distance_m parameter for obstacle_pointcloud_based_validator

Signed-off-by: Taekjin LEE <[email protected]>

---------

Signed-off-by: Taekjin LEE <[email protected]>
  • Loading branch information
technolojin authored and saka1-s committed Jan 9, 2025
1 parent 60efdcc commit 994d075
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
#UNKNOWN, CAR, TRUCK, BUS, TRAILER, MOTORBIKE, BICYCLE, PEDESTRIAN
[800.0, 800.0, 800.0, 800.0, 800.0, 800.0, 800.0, 800.0]

validate_max_distance_m: 70.0 # [m]

using_2d_validator: false
enable_debugger: false
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class ObstaclePointCloudBasedValidator : public rclcpp::Node
typedef message_filters::Synchronizer<SyncPolicy> Sync;
Sync sync_;
PointsNumThresholdParam points_num_threshold_param_;
double validate_max_distance_sq_; // maximum object distance to validate, squared [m^2]

std::shared_ptr<Debugger> debugger_;
bool using_2d_validator_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ ObstaclePointCloudBasedValidator::ObstaclePointCloudBasedValidator(
declare_parameter<std::vector<int64_t>>("max_points_num");
points_num_threshold_param_.min_points_and_distance_ratio =
declare_parameter<std::vector<double>>("min_points_and_distance_ratio");
const double validate_max_distance = declare_parameter<double>("validate_max_distance_m");
validate_max_distance_sq_ = validate_max_distance * validate_max_distance;

using_2d_validator_ = declare_parameter<bool>("using_2d_validator");

Expand Down Expand Up @@ -339,6 +341,18 @@ void ObstaclePointCloudBasedValidator::onObjectsAndObstaclePointCloud(
for (size_t i = 0; i < transformed_objects.objects.size(); ++i) {
const auto & transformed_object = transformed_objects.objects.at(i);
const auto & object = input_objects->objects.at(i);
// check object distance
const double distance_sq =
transformed_object.kinematics.pose_with_covariance.pose.position.x *
transformed_object.kinematics.pose_with_covariance.pose.position.x +
transformed_object.kinematics.pose_with_covariance.pose.position.y *
transformed_object.kinematics.pose_with_covariance.pose.position.y;
if (distance_sq > validate_max_distance_sq_) {
// pass to output
output.objects.push_back(object);
continue;
}

const auto validated =
validation_is_ready ? validator_->validate_object(transformed_object) : false;
if (debugger_) {
Expand Down

0 comments on commit 994d075

Please sign in to comment.