I want to send data from one node to another. For example: One node is publishing data to the topic /mobile_base/commands/velocity
and other one is subscribed to /mobile_base/events/bumper
. Both the subscriber & publisher are working fine.
What I want to do is to make the robot move backward once the bumpers are pressed. I do not know how to send the event of bumper pressed to the other node.
The solution I thought was of using pipes or sockets or shared memory to exchange data between two nodes.
Is this the right approach? Or does ROS has a builtin method for that?
Thanks in Advance.
By subscribing to the "bumper" topic, the data is available to that node. (Assuming you're using C++, as you didn't mention - the theory is the same, but obviously the syntax will differ). Using the example publish/subscribe code on the ROS website (link).