Skip to content

Commit 4e18b80

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

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
@@ -222,8 +222,9 @@ void MultiObjectTracker::onTrigger()
222222
} else {
223223
// Publish if the next publish time is close
224224
const double minimum_publish_interval = publisher_period_ * 0.70; // 70% of the period
225-
if ((current_time - last_published_time_).seconds() > minimum_publish_interval) {
226-
checkAndPublish(current_time);
225+
const rclcpp::Time publish_time = this->now();
226+
if ((publish_time - last_published_time_).seconds() > minimum_publish_interval) {
227+
checkAndPublish(publish_time);
227228
}
228229
}
229230
}

0 commit comments

Comments
 (0)