19 #include <gtest/gtest.h> 21 #include "leica_scanstation_utils/LeicaUtils.h" 22 #include "leica_scanstation_msgs/PointCloudFile.h" 23 #include "sensor_msgs/PointCloud2.h" 28 TEST(TestNode, testService)
32 client = nh.
serviceClient<leica_scanstation_msgs::PointCloudFile>(
"publish_clouds");
36 leica_scanstation_msgs::PointCloudFile srv;
37 srv.request.source_cloud_file =
"scan.pcd";
38 srv.request.target_cloud_file =
"cad.ply";
41 ASSERT_TRUE(srv.response.success);
43 else ADD_FAILURE()<<
"Failed to call service";
47 TEST(TestNode, testServiceFail)
51 client = nh.
serviceClient<leica_scanstation_msgs::PointCloudFile>(
"publish_clouds");
55 leica_scanstation_msgs::PointCloudFile srv;
56 srv.request.source_cloud_file =
"scan";
57 srv.request.target_cloud_file =
"cad";
60 ADD_FAILURE() <<
"Service doesn't work as expected";
68 sensor_msgs::PointCloud2ConstPtr cloud_msg;
76 int main(
int argc,
char **argv)
78 ros::init(argc, argv,
"test_publish_clouds");
79 testing::InitGoogleTest(&argc, argv);
80 return RUN_ALL_TESTS();
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
pcl::PointCloud< pcl::PointXYZRGB > PointCloudRGB
const std::string SOURCE_CLOUD_TOPIC
TEST(TestNode, testService)
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
const std::string TARGET_CLOUD_TOPIC
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
ROSCPP_DECL bool exists(const std::string &service_name, bool print_failure_reason)
static bool isValidCloudMsg(const sensor_msgs::PointCloud2 &cloud_msg)
Check whether PointCloud2 contains data and is not empty.