Skip to content

Commit 9ce874c

Browse files
authored
feat(lidar_centerpoint, pointpainting): add diag publisher for max voxel size (#9720)
1 parent 1e68602 commit 9ce874c

File tree

6 files changed

+42
-4
lines changed

6 files changed

+42
-4
lines changed

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/pointpainting_fusion/node.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <autoware/image_projection_based_fusion/utils/utils.hpp>
2424
#include <autoware/lidar_centerpoint/centerpoint_trt.hpp>
2525
#include <autoware/lidar_centerpoint/detection_class_remapper.hpp>
26+
#include <autoware/universe_utils/ros/diagnostics_interface.hpp>
2627

2728
#include <map>
2829
#include <memory>
@@ -58,6 +59,7 @@ class PointPaintingFusionNode
5859
void postprocess(sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg) override;
5960

6061
rclcpp::Publisher<DetectedObjects>::SharedPtr obj_pub_ptr_;
62+
std::unique_ptr<autoware::universe_utils::DiagnosticsInterface> diagnostics_interface_ptr_;
6163

6264
int omp_num_threads_{1};
6365
float score_threshold_{0.0};

perception/autoware_image_projection_based_fusion/src/pointpainting_fusion/node.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ PointPaintingFusionNode::PointPaintingFusionNode(const rclcpp::NodeOptions & opt
186186
// create detector
187187
detector_ptr_ = std::make_unique<image_projection_based_fusion::PointPaintingTRT>(
188188
encoder_param, head_param, densification_param, config);
189+
diagnostics_interface_ptr_ =
190+
std::make_unique<autoware::universe_utils::DiagnosticsInterface>(this, "pointpainting_trt");
189191

190192
obj_pub_ptr_ = this->create_publisher<DetectedObjects>("~/output/objects", rclcpp::QoS{1});
191193

@@ -389,6 +391,7 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
389391
{
390392
std::unique_ptr<ScopedTimeTrack> st_ptr;
391393
if (time_keeper_) st_ptr = std::make_unique<ScopedTimeTrack>(__func__, *time_keeper_);
394+
diagnostics_interface_ptr_->clear();
392395

393396
const auto objects_sub_count =
394397
obj_pub_ptr_->get_subscription_count() + obj_pub_ptr_->get_intra_process_subscription_count();
@@ -403,10 +406,21 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
403406
}
404407

405408
std::vector<autoware::lidar_centerpoint::Box3D> det_boxes3d;
406-
bool is_success = detector_ptr_->detect(painted_pointcloud_msg, tf_buffer_, det_boxes3d);
409+
bool is_num_pillars_within_range = true;
410+
bool is_success = detector_ptr_->detect(
411+
painted_pointcloud_msg, tf_buffer_, det_boxes3d, is_num_pillars_within_range);
407412
if (!is_success) {
408413
return;
409414
}
415+
diagnostics_interface_ptr_->add_key_value(
416+
"is_num_pillars_within_range", is_num_pillars_within_range);
417+
if (!is_num_pillars_within_range) {
418+
std::stringstream message;
419+
message << "PointPaintingTRT::detect: The actual number of pillars exceeds its maximum value, "
420+
<< "which may limit the detection performance.";
421+
diagnostics_interface_ptr_->update_level_and_message(
422+
diagnostic_msgs::msg::DiagnosticStatus::WARN, message.str());
423+
}
410424

411425
std::vector<autoware_perception_msgs::msg::DetectedObject> raw_objects;
412426
raw_objects.reserve(det_boxes3d.size());
@@ -425,6 +439,7 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
425439
if (objects_sub_count > 0) {
426440
obj_pub_ptr_->publish(output_msg);
427441
}
442+
diagnostics_interface_ptr_->publish(painted_pointcloud_msg.header.stamp);
428443
}
429444

430445
bool PointPaintingFusionNode::out_of_scope(__attribute__((unused)) const DetectedObjects & obj)

perception/autoware_lidar_centerpoint/include/autoware/lidar_centerpoint/centerpoint_trt.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CenterPointTRT
6262

6363
bool detect(
6464
const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg, const tf2_ros::Buffer & tf_buffer,
65-
std::vector<Box3D> & det_boxes3d);
65+
std::vector<Box3D> & det_boxes3d, bool & is_num_pillars_within_range);
6666

6767
protected:
6868
void initPtr();

perception/autoware_lidar_centerpoint/include/autoware/lidar_centerpoint/node.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "autoware/lidar_centerpoint/postprocess/non_maximum_suppression.hpp"
2121

2222
#include <autoware/universe_utils/ros/debug_publisher.hpp>
23+
#include <autoware/universe_utils/ros/diagnostics_interface.hpp>
2324
#include <autoware/universe_utils/ros/published_time_publisher.hpp>
2425
#include <autoware/universe_utils/system/stop_watch.hpp>
2526
#include <rclcpp/rclcpp.hpp>
@@ -59,6 +60,7 @@ class LidarCenterPointNode : public rclcpp::Node
5960
DetectionClassRemapper detection_class_remapper_;
6061

6162
std::unique_ptr<CenterPointTRT> detector_ptr_{nullptr};
63+
std::unique_ptr<autoware::universe_utils::DiagnosticsInterface> diagnostics_interface_ptr_;
6264

6365
// debugger
6466
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_{

perception/autoware_lidar_centerpoint/lib/centerpoint_trt.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "autoware/lidar_centerpoint/preprocess/preprocess_kernel.hpp"
2020

2121
#include <autoware/universe_utils/math/constants.hpp>
22+
#include <autoware/universe_utils/ros/diagnostics_interface.hpp>
2223

2324
#include <algorithm>
2425
#include <cstdlib>
@@ -127,8 +128,10 @@ void CenterPointTRT::initPtr()
127128

128129
bool CenterPointTRT::detect(
129130
const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg, const tf2_ros::Buffer & tf_buffer,
130-
std::vector<Box3D> & det_boxes3d)
131+
std::vector<Box3D> & det_boxes3d, bool & is_num_pillars_within_range)
131132
{
133+
is_num_pillars_within_range = true;
134+
132135
CHECK_CUDA_ERROR(cudaMemsetAsync(
133136
encoder_in_features_d_.get(), 0, encoder_in_feature_size_ * sizeof(float), stream_));
134137
CHECK_CUDA_ERROR(
@@ -155,6 +158,7 @@ bool CenterPointTRT::detect(
155158
"The actual number of pillars (%u) exceeds its maximum value (%zu). "
156159
"Please considering increasing it since it may limit the detection performance.",
157160
num_pillars, config_.max_voxel_size_);
161+
is_num_pillars_within_range = false;
158162
}
159163

160164
return true;

perception/autoware_lidar_centerpoint/src/node.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ LidarCenterPointNode::LidarCenterPointNode(const rclcpp::NodeOptions & node_opti
107107
circle_nms_dist_threshold, yaw_norm_thresholds, has_variance_);
108108
detector_ptr_ =
109109
std::make_unique<CenterPointTRT>(encoder_param, head_param, densification_param, config);
110+
diagnostics_interface_ptr_ =
111+
std::make_unique<autoware::universe_utils::DiagnosticsInterface>(this, "centerpoint_trt");
110112

111113
pointcloud_sub_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(
112114
"~/input/pointcloud", rclcpp::SensorDataQoS{}.keep_last(1),
@@ -144,12 +146,24 @@ void LidarCenterPointNode::pointCloudCallback(
144146
if (stop_watch_ptr_) {
145147
stop_watch_ptr_->toc("processing_time", true);
146148
}
149+
diagnostics_interface_ptr_->clear();
147150

148151
std::vector<Box3D> det_boxes3d;
149-
bool is_success = detector_ptr_->detect(*input_pointcloud_msg, tf_buffer_, det_boxes3d);
152+
bool is_num_pillars_within_range = true;
153+
bool is_success = detector_ptr_->detect(
154+
*input_pointcloud_msg, tf_buffer_, det_boxes3d, is_num_pillars_within_range);
150155
if (!is_success) {
151156
return;
152157
}
158+
diagnostics_interface_ptr_->add_key_value(
159+
"is_num_pillars_within_range", is_num_pillars_within_range);
160+
if (!is_num_pillars_within_range) {
161+
std::stringstream message;
162+
message << "CenterPointTRT::detect: The actual number of pillars exceeds its maximum value, "
163+
<< "which may limit the detection performance.";
164+
diagnostics_interface_ptr_->update_level_and_message(
165+
diagnostic_msgs::msg::DiagnosticStatus::WARN, message.str());
166+
}
153167

154168
std::vector<autoware_perception_msgs::msg::DetectedObject> raw_objects;
155169
raw_objects.reserve(det_boxes3d.size());
@@ -169,6 +183,7 @@ void LidarCenterPointNode::pointCloudCallback(
169183
objects_pub_->publish(output_msg);
170184
published_time_publisher_->publish_if_subscribed(objects_pub_, output_msg.header.stamp);
171185
}
186+
diagnostics_interface_ptr_->publish(input_pointcloud_msg->header.stamp);
172187

173188
// add processing time for debug
174189
if (debug_publisher_ptr_ && stop_watch_ptr_) {

0 commit comments

Comments
 (0)