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
After defining a type adapter, custom data structures can be used directly by publishers and subscribers, which helps to avoid additional work for the programmer and potential sources of errors. This is especially useful when working with complex data types, such as when converting OpenCV’s cv::Mat to ROS’s sensor_msgs/msg/Image type.
Following is a discussion for a couple of approaches that we might consider for supporting type adaption. I'm limiting the discussion to Publishers as the concepts can be applied to other entities such as Subscriptions, Services, Clients, Actions.
Option1a: Incorporate the typeAdapter into the optional Options parameter that is passed to Node#createPublisher()
In theory I like this idea but it seems like a TypeScript generic signature for Options could grow into something really awkward in the future if the adapter pattern is extended to services, clients and actions. So I'm only mentioning it for completeness.
Option-2: Only implement TypeAdapter and invoke it manually
This simpler approach requires manually invocation of the typeAdapter before calling publish(), e.g.,
publish(adapter.convertToRos(myObj))
No modification is required to Publisher for the TypeAdapter.
Wrapping up: this feature request falls in the nice-to-have category for me. I wanted to post this for additional comment and interest level.
The text was updated successfully, but these errors were encountered:
Proposal: Supporting type adaptation for Publishers and Subscriptions similar to the rclcpp TypeAdapter that will be included in the Humble release.
From the rclcpp relnotes:
I've implementing this convenience on a couple of projects that required converting messages to/from an application objects such as https://github.com/ros2jsguy/three.math/tree/master/src.
Following is a discussion for a couple of approaches that we might consider for supporting type adaption. I'm limiting the discussion to Publishers as the concepts can be applied to other entities such as Subscriptions, Services, Clients, Actions.
Type adaptation for Ros Messages:
Option-1: extend Node#createPublisher() with an additional optional TypeAdapter parameter
Option1a: Incorporate the typeAdapter into the optional Options parameter that is passed to Node#createPublisher()
In theory I like this idea but it seems like a TypeScript generic signature for Options could grow into something really awkward in the future if the adapter pattern is extended to services, clients and actions. So I'm only mentioning it for completeness.
Option-2: Only implement TypeAdapter and invoke it manually
This simpler approach requires manually invocation of the typeAdapter before calling publish(), e.g.,
No modification is required to Publisher for the TypeAdapter.
Wrapping up: this feature request falls in the nice-to-have category for me. I wanted to post this for additional comment and interest level.
The text was updated successfully, but these errors were encountered: