I want to test if two nodes in a software are communicating in ROS, from a third testing node

asked 2020-02-20 04:12:19 -0500

Buldoza gravatar image

updated 2020-02-20 10:05:36 -0500

I want to test if two Components in a software are communicating in ROS, however i have created a testing node C, that should test if signals or information sent by A is actually consumed by Component B.

Software in ros Component A ---> Component B , C is an external ros node which should be used to check if signal sent by Component A is received by Component B. A,B,C,D and E are 5 Components inside a single software. Which is a single node.

is it enough to subscribe to the topic which A and B are communicating to confirm that B is consuming the signal A is Consuming ?

if no how can i do this using rostest (Python unit testing) ?

edit retag flag offensive close merge delete



If component B is not a ROS node you will not be able to ensure it is consuming what the Component A (that I assume is a ROS node) is producing, since there is no ROS communication available between those two components.

Besides, the set up you are describing has no sense for me because conceptually if you want B to consume what A is producing you will need to implement two nodes and connect them with ROS functionalities. I mean either the two components are ROS nodes working in the same operational environment or two separated components implemented over Python.

In the first case, will be sufficient to publish from A your generated data and subscribe on B to consume that data. On the other hand, if your real question is how to use rostest on your set up, you will find plenty of tutorials on its Wiki ...(more)

Weasfas gravatar image Weasfas  ( 2020-02-20 07:01:39 -0500 )edit

Hi, Cloud you please clarify if A,B and C are rosnodes or something else? Also, how and what are they communicating (Publisher/Subscriber, Services or Actionlib)?

If A and B are rosnodes then a quick rosnode info /node_name might help you see what each node is generating and consuming.

astha736 gravatar image astha736  ( 2020-02-20 09:45:07 -0500 )edit

Thanks for your comment! A and B are ros nodes or better put Components of a software communicating via ROS. the software requirement wants us to test if B is actually consuming what A is sending.

after some research about this i started using the Python Ros Unit test(rostest), but i wanted to know if what i am doing is good enough to answer my needs

Buldoza gravatar image Buldoza  ( 2020-02-20 09:51:42 -0500 )edit

Hi, I read a few tutorials and I think the answer is Yes. Take a look at the following links: - talker_listener_test - test_add_two_ints I hope it helps. (Disclaimer: I consider myself to be an average programmer, please take a look at the links to confirm if that is what your were required to do. )

astha736 gravatar image astha736  ( 2020-02-20 11:01:51 -0500 )edit

Thanks, it will help

Buldoza gravatar image Buldoza  ( 2020-02-25 12:42:08 -0500 )edit

Glad to hear that! Do you think the above comment is an acceptable answer and I should add it as a formal answer on this thread ? Sorry, I am new to this forum and thus a little anxious before submitting a formal answer. Let me know. TIA!

astha736 gravatar image astha736  ( 2020-02-25 12:54:07 -0500 )edit