-
Notifications
You must be signed in to change notification settings - Fork 116
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
Resolution of ros::Duration::sleep() limited by implicit sleep in nanoseconds #133
Comments
When running at such a high frequency of 400Hz, I would think WallDuration/WallTime is better. |
Hi @MatthijsBurgh, I have tried your suggestion. However, running in WallTime means that any high-rate module will not listen to the updates of ROS Time. Thus, if you slow down, speed up, or pause
The nodes' notion of time will be different from that of the sensor and actuator clocks, leading to ambiguous results (e.g. if simulation is running slower, should a filter propagate as usual, or wait for the next clock tick?). Furthermore, if you have Time-based events, they will be triggered at the wrong instant. Thu, Breaking away into a different time domain can increase the number of issues, but not solve the problem at the root. Practical example (Image source: https://gfycat.com/handmadecolossaldrongo-hotcoffee9520) Hence, that's why my suggestion goes into the direction of making the minimum wait time an optional argument. WDYT? Best, |
I agree with you. The WallTime doesn't slow down. I expected your process to be time critical, because of the high frequency. I think your case with such a high frequency, but want to sync with the ROS time, is very rare. And as ROS1 is going to the end of its life, I don't expect the maintainers to change it. |
What you mention makes sense 👍. I hope that this issue's info can be useful for future travelers of the ROS1 code, or authors of ROS2. Thank you for the feedback @MatthijsBurgh 💪 |
I can imagine a PR along these lines could get merged: compare the intended sleep duration with the |
@YoshuaNava #137 should help with this. Could you verify? |
Hi,
By reading through the code of the
rostime
package I found thatros::Duration::sleep()
has an internal sleep in wall time with a length of1,000,000 nanoseconds = 1 millisecond
. Code -> https://github.com/ros/roscpp_core/blob/noetic-devel/rostime/src/time.cpp#L402As far as I understand, the internal call to
ros_wallsleep(0, 1000000);
is limiting the maximum resolution ofros::Duration::sleep()
to1 millisecond
in wall time.I intend to use
ros::Time
inside a node that spins at a rate of400Hz
(every2.5ms
), and this aspect of the current implementation would not allow me tosleep()
with a fine-enough resolution. Due to the1ms
resolution, sleep would wake up att=2ms
, ort=3ms
, but nevert=2.5ms
.Therefore, I have two related questions:
Thank you very much in advance.
Best regards,
Yoshua Nava
The text was updated successfully, but these errors were encountered: