0
$\begingroup$

Rosanswers logo

I wrote my problem with details below. But it may be a bit complicated. That is why, firstly, I am going to indicate it clearly. This is my question as I wrote on the title:

I want to publish some data to a certain topic. And I do not want this topic to accept any other data from other nodes which tries to publish to it. Or I want this topic to erase all the data coming from nodes except the node that I permit to publish to that node. How can I write this commend into my heartbeat node. How should the strategy be? (I am using Python). Any help would be appreciated

And my problem with details is this:

I am trying to write a heartbeat node for my robot. My robot has its own computer on it. I am going to publish heartbeat data from main computer to topic "A" which my heartbeat node subscribes to and which runs on the robot. Similarly I am going to control this robot from main computer by publishing to topic "B" and "C" that my engine node and brake motor node subscribes to. All these nodes (heartbeat, brake motor, engine) are going to run on the robot.

If heartbeat node realise that there is no data published to topic "A" (that is; connection between main computer and robot has failed), it is going to publish data to topic "B" and "C" in order to stop the engine and brake.

There is no problem about things above.

The problem is this:

When heartbeat node realises that connection is lost, I want it to clear all data flowing on the topic "B" and "C" to engine and brake motor nodes and than publish "stop" and "brake" data to them. I am trying to do this in case there is data on topic "B" and when my heartbeat tries to stop engine there should not be any data which tries to work the engine.


Originally posted by ebakor on ROS Answers with karma: 3 on 2014-08-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

ROS is explicitly designed to be an anonymous publish and subscribe communications framework - this means that, by design, you shouldn't know where data on a particular topic is coming from.

I suggest you change your architecture to use a separate topic for your emergency stop command, or use a multiplexer to control which topic is sent to your engine control, and switch that mux based on your heartbeat status.


Originally posted by ahendrix with karma: 47576 on 2014-08-27

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by tfoote on 2014-08-27:
For how to implement a heartbeat I recommend that you look at the bond packages.

Comment by ebakor on 2014-08-28:
Thank you!..

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.