ros2 / rclcpp

rclcpp (ROS Client Library for C++)
Apache License 2.0
513 stars 412 forks source link

Add tracepoint for generic publisher/subscriber #2448

Closed h-suzuki-isp closed 3 months ago

h-suzuki-isp commented 3 months ago

Hi, I'm developed member of CARET for real-time analysis using ros2tracing.

In communication through GenericPublisher/Subscription, message tracking was not possible due to a lack of trace data. In this PR, added trace points to the GenericPublisher and GenericSubscription.

Additionally, with these changes, I submitted a PR to the following repository.

fujitatomoya commented 3 months ago

@h-suzuki-isp thanks for the PRs. should we also add TRACETOOLS_TRACEPOINT to https://github.com/ros2/rmw_connextdds accordingly?

h-suzuki-isp commented 3 months ago

@fujitatomoya Thank you for your review. I'm not fluent in English, so I apologize if my message wasn't clear.

thanks for the PRs. should we also add TRACETOOLS_TRACEPOINT to https://github.com/ros2/rmw_connextdds accordingly?

If Connext DDS is the DDS officially supported by ROS 2, I believe it's appropriate to add tracepoints to rmw_connextdds as well. Therefore, I've created a pull request for rmw_connextdds as follows. https://github.com/ros2/rmw_connextdds/pull/145 Since rmw_publish already seemed to be added, I only added rmw_take. I haven't delved into rmw_connextdds in detail. so I'm not confident about the implementation, but it would probably be like this.

fujitatomoya commented 3 months ago

If Connext DDS is the DDS officially supported by ROS 2

yes it is, https://github.com/ros2/ros2/blob/30e9231f04d6e971de4d9bcc3cc98733f8a89d23/ros2.repos#L302-L305

Zard-C commented 3 months ago

Build Status

christophebedard commented 3 months ago

Thank you for the PR, this is really useful! It would be really great if you could add some tests to test_tracetools to cover this new instrumentation:

  1. A test similar to test_subscription.py but for a generic subscription
    • This would for example help make sure that the callback address is valid and that the trace data is coherent
  2. A test similar to test_pub_sub.py but for a generic publisher and a generic subscription
    • This would for example help make sure that the *_publish and *_take instrumentation is valid for serialized messages (i.e., we can track messages from end to end)

You would probably need to create copies of the test_ping & test_pong nodes that use generic subscriptions/publishers instead of normal subscriptions/publishers.

h-suzuki-isp commented 3 months ago

@christophebedard Thank you for your review and explanation about test_tracetools. Based on this, I have created following PR. https://github.com/ros2/ros2_tracing/pull/97 However, the CI is still failing, so I am investigating the cause.

h-suzuki-isp commented 3 months ago

@christophebedard I'd like you to review this. The reason CI is failing is because it's not using the fixed branch, but local tests are passing.

christophebedard commented 3 months ago

CI:

It includes the PRs mentioned in the PR description above:

ros-discourse commented 1 month ago

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-jazzy-jalisco-released/37862/9