ros1_bridge function for converting generic message types #377
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.
This adds functions to convert between generic message types for ROS1 (ShapeShifter) and ROS2 (SerializedMessage)
This is useful for custom bag recording tools. For us specifically, there is a tool (action_monitor) that records certain topics at specific times based on the current robot action. If robot is idle, we record very few topics. If robot is navigating, we record many more topics.
We'de like to extend this tool to record both ROS1 and ROS2 topics at the same time to a ROS1 bag format.
If we just used dynamic_bridge to bridge all ROS2 topics, we'de pay heavy penalty bridging unnecessary topics when robot is idle.
To subscribe to an arbitrary ROS2 topic, rclcpp provides create_generic_subscription which invokes a callback that takes SerializedMessage. Because there is no concrete type at compile time we cannot use convert_2_to_1.
Because each ros1_bridge::Factory is templated on both ROS1 and ROS2 message types, it has all the concrete type information to perform the generic message conversion.