Go to the documentation of this file.
47 #if defined( VISP_HAVE_OPENCV )
49 #include <visp3/core/vpFrameGrabberException.h>
50 #include <visp3/core/vpImageConvert.h>
53 #include <sensor_msgs/CompressedImage.h>
62 : m_isInitialized( false )
65 , m_mutex_image( true )
66 , m_mutex_param( true )
67 , m_first_img_received( false )
68 , m_first_param_received( false )
71 , m_master_uri(
"http://localhost:11311" )
72 , m_topic_image(
"image" )
73 , m_topic_cam_info(
"camera_info" )
75 , m_image_transport(
"raw" )
160 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
161 "ROS grabber already initialised with a different master_URI (" +
168 argv[0] =
new char[255];
169 argv[1] =
new char[255];
171 std::string exe =
"ros.exe", arg1 =
"__master:=";
172 strcpy( argv[0], exe.c_str() );
174 strcpy( argv[1], arg1.c_str() );
235 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
240 timestamp.tv_sec =
m_sec;
241 timestamp.tv_nsec =
m_nsec;
261 struct timespec timestamp;
263 timestamp_second = timestamp.tv_sec +
static_cast< double >( timestamp.tv_nsec ) * 1e-9;
280 bool new_image =
false;
284 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
289 timestamp.tv_sec =
m_sec;
290 timestamp.tv_nsec =
m_nsec;
313 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
318 timestamp.tv_sec =
m_sec;
319 timestamp.tv_nsec =
m_nsec;
337 struct timespec timestamp;
339 timestamp_second = timestamp.tv_sec +
static_cast< double >( timestamp.tv_nsec ) * 1e-9;
356 bool new_image =
false;
360 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
365 timestamp.tv_sec =
m_sec;
366 timestamp.tv_nsec =
m_nsec;
391 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
396 timestamp.tv_sec =
m_sec;
397 timestamp.tv_nsec =
m_nsec;
414 struct timespec timestamp;
430 struct timespec timestamp;
444 struct timespec timestamp;
460 struct timespec timestamp;
475 struct timespec timestamp;
654 throw( vpFrameGrabberException( vpFrameGrabberException::initializationError,
"Grabber not initialized." ) );
673 cv::Mat img = cv::imdecode( msg->data, 1 );
674 cv::Size data_size = img.size();
687 m_width =
static_cast< unsigned int >( data_size.width );
688 m_height =
static_cast< unsigned int >( data_size.height );
689 m_sec = msg->header.stamp.sec;
690 m_nsec = msg->header.stamp.nsec;
708 ROS_ERROR(
"cv_bridge exception: %s", e.what() );
717 cv_ptr->image.copyTo(
m_img );
719 cv::Size data_size =
m_img.size();
720 m_width =
static_cast< unsigned int >( data_size.width );
721 m_height =
static_cast< unsigned int >( data_size.height );
722 m_sec = msg->header.stamp.sec;
723 m_nsec = msg->header.stamp.nsec;
volatile bool m_mutex_param
volatile bool m_first_param_received
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
volatile bool m_first_img_received
ROSCPP_DECL bool get(const std::string &key, bool &b)
std::string m_topic_cam_info
bool getCameraInfo(vpCameraParameters &cam)
void rectifyImage(const cv::Mat &raw, cv::Mat &rectified, int interpolation=cv::INTER_LINEAR) const
void imageCallbackRaw(const sensor_msgs::Image::ConstPtr &msg)
std::string m_topic_image
void setFlip(bool flipType)
void setImageTransport(const std::string image_transport)
vpCameraParameters toVispCameraParameters(const sensor_msgs::CameraInfo &cam_info)
bool fromCameraInfo(const sensor_msgs::CameraInfo &msg)
bool acquireNoWait(vpImage< unsigned char > &I)
volatile bool m_mutex_image
void paramCallback(const sensor_msgs::CameraInfo::ConstPtr &msg)
ROSCPP_DECL bool isInitialized()
void setNodespace(const std::string &nodespace)
unsigned int getWidth() const
ros::Subscriber m_img_sub
void setImageTopic(const std::string &topic_name)
void setMasterURI(const std::string &master_uri)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
void setCameraInfoTopic(const std::string &topic_name)
ROSCPP_DECL void set(const std::string &key, bool b)
unsigned int getHeight() const
void setImageTransport(const std::string &image_transport)
volatile unsigned int m_height
std::string m_image_transport
volatile bool m_isInitialized
void imageCallback(const sensor_msgs::CompressedImage::ConstPtr &msg)
CvImageConstPtr toCvShare(const sensor_msgs::Image &source, const boost::shared_ptr< void const > &tracked_object, const std::string &encoding=std::string())
image_geometry::PinholeCameraModel m_p
const ROSCPP_DECL std::string & getURI()
volatile unsigned int m_width
void setRectify(bool rectify)
ros::Subscriber m_cam_info_sub
class for Camera video capture for ROS middleware.
ros::AsyncSpinner * m_spinner
visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais, Alexander Oliva
autogenerated on Wed Mar 2 2022 01:13:33