Access all Publisher/Subscriptions of a node

Hi for debugging purposes I’d like to access all publishers/subscriptions a node handles. (And get their rcl handle for accessing their fast rtps handle) Is this somehow possible. I couldn’t find a fitting method in the rclcpp::Node

There is a way to do this, but only a code example:

Obviously, this isn’t portable because you’re accessing Fast-RTPS or Connext (or whatever one you’re using) specific interfaces and therefore your program will now only work with that vendor. So for that reason we discourage you from doing it unless absolutely necessary.

@dirk-thomas might have more information for you as he did this originally, but I didn’t see a tutorial on the wiki or anything.

Also, please try to ask questions like this on answers.ros.org with the ros2 and/or ardent tags in the future.

I think you misunderstood me. I already found this example.
What I’m looking for is a way to get all publishers/subscriptions that were created via rclcpp::Node->create_publisher (or create_subscription). I couldn’t find an interface in the node for achieving this, but as far as I understand somewhere there must be a list which publishers and subscritptions were created.

Regarding answers.ros.org. What kind of questions should be asked here and what kind of questions on answers.ros.org? The latest I was aware of was that questions should be asked here instead of github.

While we were bootstrapping ROS2 we were recommending asking questions here in the Next Generation ROS category. However as the ROS2 traffic has grown that’s becoming unsustainable and we’ve decided to transition to our standard model of asking questions on ROS Answers

The transition was discussed:

And we recently re-announced it: