Skip to content

Commit

Permalink
fix(multi_object_tracker): fix publish interval adjust timing (autowa…
Browse files Browse the repository at this point in the history
…refoundation#7904) (#1400)

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 7777632 commit 4e18b80
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,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 4e18b80

Please sign in to comment.