Skip to content

Commit

Permalink
fix(multi_object_tracker): fix publish interval adjust timing (#1402)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
technolojin authored Jul 9, 2024
1 parent c8afe97 commit 49d0c35
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ void MultiObjectTracker::onTrigger()
} else {
// Publish if the next publish time is close
const double minimum_publish_interval = publisher_period_ * 0.70; // 70% of the period
if ((current_time - last_published_time_).seconds() > minimum_publish_interval) {
checkAndPublish(current_time);
const rclcpp::Time publish_time = this->now();
if ((publish_time - last_published_time_).seconds() > minimum_publish_interval) {
checkAndPublish(publish_time);
}
}
}
Expand Down

0 comments on commit 49d0c35

Please sign in to comment.