1 #include <ros/console.h>
2 #include <ros/duration.h>
4 #include <ros/master.h>
6 #include <ros/node_handle.h>
12 #include <opencv2/highgui/highgui.hpp>
14 int main(
int argc,
char **argv)
16 ros::init(argc, argv,
"rgbd_viewer");
17 ros::NodeHandle nh_private(
"~");
20 nh_private.getParam(
"rate", rate);
23 client.
initialize(ros::names::resolve(
"rgbd"));
26 cv::namedWindow(window_name, cv::WINDOW_NORMAL);
27 cv::setWindowProperty(window_name, cv::WND_PROP_FULLSCREEN, cv::WINDOW_FULLSCREEN);
35 ros::WallTime last_master_check = ros::WallTime::now();
40 if (ros::WallTime::now() >= last_master_check + ros::WallDuration(1))
42 last_master_check = ros::WallTime::now();
43 if (!ros::master::check())
45 ROS_FATAL(
"Lost connection to master");
57 cv::putText(canvas,
"PAUSED", cv::Point(10, canvas.rows - 25), cv::FONT_HERSHEY_COMPLEX_SMALL, 1, cv::Scalar(255, 255, 255), 1);
59 cv::imshow(window_name, canvas);
61 int i_key = cv::waitKey(3);
64 char key =
static_cast<char>(i_key);