Skip to content

Commit

Permalink
feat(obstacle_pointcloud_based_validator_node): skip validation when …
Browse files Browse the repository at this point in the history
…obstacle pointcloud is empty (autowarefoundation#6684)

* feat: skip validation when obstacle pointcloud is empty

Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>

* fix: remove mistakenly unremoved line

Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>

---------

Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>
  • Loading branch information
YoshiRi authored and karishma1911 committed Jun 3, 2024
1 parent 334470e commit 729b935
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,19 @@ void ObstaclePointCloudBasedValidator::onObjectsAndObstaclePointCloud(
// objects_pub_->publish(*input_objects);
return;
}
bool validation_is_ready = true;
if (!validator_->setKdtreeInputCloud(input_obstacle_pointcloud)) {
RCLCPP_WARN_THROTTLE(this->get_logger(), *this->get_clock(), 5, "cannot receive pointcloud");
return;
RCLCPP_WARN_THROTTLE(
this->get_logger(), *this->get_clock(), 5,
"obstacle pointcloud is empty! Can not validate objects.");
validation_is_ready = false;
}

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);
const auto validated = validator_->validate_object(transformed_object);
const auto validated =
validation_is_ready ? validator_->validate_object(transformed_object) : false;
if (debugger_) {
debugger_->addNeighborPointcloud(validator_->getDebugNeighborPointCloud());
debugger_->addPointcloudWithinPolygon(validator_->getDebugPointCloudWithinObject());
Expand Down

0 comments on commit 729b935

Please sign in to comment.