Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

topic_tools: throttling when rostime jump backward #1397

Merged
merged 1 commit into from
May 18, 2018

Conversation

furushchev
Copy link
Contributor

Closes #1396

  • Reset internal variable on rostime moving backward
  • Added test code for the situation

@mikepurvis
Copy link
Member

Should there be some kind of threshold for the jump, or at least a flag to disable this behaviour? I'm thinking a default that the jump-back-in-time logic is only triggered for a delta > 1s or something.

Admittedly, I may be grasping at straws here, but I'm imagining a scenario where two separate machines are publishing the same topic with slightly offset clocks, or even with the same clock but network lag which causes the messages to interleave.

Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If time moves backwards it's definitely an event. Realistically you should never have two clocks publishing, that's basically guarenteed to cause bad behavior due to interleaving. And non-monotonic clocks will wreak havoc hear and elsewhere.

This is the same logic that tf users to clear the buffer: https://github.com/ros/geometry2/blob/melodic-devel/tf2_ros/src/transform_listener.cpp#L105

@@ -126,6 +126,11 @@ void in_cb(const ros::MessageEvent<ShapeShifter>& msg_event)
now.fromSec(ros::WallTime::now().toSec());
else
now = ros::Time::now();
if (g_last_time > now)
{
ROS_WARN("Detected jump back in time.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should state what it's doing, not just that it detected. Something like "Detected jump back in time, resetting throttle period to now for ***."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikepurvis @tfoote Thank you very much for your review!

@tfoote I updated the message. Please check. 👍

@tfoote
Copy link
Member

tfoote commented May 15, 2018

lgtm, we don't really have a way to address the throttle instance so at least it's know that some throttle will be updated.

@dirk-thomas
Copy link
Member

Thank you for the patch.

@dirk-thomas dirk-thomas merged commit 231f3e4 into ros:melodic-devel May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants