ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to watch to topic while testing?

asked 2022-09-13 09:59:55 -0500

Theremin1 gravatar image


I have several nodes that communicate with each other in one direction. I have tested each node with googletest and rostest and they all seem fine. Now I wanted to create integrated tests. For this, I created a mocknode that publishes to the first topic and receives the messages from the last topic. But the result is not as expected. So I want to look into the topics with rostopic echo to analyse the messages. But this doesn't work because rostopic echo doesn't see anything. Can someone explain me why I can't see anything and how I can watch to my topics while I run my test file?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-09-14 09:23:05 -0500

Theremin1 gravatar image

updated 2022-09-15 03:30:24 -0500

I used for my tests catkin run_tests my_package. This will create probably his own master node, which cannot be accessed by the rostopic echo. So I have to use the same master node for the tests and the observation.

1) start master node with roscore

2) start the monitoring of the topic with rostopic echo my_topic

3) start your rostests with rostest --reuse-master my_package my_test_file.test

edit flag offensive delete link more

Question Tools



Asked: 2022-09-13 09:59:55 -0500

Seen: 342 times

Last updated: Sep 15 '22