This package provides basic functions for testing ROS interfaces.

Testing Node Existence

For example a Google Test can check if a node named "/navigation/plannerNode" exists as follows:

TEST(NAVIGATIONtest, plannerNode) {

The same test can be performed in a simple if structure (e.g. for a diagnostic)

if (!InterfaceTester::checkForNode("/navigation/plannerNode")){

Testing Topics & Services

Similar to testing node existence there exist a few other functions

Testing for Services

TEST(NAVIGATIONtest, navigationMapDataSrvTest)

This test if the Service /navigation/navigationMapSrv has been advertised and if the a node in the /navigation/ namespace provides that service.

Testing for Topic Subscription

We can test if a node is subscribed to a specific topic

TEST(NAVIGATIONtest, sensorsIrSubscriberTest)

The first EXPECT_TRUE tests if the topic /sensors/ir has been advertised (either by a subscriber or a publisher). The second EXPECT_TRUE tests that a node in the /navigation namespace is subscribed at the /sensors/ir topic.

We could also test for a specific node like this:


Testing for Topic Publishing

Similar to the previous section, we can test if a topic has been published:


The first line of code checks if the topic /sensors/ir that has been advertised is of type controllersAndSensors_communications/irMsg The second line checks if a node in the /sensors/ namespace is actually publishing to the /sensors/ir topic. By publishing, we mean that a Publisher has been created on that node (and no actual message sending)

More Examples

You can find more examples in the interface_tester package.

Wiki: interface_testing (last edited 2011-08-04 11:24:54 by MiltiadisAllamanis)