/* 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 map via topic, and compare to ground truth */ TEST_F(MapClientTest, subscribe_topic) { ros::Subscriber sub = g_n->subscribe<nav_msgs::OccupancyGrid>("map", 1, boost::bind(&MapClientTest::mapCallback, this, _1)); // Try a few times, because the server may not be up yet. int i=20; while(!got_map_ && i > 0) { ros::spinOnce(); ros::WallDuration d(0.25); d.sleep(); i--; } ASSERT_TRUE(got_map_); checkMapMetaData(map_->info); checkMapData(*(map_.get())); }