Update RO2 publisher sink to use NodeInterfaces #68
+129
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
First off — thanks for creating DataTamer. It’s an awesome library.
I’ve been developing a ROS2 Jazzy system using a composition-based architecture with both lifecycle and regular nodes. We use DataTamer to collect time-series data and pipe it into Foxglove, and the ROS2 publisher sink makes that integration super smooth.
I ran into an issue when adding the ROS2 publisher sink inside composable nodes. In composition, node ownership changes — the executor owns the shared pointer and spins the nodes — so you often don’t have direct access to the node
shared_ptrin the same way as when running standalone nodes. This affects both lifecycle and regular nodes.I tried workarounds like
shared_from_this(), but those are fragile and can easily lead to invalid weak pointers.I noticed recent support for lifecycle nodes was added via additional constructor overloads, and this PR builds on that idea by updating
ROS2PublisherSinkto accept aNodeInterfacesfaçade instead of requiring ashared_ptr. Since this sink only needs the topics interface, this lets users pass either:NodeInterfacesobject directlyNode/LifecycleNodeshared_ptrto eitherwhile remaining fully backwards compatible.
I took my colleague @jlack1987’s advice (he’s been working with DataTamer for a while) and structured this to preserve all existing usage patterns.
Thanks again — happy to adjust anything if needed!