36                 callbackCalled_(
false),
    37                 subscribedToDepth_(!gui),
    38                 subscribedToStereo_(
false),
    39                 subscribedToRGB_(!gui),
    40                 subscribedToOdom_(
false),
    41                 subscribedToRGBD_(
false),
    42                 subscribedToScan2d_(
false),
    43                 subscribedToScan3d_(
false),
    44                 subscribedToScanDescriptor_(
false),
    45                 subscribedToOdomInfo_(
false),
    67 #ifdef RTABMAP_SYNC_USER_DATA
   117 #ifdef RTABMAP_SYNC_USER_DATA
   151 #ifdef RTABMAP_SYNC_USER_DATA
   179 #ifdef RTABMAP_SYNC_USER_DATA
   195 #ifdef RTABMAP_SYNC_MULTI_RGBD
   210 #ifdef RTABMAP_SYNC_USER_DATA
   240 #ifdef RTABMAP_SYNC_USER_DATA
   270 #ifdef RTABMAP_SYNC_USER_DATA
   327 #ifdef RTABMAP_SYNC_USER_DATA
   347 #ifdef RTABMAP_SYNC_USER_DATA
   360                 const std::string & 
name)
   362         bool subscribeScan2d = 
false;
   363         bool subscribeScan3d = 
false;
   364         bool subscribeScanDesc = 
false;
   365         bool subscribeOdomInfo = 
false;
   366         bool subscribeUserData = 
false;
   367         bool subscribeOdom = 
true;
   373         if(pnh.
getParam(
"subscribe_laserScan", subscribeScan2d) && subscribeScan2d)
   375                 ROS_WARN(
"rtabmap: \"subscribe_laserScan\" parameter is deprecated, use \"subscribe_scan\" instead. The scan topic is still subscribed.");
   378         pnh.
param(
"subscribe_scan",      subscribeScan2d, subscribeScan2d);
   379         pnh.
param(
"subscribe_scan_cloud", subscribeScan3d, subscribeScan3d);
   380         pnh.
param(
"subscribe_scan_descriptor", subscribeScanDesc, subscribeScanDesc);
   383         pnh.
param(
"subscribe_odom_info", subscribeOdomInfo, subscribeOdomInfo);
   384         pnh.
param(
"subscribe_user_data", subscribeUserData, subscribeUserData);
   385         pnh.
param(
"subscribe_odom",      subscribeOdom, subscribeOdom);
   387 #ifdef RTABMAP_SYNC_USER_DATA   388         if(subscribeUserData)
   390                 ROS_ERROR(
"subscribe_user_data is true, but rtabmap_ros has been built with RTABMAP_SYNC_USER_DATA. Setting back to false.");
   391                 subscribeUserData = 
false;
   397                 ROS_WARN(
"rtabmap: Parameters subscribe_depth and subscribe_stereo cannot be true at the same time. Parameter subscribe_depth is set to false.");
   403                 ROS_WARN(
"rtabmap: Parameters subscribe_stereo and subscribe_rgb cannot be true at the same time. Parameter subscribe_rgb is set to false.");
   408                 ROS_WARN(
"rtabmap: Parameters subscribe_depth and subscribe_rgbd cannot be true at the same time. Parameter subscribe_depth is set to false.");
   414                 ROS_WARN(
"rtabmap: Parameters subscribe_rgb and subscribe_rgbd cannot be true at the same time. Parameter subscribe_rgb is set to false.");
   419                 ROS_WARN(
"rtabmap: Parameters subscribe_stereo and subscribe_rgbd cannot be true at the same time. Parameter subscribe_stereo is set to false.");
   422         if(subscribeScan2d && subscribeScan3d)
   424                 ROS_WARN(
"rtabmap: Parameters subscribe_scan and subscribe_scan_cloud cannot be true at the same time. Parameter subscribe_scan_cloud is set to false.");
   425                 subscribeScan3d = 
false;
   427         if(subscribeScan2d && subscribeScanDesc)
   429                 ROS_WARN(
"rtabmap: Parameters subscribe_scan and subscribe_scan_descriptor cannot be true at the same time. Parameter subscribe_scan is set to false.");
   430                 subscribeScan2d = 
false;
   432         if(subscribeScan3d && subscribeScanDesc)
   434                 ROS_WARN(
"rtabmap: Parameters subscribe_scan_cloud and subscribe_scan_descriptor cannot be true at the same time. Parameter subscribe_scan_cloud is set to false.");
   435                 subscribeScan3d = 
false;
   437         if(subscribeScan2d || subscribeScan3d || subscribeScanDesc)
   449         std::string odomFrameId;
   450         pnh.
getParam(
"odom_frame_id", odomFrameId);
   451         pnh.
param(
"rgbd_cameras",       rgbdCameras, rgbdCameras);
   454                 ROS_ERROR(
"\"depth_cameras\" parameter doesn't exist anymore. It is replaced by \"rgbd_cameras\" used when \"subscribe_rgbd\" is true.");
   459                 ROS_WARN(
"Parameter \"stereo_approx_sync\" has been renamed "   460                                  "to \"approx_sync\"! Your value is still copied to "   461                                  "corresponding parameter.");
   473         ROS_INFO(
"%s: subscribe_odom_info = %s", name.c_str(), subscribeOdomInfo?
"true":
"false");
   474         ROS_INFO(
"%s: subscribe_user_data = %s", name.c_str(), subscribeUserData?
"true":
"false");
   475         ROS_INFO(
"%s: subscribe_scan = %s", name.c_str(), subscribeScan2d?
"true":
"false");
   476         ROS_INFO(
"%s: subscribe_scan_cloud = %s", name.c_str(), subscribeScan3d?
"true":
"false");
   477         ROS_INFO(
"%s: subscribe_scan_descriptor = %s", name.c_str(), subscribeScanDesc?
"true":
"false");
   536 #ifdef RTABMAP_SYNC_MULTI_RGBD   537                 else if(rgbdCameras >= 6)
   541                                 ROS_ERROR(
"Cannot synchronize more than 6 rgbd topics (rgbd_cameras is set to %d). Set "   542                                                 "rgbd_cameras=0 to use RGBDImages interface instead, then "   543                                                 "synchronize RGBDImage topics yourself.", rgbdCameras);
   558                 else if(rgbdCameras == 5)
   572                 else if(rgbdCameras == 4)
   586                 else if(rgbdCameras == 3)
   600                 else if(rgbdCameras == 2)
   617                         ROS_FATAL(
"Cannot synchronize more than 1 rgbd topic (rtabmap_ros has "   618                                         "been built without RTABMAP_SYNC_MULTI_RGBD option). Set rgbd_cameras=0 to "   619                                         "use RGBDImages interface instead without recompiling with RTABMAP_SYNC_MULTI_RGBD, "   620                                         "but you will have to synchronize RGBDImage topics yourself.");
   638         else if(subscribeScan2d || subscribeScan3d || subscribeScanDesc)
   651         else if(subscribedToOdom_)
   698 #ifdef RTABMAP_SYNC_USER_DATA   717         SYNC_DEL(depthOdomDataScanDescInfo);
   748 #ifdef RTABMAP_SYNC_USER_DATA   783 #ifdef RTABMAP_SYNC_USER_DATA   812 #ifdef RTABMAP_SYNC_USER_DATA   828 #ifdef RTABMAP_SYNC_MULTI_RGBD   843 #ifdef RTABMAP_SYNC_USER_DATA   873 #ifdef RTABMAP_SYNC_USER_DATA   903 #ifdef RTABMAP_SYNC_USER_DATA   945 #endif //RTABMAP_SYNC_MULTI_RGBD   959 #ifdef RTABMAP_SYNC_USER_DATA   979 #ifdef RTABMAP_SYNC_USER_DATA   986         for(
unsigned int i=0; i<
rgbdSubs_.size(); ++i)
  1001                         ROS_WARN(
"%s: Did not receive data since 5 seconds! Make sure the input topics are "  1002                                         "published (\"$ rostopic hz my_topic\") and the timestamps in their "  1003                                         "header are set. If topics are coming from different computers, make sure "  1004                                         "the clocks of the computers are synchronized (\"ntpdate\"). %s%s",
  1007                                                         uFormat(
"If topics are not published at the same rate, you could increase \"queue_size\" parameter (current=%d).", 
queueSize_).c_str():
  1008                                                         "Parameter \"approx_sync\" is false, which means that input topics should have all the exact timestamp for the callback to be called.",
  1015                 const nav_msgs::OdometryConstPtr & odomMsg,
  1016                 const rtabmap_ros::UserDataConstPtr & userDataMsg,
  1019                 const sensor_msgs::CameraInfo & rgbCameraInfoMsg,
  1020                 const sensor_msgs::CameraInfo & depthCameraInfoMsg,
  1021                 const sensor_msgs::LaserScan& scanMsg,
  1022                 const sensor_msgs::PointCloud2& scan3dMsg,
  1023                 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg,
  1024                 const std::vector<rtabmap_ros::GlobalDescriptor> & globalDescriptorMsgs,
  1025                 const std::vector<rtabmap_ros::KeyPoint> & localKeyPoints,
  1026                 const std::vector<rtabmap_ros::Point3f> & localPoints3d,
  1027                 const cv::Mat & localDescriptors)
  1031         std::vector<std::vector<rtabmap_ros::KeyPoint> > localKeyPointsMsgs;
  1032         localKeyPointsMsgs.push_back(localKeyPoints);
  1033         std::vector<std::vector<rtabmap_ros::Point3f> > localPoints3dMsgs;
  1034         localPoints3dMsgs.push_back(localPoints3d);
  1035         std::vector<cv::Mat> localDescriptorsMsgs;
  1036         localDescriptorsMsgs.push_back(localDescriptors);
  1038         std::vector<cv_bridge::CvImageConstPtr> imageMsgs;
  1039         std::vector<cv_bridge::CvImageConstPtr> depthMsgs;
  1040         std::vector<sensor_msgs::CameraInfo> cameraInfoMsgs;
  1041         std::vector<sensor_msgs::CameraInfo> depthCameraInfoMsgs;
  1044                 imageMsgs.push_back(imageMsg);
  1048                 depthMsgs.push_back(depthMsg);
  1050         cameraInfoMsgs.push_back(rgbCameraInfoMsg);
  1051         depthCameraInfoMsgs.push_back(depthCameraInfoMsg);
  1058                         depthCameraInfoMsgs,
  1062                         globalDescriptorMsgs,
  1065                         localDescriptorsMsgs);
 
CommonDataSubscriber(bool gui)
std::string uFormat(const char *fmt,...)
virtual ~CommonDataSubscriber()
void setupRGBCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeUserData, bool subscribeScan2d, bool subscribeScan3d, bool subscribeScanDesc, bool subscribeOdomInfo, int queueSize, bool approxSync)
void setupScanCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeScan2d, bool subscribeScanDesc, bool subscribeOdom, bool subscribeUserData, bool subscribeOdomInfo, int queueSize, bool approxSync)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void setupOdomCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeUserData, bool subscribeOdomInfo, int queueSize, bool approxSync)
void setupCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, const std::string &name)
bool getParam(const std::string &key, std::string &s) const
const std::string & name() const
bool subscribedToScanDescriptor_
virtual void commonMultiCameraCallback(const nav_msgs::OdometryConstPtr &odomMsg, const rtabmap_ros::UserDataConstPtr &userDataMsg, const std::vector< cv_bridge::CvImageConstPtr > &imageMsgs, const std::vector< cv_bridge::CvImageConstPtr > &depthMsgs, const std::vector< sensor_msgs::CameraInfo > &cameraInfoMsgs, const std::vector< sensor_msgs::CameraInfo > &depthCameraInfoMsgs, const sensor_msgs::LaserScan &scanMsg, const sensor_msgs::PointCloud2 &scan3dMsg, const rtabmap_ros::OdomInfoConstPtr &odomInfoMsg, const std::vector< rtabmap_ros::GlobalDescriptor > &globalDescriptorMsgs=std::vector< rtabmap_ros::GlobalDescriptor >(), const std::vector< std::vector< rtabmap_ros::KeyPoint > > &localKeyPoints=std::vector< std::vector< rtabmap_ros::KeyPoint > >(), const std::vector< std::vector< rtabmap_ros::Point3f > > &localPoints3d=std::vector< std::vector< rtabmap_ros::Point3f > >(), const std::vector< cv::Mat > &localDescriptors=std::vector< cv::Mat >())=0
boost::thread * warningThread_
bool hasParam(const std::string &key) const
void setupRGBDXCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeUserData, bool subscribeScan2d, bool subscribeScan3d, bool subscribeScanDesc, bool subscribeOdomInfo, int queueSize, bool approxSync)
void setupRGBDCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeUserData, bool subscribeScan2d, bool subscribeScan3d, bool subscribeScanDesc, bool subscribeOdomInfo, int queueSize, bool approxSync)
std::string subscribedTopicsMsg_
void setupStereoCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeOdomInfo, int queueSize, bool approxSync)
std::vector< message_filters::Subscriber< rtabmap_ros::RGBDImage > * > rgbdSubs_
#define SYNC_INIT(PREFIX)
void setupDepthCallbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeUserData, bool subscribeScan2d, bool subscribeScan3d, bool subscribeScanDesc, bool subscribeOdomInfo, int queueSize, bool approxSync)
void commonSingleCameraCallback(const nav_msgs::OdometryConstPtr &odomMsg, const rtabmap_ros::UserDataConstPtr &userDataMsg, const cv_bridge::CvImageConstPtr &imageMsg, const cv_bridge::CvImageConstPtr &depthMsg, const sensor_msgs::CameraInfo &rgbCameraInfoMsg, const sensor_msgs::CameraInfo &depthCameraInfoMsg, const sensor_msgs::LaserScan &scanMsg, const sensor_msgs::PointCloud2 &scan3dMsg, const rtabmap_ros::OdomInfoConstPtr &odomInfoMsg, const std::vector< rtabmap_ros::GlobalDescriptor > &globalDescriptorMsgs=std::vector< rtabmap_ros::GlobalDescriptor >(), const std::vector< rtabmap_ros::KeyPoint > &localKeyPoints=std::vector< rtabmap_ros::KeyPoint >(), const std::vector< rtabmap_ros::Point3f > &localPoints3d=std::vector< rtabmap_ros::Point3f >(), const cv::Mat &localDescriptors=cv::Mat())