Go to the documentation of this file.
3 #include <opencv2/core/mat.hpp>
9 #include <ros/console.h>
10 #include <ros/duration.h>
13 #include <std_msgs/String.h>
104 ROS_DEBUG_STREAM_THROTTLE_NAMED(5,
"Client",
"SHM server online on: " <<
hostname_);
111 ros::WallRate r(frequency);
112 ros::WallDuration d(3*r.expectedCycleTime().toSec());
126 ROS_DEBUG_NAMED(
"Client",
"Switching to ClientRGBD");
139 ROS_DEBUG_NAMED(
"Client",
"Switching to ClientSHM");
bool initialized()
Check if the client is initialized. nextImage shouldn't be called if client is not initialized.
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 ...
void hostsCallback(const std_msgs::StringConstPtr &msg)
std::thread sub_hosts_thread_
std::string get_hostname()
Get the hostname of the current machine.
std::mutex switch_impl_mutex_
bool initialized()
Check if the client is initialized. nextImage will not return an image if client is not initialized.
virtual ~Client()
Destructor.
bool initialized()
Check if the client is initialized. Checks if nh_ is exists. nextImage will not return an image if cl...
bool initialize(const std::string &server_name, float timeout=5.0)
Initialize shared memory client.
bool deinitialize()
Calls deinitialize on implementation clients. Shutsdown both implementations and deletes nh_....
bool deinitialize()
Clears all the shared memory classes to nullptrs or empty classes. initialized will now return false.
bool initialize(const std::string &server_name, float timeout=5.0)
Initialize the client.
bool initialize(const std::string &server_name)
Initialize the client.
ros::WallTime last_time_shm_server_online_
bool deinitialize()
Clears the subscriber. initialized will now return false.
ImagePtr nextImage()
Get a new Image. If no new image has been received since the last call, The ImagePtr will be a nullpt...
bool nextImage(Image &image)
Get a new Image. If no new image has been received, the sequence nummer is still the same as the prev...
ros::CallbackQueue cb_queue_
ros::Subscriber sub_shm_hosts_
ClientImplMode client_impl_mode_
void subHostsThreadFunc(const float frequency)
std::unique_ptr< ros::NodeHandle > nh_