1 #ifndef TEST_CLIENT_TEMPL_H_
2 #define TEST_CLIENT_TEMPL_H_
4 #include <opencv2/highgui/highgui.hpp>
6 #include <ros/console.h>
7 #include <ros/duration.h>
9 #include <ros/master.h>
10 #include <ros/names.h>
11 #include <ros/node_handle.h>
41 ros::init(argc, argv,
"rgbd_transport_test_client");
43 bool headless =
false;
45 for (
int i=1; i<argc; ++i)
48 if (arg ==
"--headless")
51 ROS_INFO(
"Running in headless mode");
53 else if(arg ==
"--help")
60 ROS_WARN_STREAM(
"Incorrect argument: '" << arg);
64 ros::NodeHandle nh_private(
"~");
67 nh_private.getParam(
"rate", rate);
70 if (!client.initialize(ros::names::resolve(
"test")))
72 ROS_FATAL(
"Could not initialize the client");
78 ros::WallTime last_master_check = ros::WallTime::now();
83 if (ros::WallTime::now() >= last_master_check + ros::WallDuration(1))
85 last_master_check = ros::WallTime::now();
86 if (!ros::master::check())
88 ROS_FATAL(
"Lost connection to master");
92 if (client.nextImage(image))
108 cv::destroyAllWindows();
114 #endif // TEST_CLIENT_TEMPL_H_