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

wait for publisher to get started

asked 2018-10-05 12:03:20 -0600

debonair gravatar image

I have one node which is receiving data from socket and publishing on some topic. I have another node which is sending data through socket to first node. Now I want second node to block until my first node is started. One way to wait is create subscriber for the topic and call getPublishers() but I dont want to create publisher. How do I wait?

edit retag flag offensive close merge delete

Comments

Would rospy.wait_for_message help? This does implicitly create a subscriber, but it does give you a timeout and is blocking for that timeout length until a message is received.

jarvisschultz gravatar image jarvisschultz  ( 2018-10-05 13:45:06 -0600 )edit

Note there is also a C++ implementation

jarvisschultz gravatar image jarvisschultz  ( 2018-10-05 13:46:21 -0600 )edit

it wont publish anything until I send it. I just need to check whether publisher is registered.

debonair gravatar image debonair  ( 2018-10-05 13:58:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-08 03:27:27 -0600

Which node is listening on the socket and which is connecting to it? If your first node is the listener then it would be relatively simple to get the second node to check if there is a listener on the socket every second, thereby blocking until the first node has started.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-10-05 12:03:20 -0600

Seen: 1,151 times

Last updated: Oct 08 '18