5 #include <ros/duration.h>
7 #include <ros/console.h>
10 #include <sensor_msgs/CameraInfo.h>
12 #include <boost/interprocess/sync/scoped_lock.hpp>
14 namespace ipc = boost::interprocess;
38 ros::Time start = ros::Time::now();
40 ros::WallDuration d(0.1);
46 shm_ = ipc::shared_memory_object(ipc::open_only, server_name_cp.
c_str(), ipc::read_write);
58 ROS_INFO_STREAM_NAMED(
"ClientSHM",
"Opened shared memory on: '" << server_name_cp <<
"' succesfully.");
61 catch(ipc::interprocess_exception &ex)
63 ROS_DEBUG_STREAM_NAMED(
"ClientSHM",
"Could not open shared memory: " << ex.what());
66 now = ros::Time::now();
68 while (ros::ok() && (now - start).toSec() <
static_cast<double>(timeout));
70 ROS_INFO_STREAM_NAMED(
"ClientSHM",
"Opening shared memory on: '" << server_name_cp <<
"' failed on timeout(" << timeout <<
").");
83 shm_= ipc::shared_memory_object();
113 sensor_msgs::CameraInfo cam_info_msg;
132 image.
cam_model_.fromCameraInfo(cam_info_msg);