@@ -255,6 +255,44 @@ void MultiObjectTracker::onMessage(const ObjectsList & objects_list)
255
255
}
256
256
// process end
257
257
debugger_->endMeasurementTime (this ->now ());
258
+
259
+ /* DEBUG */
260
+ const rclcpp::Time latest_time (objects_list.back ().second .header .stamp );
261
+ RCLCPP_INFO (
262
+ this ->get_logger (), " MultiObjectTracker::onMessage Objects time range: %f - %f" ,
263
+ (current_time - latest_time).seconds (), (current_time - oldest_time).seconds ());
264
+
265
+ // count objects on each channel
266
+ std::vector<int > object_counts;
267
+ object_counts.resize (input_channel_size_);
268
+ // initialize to zero
269
+ for (size_t i = 0 ; i < input_channel_size_; i++) {
270
+ object_counts[i] = 0 ;
271
+ }
272
+ for (const auto & objects_data : objects_list) {
273
+ object_counts[objects_data.first ] += 1 ;
274
+ }
275
+ // print result
276
+ std::string object_counts_str = " MultiObjectTracker::onMessage Object counts: " ;
277
+ for (size_t i = 0 ; i < input_channel_size_; i++) {
278
+ object_counts_str +=
279
+ input_channels_[i].long_name + " " + std::to_string (object_counts[i]) + " " ;
280
+ }
281
+ RCLCPP_INFO (this ->get_logger (), object_counts_str.c_str ());
282
+
283
+ std::string object_info_str = " " ;
284
+ object_info_str += " MultiObjectTracker::onMessage Objects channel and time: \n " ;
285
+ for (const auto & objects_data : objects_list) {
286
+ const auto & objects = objects_data.second ;
287
+ const auto & channel_index = objects_data.first ;
288
+ const auto & time = rclcpp::Time (objects.header .stamp );
289
+ // print object information
290
+ object_info_str += input_channels_[channel_index].long_name + " " +
291
+ std::to_string ((current_time - time ).seconds ()) + " \n " ;
292
+ }
293
+ RCLCPP_INFO (this ->get_logger (), object_info_str.c_str ());
294
+
295
+ /* DEBUG END */
258
296
}
259
297
260
298
void MultiObjectTracker::runProcess (
0 commit comments