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

Temporary deactivation of a subscriber

asked 2016-04-07 06:11:55 -0600

NEngelhard gravatar image

Hey!

I'm thinking about possibly useful feature that I'm currently missing in ROS and would like to hear your opinion on it. I'm currently writing a node that subscribes to a pointcloud-Topic but in fact only uses a pointcloud every minute or so. It would be useful to be able to temporarily disable the subscriber so that the pointcloud-publisher can use getNumSubscribers to decide if the CPU-hungry stereo-algorithm has to be run or not.

This effect could currently only be achieved by calling subscriber.shutdown and subscribing again later but that requires to store the topic_name and more boilerplate code.

Who would use this feature?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-04-07 08:18:29 -0600

gvdhoorn gravatar image

Wouldn't ros::topic::waitForMessage(..) work here? See ros::topic for the docs.

edit flag offensive delete link more

Comments

That's perfect for this use case. Thanks :)

NEngelhard gravatar image NEngelhard  ( 2016-04-07 08:22:33 -0600 )edit

Perfect example of an xy-problem this then :).

gvdhoorn gravatar image gvdhoorn  ( 2016-04-07 08:39:03 -0600 )edit

If that was the case, how could you post that answer without asking which problem I really wanted to solve? I provided X and Y ;)

NEngelhard gravatar image NEngelhard  ( 2016-04-07 08:45:19 -0600 )edit

If that was the case, how could you post that answer without asking which problem I really wanted to solve?

I've seen my share of "I need to temporarily disable a publisher/subscriber" questions.

I provided X and Y ;)

True. That made it easier :).

gvdhoorn gravatar image gvdhoorn  ( 2016-04-07 08:53:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-04-07 06:11:55 -0600

Seen: 899 times

Last updated: Apr 07 '16