Skip to content
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

Zero-copy point cloud subscriber in ROS2 #2353

Closed
ravijo opened this issue May 18, 2022 · 16 comments
Closed

Zero-copy point cloud subscriber in ROS2 #2353

ravijo opened this issue May 18, 2022 · 16 comments
Labels

Comments

@ravijo
Copy link

ravijo commented May 18, 2022

The components in ROS2 provide Zero-copy communication. Luckily, the realsense package comes with this option.

Quoting the following from Efficient intra-process communication section:

Our ROS2 Wrapper node supports zero-copy communications if loaded in the same process as a subscriber node. This can reduce copy times on image topics (not point-cloud or others), especially with big frame resolutions and high FPS.

Does it mean that point clouds are not supported for zero-copy if loaded in the same process as a subscriber node?

@MartyG-RealSense
Copy link
Collaborator

Hi @ravijo Another way to interpret that statement would be that copy times are not reduced for pointclouds.

@ravijo
Copy link
Author

ravijo commented May 18, 2022

Hi @MartyG-RealSense

Sorry for the confusion. Does that mean intra-process communication isn't helpful in the case of point cloud??? How to achieve zero-copy communication for point clouds then?

@MartyG-RealSense
Copy link
Collaborator

That would be my interpretation that zero-copy would not be useful for pointclouds.

Someone in the link below wrote a ROS2 module that was tested with ROS2 Galactic that supports pointclouds with zero-copy, though I cannot guarantee how well it will work with the RealSense ROS2 wrapper.

https://github.com/ZhenshengLee/ros2_shm_msgs

@ravijo
Copy link
Author

ravijo commented May 18, 2022

I see.

It is using shared memory architecture underneath.

Thank you for the link.

@MartyG-RealSense
Copy link
Collaborator

Hi @ravijo Do you require further assistance with this case, please? Thanks!

@ravijo
Copy link
Author

ravijo commented May 25, 2022

@MartyG-RealSense: I am not dealing with it at prersent. So it is better to close this issue. Thanks for the kind support.

@MartyG-RealSense
Copy link
Collaborator

You are very welcome. Thanks very much for the update!

@ZhenshengLee
Copy link

Someone in the link below wrote a ROS2 module that was tested with ROS2 Galactic that supports pointclouds with zero-copy, though I cannot guarantee how well it will work with the RealSense ROS2 wrapper.

@MartyG-RealSense @ravijo

Hi, this lib https://github.com/ZhenshengLee/ros2_shm_msgs has been used in the custom version of ros2_v4l2_camera
and rslidar_sdk, and the performance improvement is awesome!

see https://github.com/ZhenshengLee/ros2_v4l2_camera
and https://github.com/ros2driver/rslidar_sdk/tree/outdoor/dev_opt_shm

if you need any help to merge this module into the RealSense ROS2 , feel free to ping me.

@MartyG-RealSense
Copy link
Collaborator

Thanks so much @ZhenshengLee for sharing this with the RealSense ROS community!

@toan70411hd91
Copy link

Hello @MartyG-RealSense, I am using ROS2 Realsense Wrapper (Humble, https://github.com/IntelRealSense/realsense-ros/tree/ros2-development). As you mentioned the link https://github.com/ZhenshengLee/ros2_shm_msgs above (introduced by @ZhenshengLee ). I have made a comparison between ROS2 Realsense Wrapper (Humble) and ros2_shm_msgs (Humble) regarding to the topic frequency and CPU consumption. I have found that the performance of ROS2 Realsense Wrapper (Humble) and ros2_shm_msgs are almost same when publishing the pointcloud. I just wonder whether some modules in ros2_shm_msgs are merged into Realsense ROS2 or not? Or Type adaption is considered in ROS2 Realsense Wrapper (Humble) or not? I guess IT'S NOT since I could not found the related contents in the Wrapper source code. Can you please confirm this information?

@ZhenshengLee
Copy link

@toan70411hd91

I just wonder whether some modules in ros2_shm_msgs are merged into Realsense ROS2 or not?

No, nothing has been merged.

Or Type adaption is considered in ROS2 Realsense Wrapper (Humble) or not?

It's unknown for me, because I didn't track this feature.

@ZhenshengLee
Copy link

@toan70411hd91
You can use zero-copy through intra-process comm which is provided officially, check it in https://github.com/IntelRealSense/realsense-ros#efficient-intra-process-communication

@toan70411hd91
Copy link

toan70411hd91 commented Dec 6, 2022

@ZhenshengLee thank you so much for your information and quick helps. May I ask you some questions related to ros2_shm_msgs?

  1. In folder "intra", i found that you added intra type adaption within cpu. Currently, ros2_shm_msgs only support type adaption (within CPU) for image only, but not for pointcloud?
  2. Is it correct if "zero-copy" in ros2_shm_msgs called "minimal copy" when we publish topics?
  3. In your opinion, whether the performance (regarding to speed and CPU consumption) much better if we use type adaption?

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).

@ZhenshengLee
Copy link

@ZhenshengLee thank you so much for your information and quick helps. May I ask you some questions related to ros2_shm_msgs?

  1. In folder "intra", i found that you added intra type adaption within cpu. Currently, ros2_shm_msgs only support type adaption (within CPU) for image only, but not for pointcloud?
  2. Is it correct if "zero-copy" in ros2_shm_msgs called "minimal copy" when we publish topics?
  3. In your opinion, whether the performance (regarding to speed and CPU consumption) much better if we use type adaption?

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).

@toan70411hd91 please post this issue in https://github.com/ZhenshengLee/ros2_shm_msgs

I will find time to answer this.

Thanks!

@toan70411hd91
Copy link

@ZhenshengLee Thank you so much for your active and quick helps. I posted this issue in https://github.com/ZhenshengLee/ros2_shm_msgs

@ZhenshengLee
Copy link

Thank you so much for your active and quick helps. I posted this issue in

anyone interested would follow this
ZhenshengLee/ros2_shm_msgs#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants