Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6dd5561

Browse files
committedMar 8, 2024
feat: add latency time for association merger
Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>
1 parent 75067c5 commit 6dd5561

File tree

2 files changed

+19
-0
lines changed
  • perception/object_merger

2 files changed

+19
-0
lines changed
 

‎perception/object_merger/include/object_merger/node.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "object_merger/data_association/data_association.hpp"
1919

2020
#include <rclcpp/rclcpp.hpp>
21+
#include <tier4_autoware_utils/ros/debug_publisher.hpp>
22+
#include <tier4_autoware_utils/system/stop_watch.hpp>
2123

2224
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
2325

@@ -81,6 +83,10 @@ class ObjectAssociationMergerNode : public rclcpp::Node
8183
std::map<int, double> generalized_iou_threshold;
8284
std::map<int /*class label*/, double /*distance_threshold*/> distance_threshold_map;
8385
} overlapped_judge_param_;
86+
87+
// debug publisher
88+
std::unique_ptr<tier4_autoware_utils::DebugPublisher> processing_time_publisher_;
89+
std::unique_ptr<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
8490
};
8591
} // namespace object_association
8692

‎perception/object_merger/src/object_association_merger/node.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ ObjectAssociationMergerNode::ObjectAssociationMergerNode(const rclcpp::NodeOptio
118118

119119
merged_object_pub_ = create_publisher<autoware_auto_perception_msgs::msg::DetectedObjects>(
120120
"output/object", rclcpp::QoS{1});
121+
122+
// Debug publisher
123+
processing_time_publisher_ =
124+
std::make_unique<tier4_autoware_utils::DebugPublisher>(this, "object_association_merger");
125+
stop_watch_ptr_ = std::make_unique<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>>();
126+
stop_watch_ptr_->tic("cyclic_time");
127+
stop_watch_ptr_->tic("processing_time");
121128
}
122129

123130
void ObjectAssociationMergerNode::objectsCallback(
@@ -128,6 +135,7 @@ void ObjectAssociationMergerNode::objectsCallback(
128135
if (merged_object_pub_->get_subscription_count() < 1) {
129136
return;
130137
}
138+
stop_watch_ptr_->toc("processing_time", true);
131139

132140
/* transform to base_link coordinate */
133141
autoware_auto_perception_msgs::msg::DetectedObjects transformed_objects0, transformed_objects1;
@@ -215,6 +223,11 @@ void ObjectAssociationMergerNode::objectsCallback(
215223

216224
// publish output msg
217225
merged_object_pub_->publish(output_msg);
226+
// publish processing time
227+
processing_time_publisher_->publish<tier4_debug_msgs::msg::Float64Stamped>(
228+
"debug/cyclic_time_ms", stop_watch_ptr_->toc("cyclic_time", true));
229+
processing_time_publisher_->publish<tier4_debug_msgs::msg::Float64Stamped>(
230+
"debug/processing_time_ms", stop_watch_ptr_->toc("processing_time", true));
218231
}
219232
} // namespace object_association
220233

0 commit comments

Comments
 (0)
Please sign in to comment.