Robotics StackExchange | Archived questions

coordinate publisher and subscriber c++

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.

Asked by v.leto on 2019-10-22 06:17:27 UTC

Comments

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)?

Asked by gvdhoorn on 2019-10-22 06:48:27 UTC

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.

Asked by v.leto on 2019-10-23 06:45:58 UTC

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.

Asked by Wilco Bonestroo on 2020-02-26 15:56:17 UTC

Answers