40 #include <sensor_msgs/CameraInfo.h> 91 bool approxSync =
true;
92 double approxSyncMaxInterval = 0.0;
93 if(private_nh.
getParam(
"max_rate", rate_))
97 private_nh.
param(
"rate", rate_, rate_);
98 private_nh.
param(
"queue_size", queueSize, queueSize);
99 private_nh.
param(
"approx_sync", approxSync, approxSync);
100 private_nh.
param(
"approx_sync_max_interval", approxSyncMaxInterval, approxSyncMaxInterval);
105 NODELET_INFO(
"approx_sync = %s", approxSync?
"true":
"false");
107 NODELET_INFO(
"approx_sync_max_interval = %f", approxSyncMaxInterval);
112 if(approxSyncMaxInterval > 0.0)
131 void callback(
const sensor_msgs::ImageConstPtr& image,
132 const sensor_msgs::ImageConstPtr& imageDepth,
133 const sensor_msgs::CameraInfoConstPtr& camInfo)
149 double rgbStamp = image->header.stamp.toSec();
150 double depthStamp = imageDepth->header.stamp.toSec();
151 double infoStamp = camInfo->header.stamp.toSec();
157 sensor_msgs::CameraInfo info = *camInfo;
183 out.
header = imagePtr->header;
200 out.
header = imagePtr->header;
211 if( rgbStamp != image->header.stamp.toSec() ||
212 depthStamp != imageDepth->header.stamp.toSec())
214 NODELET_ERROR(
"Input stamps changed between the beginning and the end of the callback! Make " 215 "sure the node publishing the topics doesn't override the same data after publishing them. A " 216 "solution is to use this node within another nodelet manager. Stamps: " 217 "rgb=%f->%f depth=%f->%f",
218 rgbStamp, image->header.stamp.toSec(),
219 depthStamp, imageDepth->header.stamp.toSec());
CvImageConstPtr toCvShare(const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string())
#define NODELET_ERROR(...)
#define NODELET_WARN(...)
message_filters::Synchronizer< MyApproxSyncPolicy > * approxSync_
uint32_t getNumSubscribers() const
image_transport::Publisher imagePub_
ros::NodeHandle & getNodeHandle() const
Publisher advertise(const std::string &base_topic, uint32_t queue_size, bool latch=false)
message_filters::Synchronizer< MyExactSyncPolicy > * exactSync_
message_filters::Subscriber< sensor_msgs::CameraInfo > info_sub_
ros::NodeHandle & getPrivateNodeHandle() const
virtual ~DataThrottleNodelet()
sensor_msgs::ImagePtr toImageMsg() const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void publish(const boost::shared_ptr< M > &message) const
void callback(const sensor_msgs::ImageConstPtr &image, const sensor_msgs::ImageConstPtr &imageDepth, const sensor_msgs::CameraInfoConstPtr &camInfo)
cv::Mat RTABMAP_EXP decimate(const cv::Mat &image, int d)
image_transport::SubscriberFilter image_sub_
bool getParam(const std::string &key, std::string &s) const
std::string resolveName(const std::string &name, bool remap=true) const
message_filters::sync_policies::ApproximateTime< sensor_msgs::Image, sensor_msgs::Image, sensor_msgs::CameraInfo > MyApproxSyncPolicy
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void publish(const sensor_msgs::Image &message) const
image_transport::Publisher imageDepthPub_
void subscribe(ImageTransport &it, const std::string &base_topic, uint32_t queue_size, const TransportHints &transport_hints=TransportHints())
image_transport::SubscriberFilter image_depth_sub_
message_filters::sync_policies::ExactTime< sensor_msgs::Image, sensor_msgs::Image, sensor_msgs::CameraInfo > MyExactSyncPolicy
#define NODELET_INFO(...)
void subscribe(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
PLUGINLIB_EXPORT_CLASS(rtabmap_ros::CoreWrapper, nodelet::Nodelet)
uint32_t getNumSubscribers() const
#define NODELET_DEBUG(...)