Using C++ what is a good frame for setting up a ROSTest

asked 2019-04-19 16:58:21 -0600

borgcons gravatar image

updated 2019-04-19 16:58:38 -0600

If your setting up a test where you send a message from the <test> node to the <node> is test and then you want the to get the results from the <node> back to <test> what kind of framework should you use to synchronize the exchange.

Startup and latched/unlatched topic creates an issue.

I see that in some example that I have found that sleep() seems to be the solution.

Does anyone have a general code framework to deal with these issues?

edit retag flag offensive close merge delete

Comments

Are you talking about waiting for the nodes and test to spawn and start publishing? To accommodate this I usually make a helper method that waits for topics to be ready with some timeout delay. The helper method returns True if everything is ready and False otherwise. For a publisher a topic being ready would mean that its getNumSubscribers() would return 1 or greater when the node had started subscribing. Likewise for a subscriber its getNumPublishers() would return 1 or greater when the other node was publishing. I use these to determine that the nodes are "ready", One simple way to use this is to add this waitForReady() method to the start of every test.

Link gravatar image Link  ( 2019-04-22 10:12:43 -0600 )edit