-
Notifications
You must be signed in to change notification settings - Fork 22
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
[QST] shm_msg based zero-copy, intra-process based zero-copy, and type adaption. #25
Comments
type adaption feature is nothing with ros2_shm_msgs, but as a comparsion with shm_msg based zero-copy which provided by this repo. There are currently two way to achieve zero-copy transport, one is intra-process, the other is shm_msg based zero-copy
the type adaption is the feature extened from intra-process comm, so it's just the alternative of shm_msg based zero-copy. |
the type adaption feature mainly uses a data container to avoid type-conversion between ros-msg-type and algor-data-type, the algor-data-type is up to what library you are using. For example, opencv, pcl and open3d. for example, the type adaption feature for opencv-image is implemented in ros-perception/vision_opencv#441 , this is done by the application developer, not middleware developer. I've created an issue about support pointcloud type adaption here ros-perception/perception_pcl#386 in |
It depends on the scope we are talking about. If the scope is within dds, zero-copy means 0 copy of course, that's why it's called zero copy. When the scope extends to ROS2, the question is: How many copies is it in the whole chain of pub and sub? In IPC on top of DDS, there will be at least two types of copies that cannot be avoided, type-conversion and (de)serialization. So it's true that minimal copy happens in ros2_shm_msgs. P.S. type-conversion can be avoided with type adaption feature ros2/rclcpp#1849, and (de)serialization will be avoided in the future by type adaption feature ros2/rclcpp#1665 But as what I said before, type adaption is about intra-process-comm, no related with shm_msg based zero-copy provided in this repo. |
I think you want to ask if type adaption will improve the performance. |
More info is needed of your test. But the conclusion I can tell you is that
this article https://www.apex.ai/post/zero-copy-strings-and-bounded-vectors is using the idea of this repo, which creates a new msg definition in idl that is Bounded Vectors. This repo uses array, which is a type in cpp std with bounded size, see Lines 1 to 4 in fd8043a
|
Feel free to star the repo if it helps. Thanks. |
@ZhenshengLee Thank you so much for your explanation in details, and it deserves to be starred. If you don't mind, I would like to ask you a bit more. I have checked the ROS2 Humble, and I found this information: "By default, Loaned Messages will try to borrow the memory from underlying middleware if it supports Loaned Messages. The ROS_DISABLE_LOANED_MESSAGES environment variable can be used to disable Loaned Messages, and fallback to normal publisher and subscription behavior, without any code changes or middleware configuration", in this https://docs.ros.org/en/humble/How-To-Guides/Disabling-ZeroCopy-loaned-messages.html. I do not understand clearly "if it supports Loaned Messages". What "it" represents for? If "it" represents for underlying middleware, whether ROS2 Humble already supports Loaned Messages in default or we have to do something more to borrow the memory in ROS2 Humble? |
rclcpp depends on dds, so the loaned api needs to be supported by rclcpp and dds. specifically:
Please read more about the arch of ros2, make sure you know about the relationship between ros2 and dds https://design.ros2.org/articles/ros_on_dds.html |
@ZhenshengLee Thanks so much for your info ... |
Closing this. |
@ZhenshengLee thank you so much for your information and quick helps. May I ask you some questions related to ros2_shm_msgs?
Even I did not use https://github.com/IntelRealSense/realsense-ros#efficient-intra-process-communication, the performance of ROS2 Realsense Wrapper (regarding to speed and CPU consumption) is almost same with ros2_shm-msgs. I am not sure the hints inside since i am quite new in this topic. Maybe, my tested point-cloud data is small (camera resolution 640x480, with decimation filter).
The text was updated successfully, but these errors were encountered: