You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nodes default to using ROS time if /clock is published #514
The presence of a publisher on the /clock topic causes nodes with unset use_sim_time parameter value to start using sim time. See this test.
I haven't found a discussion where we decided that should be the case, so wanted to highlight the current state of ROS time being "opt out" instead of "opt in" and verify it's what we want.
This was the original behavior in ROS. But it looks like it was updated circa 2010 to require the parameter to be set before startup of the node otherwise it won't subscribe to /clock instead of that just being best practice. We should probably switch to the existing behavior where the parameter is required to subscribe. Though I might suggest that we not require it prior to launch since we can now get a callback on a parameter change. And subscribe if the parameter is set to true.
the use_sim_time solely is what determines if ROS time is active in #559. /clock subscription is only created if it is set to true. Parameter callbacks are used, so this subscription will be created if the parameter is set at any time during the lifetime of the node, and removed if the parameter is set to false.
Activity
tfoote commentedon Jul 25, 2018
This was the original behavior in ROS. But it looks like it was updated circa 2010 to require the parameter to be set before startup of the node otherwise it won't subscribe to
/clockinstead of that just being best practice. We should probably switch to the existing behavior where the parameter is required to subscribe. Though I might suggest that we not require it prior to launch since we can now get a callback on a parameter change. And subscribe if the parameter is set to true.dhood commentedon Sep 25, 2018
the use_sim_time solely is what determines if ROS time is active in #559. /clock subscription is only created if it is set to true. Parameter callbacks are used, so this subscription will be created if the parameter is set at any time during the lifetime of the node, and removed if the parameter is set to false.
ros2/rclpy#240 tracks doing something similar in rclpy
Not creating rosout publisher instance unless required. (ros2#514)