Skip to content

Commit

Permalink
Visualize Costmaps when jumping back in ROS time (#81)
Browse files Browse the repository at this point in the history
* Publish costmaps even when ROS time jumps backwards

* Remove prev variable

* shorten to (last_publish_ - now).toSec()
  • Loading branch information
leoniegadner authored Jun 2, 2023
1 parent 8091aac commit 894f8f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion costmap_2d/src/costmap_2d_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ void Costmap2DROS::mapUpdateLoop(double frequency)
publisher_->updateBounds(x0, xn, y0, yn);

ros::Time now = ros::Time::now();
if (last_publish_ + publish_cycle < now)
ROS_WARN_COND(now < last_publish_, "ROS Time jumped backwards by %.3f s. Publishing costmaps anyway.", (last_publish_ - now).toSec());
if (now < last_publish_ || last_publish_ + publish_cycle < now)
{
publisher_->publishCostmap();
last_publish_ = now;
Expand Down

0 comments on commit 894f8f4

Please sign in to comment.