ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

Implementing SubscriberStatusCallback within ros2

asked 2018-03-21 03:06:47 -0600

Sriram gravatar image

Hi,

When reading image_transport source code, ended up at a point where we need to use SubscriberStatusCallback.

How do we implement the same on ros2? (LifeCycle nodes?) They do not let enable us to develope code for connect/disconnect callbacks.

Any suggestions on the same would be mighty helpful.

PS: I'd asked the same question on discourse. Moved it here.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-21 20:35:16 -0600

William gravatar image

There's currently no way to emulate the on connect or on disconnect SubscriberStatusCallback (described here: https://docs.ros.org/api/roscpp/html/... ) in ROS 2. The underlying middlewares we support are capable of it, but we simply haven't exposed this information up to the ROS api yet. However it is on our roadmap, but not slated for inclusion into the next release:

Expose matched publisher / subscriber count (rather than only based on the topic name)

-- https://github.com/ros2/ros2/wiki/Roa...

This could be implemented by someone else in time for the release, but it would be a moderately complex set of changes.


However, the other half of this puzzle is the ros::SingleSubscriberPublisher which allows you to publish a message to only the new subscriber and not the existing subscribers, and that's the argument of the SubscriberStatusCallback. See:

https://answers.ros.org/question/1132...

I currently don't know of a simple way to do that with our current system. So the question is (please edit your question rather than making another answer) do you need that feature too, or just a callback to know when something has connected?

edit flag offensive delete link more

Comments

connect/disconnect callbacks alone would go a long way towards enabling data processing pipelines and lazy pub/sub. IMO SingleSubscriber publishers are interesting but a bit more esoteric.

paulbovbel gravatar image paulbovbel  ( 2018-03-24 20:33:38 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-03-21 03:06:47 -0600

Seen: 587 times

Last updated: Mar 21 '18