-
Notifications
You must be signed in to change notification settings - Fork 417
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
'/clock' Topic cannot change each loop step time from simulation time #2533
Comments
How do you create timer to publish messages ? |
您好,我已受到您的来信
|
Hi, Barry. In simulation, i used rclcpp::Rate loop_rate(ctrl_freq); And In a |
Please note that rclcpp::Rate use rclcpp/rclcpp/include/rclcpp/rate.hpp Lines 133 to 146 in 348e22a
|
I have been set use_sim_time=true |
assuming that |
As fujitatomoya said,you should modify code on creating Rate. rclcpp::Rate loop_rate(ctrl_freq, std::make_shared(RCL_ROS_TIME)); |
|
Foxy is already E.O.L, can you use |
For Foxy, you should create a Clock with RCL_ROS_TIME rclcpp/rclcpp/include/rclcpp/clock.hpp Lines 53 to 66 in b0c25d5
Create a new "Rate" like with above Clock. rclcpp/rclcpp/include/rclcpp/rate.hpp Line 115 in b0c25d5
BTW, foxy is EOL. |
Bug report
Required Info:
Steps to reproduce issue
In my node, i have publish topic '/clock' and set use_sim_time:=true. Although these settings change the results of this->now(), there is no implementation in which the frequency of program loops is independent of the simulation period.
Expected behavior
In ros1-Melodic, the same setting, will realize this result:
The first echo result is use_sim_time = false, and The second echo result is use_sim_time = true
Actual behavior
In ros2-foxy, humble also have these issue, like this:
when i set publish topic 'clock' and set use_sim_time:=true, the this->get_clock()->now() or this->now() can get the sim time, but the topic pub frequenct same not change by these settings.
The text was updated successfully, but these errors were encountered: