/* Try to retrieve the map via service, and compare to ground truth */ TEST_F (MapClientTest, call_service) { nav_msgs::GetMap::Request req; nav_msgs::GetMap::Response resp; ASSERT_TRUE (ros::service::waitForService ("dynamic_map", 5000)); ASSERT_TRUE (ros::service::call ("dynamic_map", req, resp)); checkMapMetaData (resp.map.info); checkMapData (resp.map); }
/* Try to retrieve the metadata via topic, and compare to ground truth */ TEST_F(MapClientTest, subscribe_topic_metadata) { ros::Subscriber sub = g_n->subscribe<nav_msgs::MapMetaData>("map_metadata", 1, boost::bind(&MapClientTest::mapMetaDataCallback, this, _1)); // Try a few times, because the server may not be up yet. int i=20; while(!got_map_metadata_ && i > 0) { ros::spinOnce(); ros::WallDuration d(0.25); d.sleep(); i--; } ASSERT_TRUE(got_map_metadata_); checkMapMetaData(*(map_metadata_.get())); }