Using C++ what is a good frame for setting up a ROSTest
If your setting up a test where you send a message from the
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?
Asked by borgcons on 2019-04-19 16:58:21 UTC
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.
Asked by Link on 2019-04-22 10:12:43 UTC