-
Couldn't load subscription status.
- Fork 475
WIP: Allow to pass existing TimeSource via NodeOptions
#2673
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
base: rolling
Are you sure you want to change the base?
Conversation
e88dff2 to
a7d891f
Compare
Signed-off-by: Patrick Roncagliolo <[email protected]>
Signed-off-by: Patrick Roncagliolo <[email protected]>
edd5b50 to
31f87f6
Compare
|
@roncapat is this still in draft / WIP status? |
|
@fujitatomoya works nicely for me locally, but I'd like at least a review to understand what are your opinion on this / if I need to change something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roncapat thanks for the PR and feedback.
a several comments for now, i think we need to add more unit tests to verify this feature.
- if the
TimeSourceis shared withuse_clock_thread_disabled, this main Node must be spinning to update the clock for everybody else, otherwise other nodes sharingTimeSourcecannot get the update for the simulation clock information. user application must understand this condition. - i think if the
TimeSourceis shared, we cannot reset this in the subordinate Nodes during destruction. only main Node can do the reset once theTimeSourceis no longer required to keep? - The subordinate Nodes will not have
<nodename>/use_sim_timeparameter neither clock subscription QoS parameters, but only main Node. i think this is also important for user to know, i would suggest doc section in the code and ros2_documentation. - unit test required to make sure
TimeSourceis shared within multiple Nodes instances w/ and w/o simulation time. (currently only copy assignment test is added.) LifecycleNodesupport is missing? or is this on purpose for any constraints?
|
Thank you for the useful comments. I will surely try to satisfy every request, starting with Two quick replies:
Do you mean by documentation or via a console warning?
I think not, the |
| const rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr | ||
| time_source() const; | ||
|
|
||
| /// Set the time source to be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fujitatomoya something like this in code?
| /// Set the time source to be used. | |
| /// Set the time source to be used. | |
| /** | |
| * This will cause the node to use the provided TimeSource, | |
| * usually obtained by another node. User must understand that | |
| * either the node that owns the TimeSource has to be spinned, | |
| * or `use_clock_thread_` must be configured as `true` on that node. | |
| */ |
|
@fujitatomoya I'm back on this, sorry for the long wait. The remaining tasks are:
I need some guidance, and I would start from the documentation.
See my comment in the code.
Where to put in code? And suggested place/section in |
Addresses #2659 (task 1).
This allows to put an existing
TimeSourceinNodeOptionsso that a Node in the same process space can avoid re-creating aTimeSource.For example, the
TimeSourcemay be extracted viarclcpp::Node::get_node_time_source_interface()from an existing node, and passed viaNodeOptionsto all the others that share the process space.This is, for example, how I tested it locally in an application of mine.
Main benefit: a single subscriber can be shared when using
use_sim_time: better scaling for large rclcpp-composed simulations.