rclpy icon indicating copy to clipboard operation
rclpy copied to clipboard

Very slow hd image publihser (not image transport) for hd image using rclpy

Open HasanFaragRob opened this issue 4 years ago • 1 comments

I am writing a ROS2 driver for Basler cameras in rclpy . I have 37 fps hd (1280*720) color stream from pypylon SDK and wanted to publish that data on topic. I observed, it is way slower, after measuring times in python ,we found out that publish times as below

[INFO] [1638433002.797805612] [basler_camera_controller]: 48.58187501667999 ms [INFO] [1638433002.870013551] [basler_camera_controller]: 54.1074660141021 ms

I see that you use pybind on rcl for rclpy. Maybe the bottleneck there. I did simple check on pybind in general and it is way slower than original implementation. Please guide me if there is a way to have higher publish rate?

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • binary
  • Version or commit hash:
    • foxy
  • DDS implementation:
    • cyclonedds
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

publish HD image on rclpy and measure timing on publish

HasanFaragRob avatar Dec 02 '21 08:12 HasanFaragRob

Hello, I noticed that you're using the Foxy distribution. Note that https://github.com/ros2/rosidl_python/pull/129 will almost definitely help your case (check https://github.com/ros2/rosidl_python/pull/129#issuecomment-857271999 for some primitive results), but it hasn't been backported to Foxy yet. That effort is underway in https://github.com/ros2/rosidl_python/pull/146 and should land soon!

A couple of other threads that may be relevant at best and only insightful at worst:

  • https://github.com/ros2/rmw_cyclonedds/issues/346
  • ROS 2 speed
  • DDS Tuning. Some additions were made to this guide following https://github.com/ros2/rmw_cyclonedds/issues/346.

Lastly, it may be helpful if you could profile the code and share where the bottlenecks are? Or alternatively, if you could provide an MVP that someone else could use for profiling!

aprotyas avatar Dec 02 '21 09:12 aprotyas