ros2 / ros2cli

ROS 2 command line interface tools
Apache License 2.0
173 stars 159 forks source link

ros2 topic hz perform worse than c++ code, also worse than result in another docker container #843

Open Chenxintang opened 1 year ago

Chenxintang commented 1 year ago

Bug report

Required Info:

Steps to reproduce issue

Additional information

Since code in both container are quite complicate, I can't paste the code here. As discussed in the blow question, ros2 topic hz result is lower than c++ code because the qos used is different. But why the hz results in different containers turn out to be different?

https://answers.ros.org/question/350753/ros2-topic-hz-provides-wrong-rate-for-larger-msgs/ Also, since ros2 topic hz result is not reliable, is therea a better way to track the transportaion stability between many nodes?

fujitatomoya commented 1 year ago

Ubuntu 18.04

Humble supports Ubuntu 22.04 as tier 1 platform. I am not sure if Humble can built with Ubuntu 18.04. (btw, Ubuntu 20.04 is community support.) see more details for https://docs.ros.org/en/humble/Releases/Release-Humble-Hawksbill.html#supported-platforms.

In container1 terminal, ros2 topic hz shows frequency slightly under 10hz

i believe that in this case, shared memory transport (not zero copy via LoanedMessage) can be enabled as localhost communication. this could be one of the benefits for the performance.

In container2 terminal, ros2 topic hz shows frequency highly under 10hz, verity from 7hz to 9hz

inter-process communication via network interface (in the case of docker, via bridge) would be one of the reason for this.

In log of container2, c++ code receive message each 100ms stably

there could be several differences, like language advantage for performance, rclpy pybind performance overhead.

above is my assumption, i did not test and analyze the performance difference. hopefully this helps.