coordinate publisher and subscriber c++

asked 2019-10-22 06:17:27 -0600

v.leto gravatar image

how can I coordinate a subscriber and a publisher?I have to send a message(a position) to a robot with a publisher, then wait from the robot if he received the position(reading from a topic), and if he hadn't received it, publish the position again.

edit retag flag offensive close merge delete

Comments

2

Would this not be something for which actions are better suited?

To prevent an xy-problem: could you describe what it is that you actually want to achieve (ie: instead of asking about an approach you've already chosen)?

gvdhoorn gravatar image gvdhoorn  ( 2019-10-22 06:48:27 -0600 )edit

well, I will try to explain in a better way..Ii have to write a starting message to an AUV through an acoustic channel for its positioning, then the robot has to say "yes, I received the starting message" and if yes my node shoud start sending messages to it with its absolute position.

v.leto gravatar image v.leto  ( 2019-10-23 06:45:58 -0600 )edit

Is it a request / reply kind of communication? In that case you might take a look at services in ROS. If the service takes a long time to execute, you might consider actions, as @gvdhoorn suggests.

Wilco Bonestroo gravatar image Wilco Bonestroo  ( 2020-02-26 14:56:17 -0600 )edit