[Discourse.ros.org] [Next Generation ROS] Image and PointCloud2 performance on ROS2
When I try to use big data message by python code such as Camera Image or PointCloud2 on ROS2, I found the performance is terrible.
1. Launch [ros2_intel_realsense](https://github.com/intel/ros2_intel_realsense) by realsense_ros2_camera, and subscribe "/camera/depth/color/points" by "ros2 topic echo /camera/depth/color/points". It will cost dozens of seconds to print out the PointCloud2 (640x480) data. On ros 1, rostopic shows data immediately.
2. When write example code to subscribe "/camera/depth/color/points(sensor_msgs::msgs::PointCloud2)" by both cpp subscribe api and python subscribe code, the fps is different. cpp-code is 4hz, but python-code only 0.4hz.
I thought for ROS2 it should not be a problem, because ROS2 was created specifically to solve this particular and other ROS1 problems. If issue remains in ROS2, I'd try to use same approach as ROS1 and pass Images and PClouds through shared memory.
Update debugging status:
I have wrote test code [rttest_sample](https://github.com/yechun1/rttest_sample) to publish PointCloud2 on topic /rttest_sample. the result is:
Set data size as 64x48, "ros2 topic echo /rttest_sample" works.
Set data size as 640x48, "ros2 topic echo /rttest_sample" cost ~10s.
Set data size as 640x480, "ros2 topic echo /rttest_sample" cost more then 60s.
While I use ros1_bridge and echo the same(ros2) topic in ros1, it works will with 640x480.
debugging point to code:
[INFO] [rcl]: Initializing wait set with '0' subscriptions, '2' guard conditions, '0' timers, '0' clients, '0' services
timeout = -1
[INFO] [rcl]: Waiting without timeout
[INFO] [rcl]: Timeout calculated based on next scheduled timer: false
**// Wait. here**
rmw_ret_t ret = rmw_wait(
[Discourse.ros.org] [Next Generation ROS] Image and PointCloud2 performance issue on ROS2 python
Thanks for your comments, I have just updated the issue status, here is only one issue left that why python is much slower than APP to subscribe PointCloud2 msg, I will try PYTHONOPTIMIZE to verify.
We also find ROS2 performance is worse than ROS, not only python but CPP. I'll report a new topic to discuss.