Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: kminoda <[email protected]>
  • Loading branch information
kminoda committed Dec 27, 2024
1 parent 9358ecb commit 6f0b47b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PointPaintingFusionNode
void postprocess(sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg) override;

rclcpp::Publisher<DetectedObjects>::SharedPtr obj_pub_ptr_;
std::unique_ptr<autoware::universe_utils::DiagnosticInterface> diagnostics_interface_ptr_;
std::unique_ptr<autoware::universe_utils::DiagnosticsInterface> diagnostics_interface_ptr_;

int omp_num_threads_{1};
float score_threshold_{0.0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ PointPaintingFusionNode::PointPaintingFusionNode(const rclcpp::NodeOptions & opt
detector_ptr_ = std::make_unique<image_projection_based_fusion::PointPaintingTRT>(
encoder_param, head_param, densification_param, config);
diagnostics_interface_ptr_ =
std::make_unique<autoware::universe_utils::DiagnosticInterface>(this, "pointpainting_trt");
std::make_unique<autoware::universe_utils::DiagnosticsInterface>(this, "pointpainting_trt");

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

Expand Down Expand Up @@ -385,6 +385,7 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
{
std::unique_ptr<ScopedTimeTrack> st_ptr;
if (time_keeper_) st_ptr = std::make_unique<ScopedTimeTrack>(__func__, *time_keeper_);
diagnostics_interface_ptr_->clear();

const auto objects_sub_count =
obj_pub_ptr_->get_subscription_count() + obj_pub_ptr_->get_intra_process_subscription_count();
Expand All @@ -399,10 +400,20 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
}

std::vector<autoware::lidar_centerpoint::Box3D> det_boxes3d;
bool is_success = detector_ptr_->detect(painted_pointcloud_msg, tf_buffer_, det_boxes3d);
bool is_num_pillars_within_range = true;
bool is_success = detector_ptr_->detect(painted_pointcloud_msg, tf_buffer_, det_boxes3d, is_num_pillars_within_range);
if (!is_success) {
return;
}
diagnostics_interface_ptr_->add_key_value(
"is_num_pillars_within_range", is_num_pillars_within_range);
if (!is_num_pillars_within_range) {
std::stringstream message;
message << "CenterPointTRT::detect: The actual number of pillars exceeds its maximum value, "
<< "which may limit the detection performance.";
diagnostics_interface_ptr_->update_level_and_message(
diagnostic_msgs::msg::DiagnosticStatus::WARN, message.str());
}

std::vector<autoware_perception_msgs::msg::DetectedObject> raw_objects;
raw_objects.reserve(det_boxes3d.size());
Expand All @@ -421,6 +432,7 @@ void PointPaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
if (objects_sub_count > 0) {
obj_pub_ptr_->publish(output_msg);
}
diagnostics_interface_ptr_->publish(painted_pointcloud_msg.header.stamp);

Check notice on line 435 in perception/autoware_image_projection_based_fusion/src/pointpainting_fusion/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Complex Method

PointPaintingFusionNode::postprocess has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
}

bool PointPaintingFusionNode::out_of_scope(__attribute__((unused)) const DetectedObjects & obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class LidarCenterPointNode : public rclcpp::Node
DetectionClassRemapper detection_class_remapper_;

std::unique_ptr<CenterPointTRT> detector_ptr_{nullptr};
std::unique_ptr<autoware::universe_utils::DiagnosticInterface> diagnostics_interface_ptr_;
std::unique_ptr<autoware::universe_utils::DiagnosticsInterface> diagnostics_interface_ptr_;

// debugger
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_{
Expand Down
2 changes: 1 addition & 1 deletion perception/autoware_lidar_centerpoint/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ LidarCenterPointNode::LidarCenterPointNode(const rclcpp::NodeOptions & node_opti
detector_ptr_ =
std::make_unique<CenterPointTRT>(encoder_param, head_param, densification_param, config);
diagnostics_interface_ptr_ =
std::make_unique<autoware::universe_utils::DiagnosticInterface>(this, "centerpoint_trt");
std::make_unique<autoware::universe_utils::DiagnosticsInterface>(this, "centerpoint_trt");

Check warning on line 111 in perception/autoware_lidar_centerpoint/src/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Large Method

LidarCenterPointNode::LidarCenterPointNode increases from 87 to 89 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.

pointcloud_sub_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(
"~/input/pointcloud", rclcpp::SensorDataQoS{}.keep_last(1),
Expand Down

0 comments on commit 6f0b47b

Please sign in to comment.