Loading [MathJax]/jax/input/TeX/config.js
Go to the documentation of this file. 1 #include <ros/console.h>
2 #include <ros/duration.h>
4 #include <ros/master.h>
6 #include <ros/node_handle.h>
18 int main(
int argc,
char **argv)
20 ros::init(argc, argv,
"rgbd_saver");
22 ros::NodeHandle nh_private(
"~");
25 nh_private.getParam(
"rate", rate);
28 client.
initialize(ros::names::resolve(
"rgbd"));
32 ros::WallTime last_master_check = ros::WallTime::now();
38 if (ros::WallTime::now() >= last_master_check + ros::WallDuration(1))
40 last_master_check = ros::WallTime::now();
41 if (!ros::master::check())
43 ROS_FATAL(
"Lost connection to master");
47 ROS_INFO(
"Press s to save and q to exit.");
49 #pragma GCC diagnostic push
50 #pragma GCC diagnostic ignored "-Wunused-result"
51 system (
"/bin/stty raw");
52 key_pressed = getchar();
53 system (
"/bin/stty cooked");
54 #pragma GCC diagnostic pop
56 if (key_pressed ==
's')
71 f_out.
open(file_name.
c_str(), std::ifstream::binary);
76 ROS_INFO_STREAM(
"Written image to '" << file_name <<
"'");
80 ROS_ERROR_STREAM(
"Error while writing to '" << file_name <<
"':\n" << e.
what());
85 else if (key_pressed ==
'q')
93 ROS_INFO(
"No image stored.");
double getTimestamp() const
Get the timestamp.
bool serialize(const Image &image, tue::serialization::OutputArchive &a, RGBStorageType rgb_type=RGB_STORAGE_JPG, DepthStorageType depth_type=DEPTH_STORAGE_PNG)
bool initialize(const std::string &server_name, float timeout=5.0)
Initialize the client.
int main(int argc, char **argv)
Client which uses the interfaces of ClientRGBD and ClientSHM.
bool nextImage(Image &image)
Get a new Image. If no new image has been received since the last call, no image will be written and ...