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 c97630d

Browse files
committedMay 13, 2024·
Revert "fix: remove debug messages"
This reverts commit 725a49e.
1 parent 686b376 commit c97630d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
 

‎perception/multi_object_tracker/src/multi_object_tracker_core.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,44 @@ void MultiObjectTracker::onMessage(const ObjectsList & objects_list)
255255
}
256256
// process end
257257
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 */
258296
}
259297

260298
void MultiObjectTracker::runProcess(

‎perception/multi_object_tracker/src/processor/input_manager.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,20 @@ void InputManager::optimizeTimings()
253253
selected_stream_interval = interval_mean;
254254
selected_stream_interval_std = std::sqrt(interval_var);
255255
}
256+
257+
/* DEBUG */
258+
std::string long_name, short_name;
259+
rclcpp::Time latest_measurement_time, latest_message_time;
260+
input_stream->getNames(long_name, short_name);
261+
input_stream->getTimestamps(latest_measurement_time, latest_message_time);
262+
double latency_message = (node_.now() - latest_message_time).seconds();
263+
double latency_measurement = (node_.now() - latest_measurement_time).seconds();
264+
RCLCPP_INFO(
265+
node_.get_logger(),
266+
"InputManager::getObjects %s: latency mean: %f, std: %f, interval mean: "
267+
"%f, std: %f, latest measurement latency: %f, latest message latency: %f",
268+
long_name.c_str(), latency_mean, std::sqrt(latency_var), interval_mean,
269+
std::sqrt(interval_var), latency_measurement, latency_message);
256270
}
257271
}
258272

0 commit comments

Comments
 (0)
Please sign in to comment.