Skip to content

Commit c1a85b8

Browse files
committed
fix: check if interval is negative
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent 094110f commit c1a85b8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

perception/multi_object_tracker/src/processor/input_manager.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ void InputStream::updateTimingStatus(const rclcpp::Time & now, const rclcpp::Tim
9898
// Calculate interval, Update interval statistics
9999
if (initial_count_ > 4) {
100100
const double interval = (now - latest_message_time_).seconds();
101-
if (initial_count_ < 24) {
101+
if (interval < 0.0) {
102+
RCLCPP_WARN(
103+
node_.get_logger(),
104+
"InputManager::updateTimingStatus %s: Negative interval detected, now: %f, "
105+
"latest_message_time_: %f",
106+
long_name_.c_str(), now.seconds(), latest_message_time_.seconds());
107+
} else if (initial_count_ < 24) {
102108
// Initialization
103109
constexpr double initial_gain = 0.5;
104110
interval_mean_ = (1.0 - initial_gain) * interval_mean_ + initial_gain * interval;

0 commit comments

Comments
 (0)