Skip to content

Commit 2433ef7

Browse files
committed
fix(multi_object_tracker): fix publish interval adjust timing (autowarefoundation#7904)
refactor: optimize publish time check in multi_object_tracker_node.cpp Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent c8afe97 commit 2433ef7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

perception/multi_object_tracker/src/multi_object_tracker_core.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ void MultiObjectTracker::onTrigger()
221221
} else {
222222
// Publish if the next publish time is close
223223
const double minimum_publish_interval = publisher_period_ * 0.70; // 70% of the period
224-
if ((current_time - last_published_time_).seconds() > minimum_publish_interval) {
225-
checkAndPublish(current_time);
224+
const rclcpp::Time publish_time = this->now();
225+
if ((publish_time - last_published_time_).seconds() > minimum_publish_interval) {
226+
checkAndPublish(publish_time);
226227
}
227228
}
228229
}

0 commit comments

Comments
 (0)