-
Notifications
You must be signed in to change notification settings - Fork 912
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
ros::Rate should use steady_clock #1337
Comments
You could make a PR to add a Also as already noted on http://wiki.ros.org/roscpp_tutorials/Tutorials/Timers you should not rely on any of those for realtime loops. |
Blah, I did not consider |
But wouldn't that be even more confusing and break a lot of existing cases? Or do you propose to make That again would make it inconsistent with |
Hi there, without having looked to much into ros::Time, I wonder if a rewrite towards std::chrono could be helpful. Right now, I am seeing code for WIN32, Apple... which I guess should be all the same if one uses std::chrono. Then, ros::Time, ros::Rate, ros::Timer could be templated classes, with the clock source as template argument. If you are afraid of introducing new behaviour, you could use std::chrono::system_clock as default template argument. I still see it as a bug (walltime instead of monotonic). albeit a seldom occurring one. Regards, Matthias |
AFAIK ROS2 is requiring C++11 and using std::chrono, but here (in ROS1) we don't require C++11 |
As of Melodic, C++14 is being allowed everywhere (though we will not change the public core APIs to use C++14 features unless there is a very good reason to do so). So moving towards std::chrono could be an option for Melodic and newer if it doesn't affect the public API. |
We could use https://github.com/llvm-mirror/libcxx/blob/master/src/chrono.cpp So while we could shed some custom logic of our own, I don't think it will be magically better or anything. As for Having a separate |
Hi!
There are some examples, that might tempt people to use ros::Rate for their (possibly) real time control loop. But, as far as I can tell, ros::Rate uses walltime clock, which may skip (NTP, someone setting Date and Time, ...). When I use ros::Rate, I am usually not interested in how much "walltime" was spend, but the real time difference.
Please consider at least leaving a clear statement in the Tutorials (I know, Timers are recommended, but they seem to use walltime as well).
Regards,
Matthias
The text was updated successfully, but these errors were encountered: