0
$\begingroup$

Rosanswers logo

Is it possible to get the number of connections from a rclpy.Subscription object? (In ROS1 we had "subscriber.get_num_connections()")

If it is not possible, what is the alternative?


Originally posted by Pablo Iñigo Blasco on ROS Answers with karma: 2982 on 2021-03-10

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

self._my_pub.get_subscription_count()

See https://docs.ros2.org/foxy/api/rclpy/api/topics.html


Originally posted by clyde with karma: 1247 on 2021-03-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Christian Rauch on 2023-08-03:
This is providing the number of subscriptions for a rclpy.publisher.Publisher and not the number of publishers for a rclpy.subscription.Subscription.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.