36 subscribedToDepth_(!gui),
37 subscribedToStereo_(
false),
38 subscribedToRGB_(!gui),
39 subscribedToOdom_(
false),
40 subscribedToRGBD_(
false),
41 subscribedToSensorData_(
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
200 #ifdef RTABMAP_SYNC_MULTI_RGBD
215 #ifdef RTABMAP_SYNC_USER_DATA
245 #ifdef RTABMAP_SYNC_USER_DATA
275 #ifdef RTABMAP_SYNC_USER_DATA
332 #ifdef RTABMAP_SYNC_USER_DATA
352 #ifdef RTABMAP_SYNC_USER_DATA
365 const std::string &
name,
366 std::vector<diagnostic_updater::DiagnosticTask*> otherTasks)
368 bool subscribeScan2d =
false;
369 bool subscribeScan3d =
false;
370 bool subscribeScanDesc =
false;
371 bool subscribeOdomInfo =
false;
372 bool subscribeUserData =
false;
373 bool subscribeOdom =
true;
379 if(pnh.
getParam(
"subscribe_laserScan", subscribeScan2d) && subscribeScan2d)
381 ROS_WARN(
"rtabmap: \"subscribe_laserScan\" parameter is deprecated, use \"subscribe_scan\" instead. The scan topic is still subscribed.");
384 pnh.
param(
"subscribe_scan", subscribeScan2d, subscribeScan2d);
385 pnh.
param(
"subscribe_scan_cloud", subscribeScan3d, subscribeScan3d);
386 pnh.
param(
"subscribe_scan_descriptor", subscribeScanDesc, subscribeScanDesc);
390 pnh.
param(
"subscribe_odom_info", subscribeOdomInfo, subscribeOdomInfo);
391 pnh.
param(
"subscribe_user_data", subscribeUserData, subscribeUserData);
392 pnh.
param(
"subscribe_odom", subscribeOdom, subscribeOdom);
394 #ifdef RTABMAP_SYNC_USER_DATA
395 if(subscribeUserData)
397 ROS_ERROR(
"subscribe_user_data is true, but rtabmap_ros has been built with RTABMAP_SYNC_USER_DATA. Setting back to false.");
398 subscribeUserData =
false;
404 ROS_WARN(
"rtabmap: Parameters subscribe_depth and subscribe_stereo cannot be true at the same time. Parameter subscribe_depth is set to false.");
410 ROS_WARN(
"rtabmap: Parameters subscribe_stereo and subscribe_rgb cannot be true at the same time. Parameter subscribe_rgb is set to false.");
417 ROS_WARN(
"rtabmap: Parameters subscribe_depth and subscribe_rgbd cannot be true at the same time. Parameter subscribe_depth is set to false.");
423 ROS_WARN(
"rtabmap: Parameters subscribe_rgb and subscribe_rgbd cannot be true at the same time. Parameter subscribe_rgb is set to false.");
428 ROS_WARN(
"rtabmap: Parameters subscribe_stereo and subscribe_rgbd cannot be true at the same time. Parameter subscribe_stereo is set to false.");
438 ROS_WARN(
"rtabmap: Parameters subscribe_depth and subscribe_sensor_data cannot be true at the same time. Parameter subscribe_depth is set to false.");
444 ROS_WARN(
"rtabmap: Parameters subscribe_rgb and subscribe_sensor_data cannot be true at the same time. Parameter subscribe_rgb is set to false.");
449 ROS_WARN(
"rtabmap: Parameters subscribe_stereo and subscribe_sensor_data cannot be true at the same time. Parameter subscribe_stereo is set to false.");
455 ROS_WARN(
"rtabmap: Parameters subscribe_sensor_data and subscribe_rgbd cannot be true at the same time. Parameter subscribe_rgbd is set to false.");
459 if(subscribeScan2d && subscribeScan3d)
461 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.");
462 subscribeScan3d =
false;
464 if(subscribeScan2d && subscribeScanDesc)
466 ROS_WARN(
"rtabmap: Parameters subscribe_scan and subscribe_scan_descriptor cannot be true at the same time. Parameter subscribe_scan is set to false.");
467 subscribeScan2d =
false;
469 if(subscribeScan3d && subscribeScanDesc)
471 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.");
472 subscribeScan3d =
false;
476 ROS_WARN(
"rtabmap: Parameters subscribe_sensor_data and subscribe_scan cannot be true at the same time. Parameter subscribe_scan_cloud is set to false.");
477 subscribeScan2d =
false;
481 ROS_WARN(
"rtabmap: Parameters subscribe_sensor_data and subscribe_scan_cloud cannot be true at the same time. Parameter subscribe_scan_cloud is set to false.");
482 subscribeScan3d =
false;
486 ROS_WARN(
"rtabmap: Parameters subscribe_sensor_data and subscribe_scan_descriptor cannot be true at the same time. Parameter subscribe_scan_descriptor is set to false.");
487 subscribeScanDesc =
false;
489 if(subscribeScan2d || subscribeScan3d || subscribeScanDesc)
501 std::string odomFrameId;
502 pnh.
getParam(
"odom_frame_id", odomFrameId);
506 ROS_ERROR(
"\"depth_cameras\" parameter doesn't exist anymore. It is replaced by \"rgbd_cameras\" used when \"subscribe_rgbd\" is true.");
512 ROS_WARN(
"Parameter \"queue_size\" has been renamed "
513 "to \"sync_queue_size\" and will be removed "
514 "in future versions! The value (%d) is copied to "
523 ROS_WARN(
"Parameter \"stereo_approx_sync\" has been renamed "
524 "to \"approx_sync\"! Your value is copied to "
525 "corresponding parameter.");
538 ROS_INFO(
"%s: subscribe_odom_info = %s",
name.c_str(), subscribeOdomInfo?
"true":
"false");
539 ROS_INFO(
"%s: subscribe_user_data = %s",
name.c_str(), subscribeUserData?
"true":
"false");
540 ROS_INFO(
"%s: subscribe_scan = %s",
name.c_str(), subscribeScan2d?
"true":
"false");
541 ROS_INFO(
"%s: subscribe_scan_cloud = %s",
name.c_str(), subscribeScan3d?
"true":
"false");
542 ROS_INFO(
"%s: subscribe_scan_descriptor = %s",
name.c_str(), subscribeScanDesc?
"true":
"false");
582 #ifdef RTABMAP_SYNC_MULTI_RGBD
587 ROS_ERROR(
"Cannot synchronize more than 6 rgbd topics (rgbd_cameras is set to %d). Set "
588 "rgbd_cameras=0 to use RGBDImages interface instead, then "
589 "synchronize RGBDImage topics yourself.",
rgbdCameras);
653 ROS_FATAL(
"Cannot synchronize more than 1 rgbd topic (rtabmap_ros has "
654 "been built without RTABMAP_SYNC_MULTI_RGBD option). Set rgbd_cameras=0 to "
655 "use RGBDImages interface instead without recompiling with RTABMAP_SYNC_MULTI_RGBD, "
656 "but you will have to synchronize RGBDImage topics yourself.");
684 else if(subscribeScan2d || subscribeScan3d || subscribeScanDesc)
717 uFormat(
"%s: Did not receive data since 5 seconds! Make sure the input topics are "
718 "published (\"$ rostopic hz my_topic\") and the timestamps in their "
719 "header are set. If topics are coming from different computers, make sure "
720 "the clocks of the computers are synchronized (\"ntpdate\"). %s%s",
723 uFormat(
"If topics are not published at the same rate, you could increase \"sync_queue_size\" and/or \"topic_queue_size\" parameters (current=%d and %d respectively).",
syncQueueSize_,
topicQueueSize_).
c_str():
724 "Parameter \"approx_sync\" is false, which means that input topics should have all the exact timestamp for the callback to be called.",
753 #ifdef RTABMAP_SYNC_USER_DATA
772 SYNC_DEL(depthOdomDataScanDescInfo);
803 #ifdef RTABMAP_SYNC_USER_DATA
838 #ifdef RTABMAP_SYNC_USER_DATA
867 #ifdef RTABMAP_SYNC_USER_DATA
883 #ifdef RTABMAP_SYNC_MULTI_RGBD
898 #ifdef RTABMAP_SYNC_USER_DATA
928 #ifdef RTABMAP_SYNC_USER_DATA
958 #ifdef RTABMAP_SYNC_USER_DATA
1000 #endif //RTABMAP_SYNC_MULTI_RGBD
1014 #ifdef RTABMAP_SYNC_USER_DATA
1034 #ifdef RTABMAP_SYNC_USER_DATA
1049 const nav_msgs::OdometryConstPtr & odomMsg,
1050 const rtabmap_msgs::UserDataConstPtr & userDataMsg,
1053 const sensor_msgs::CameraInfo & rgbCameraInfoMsg,
1054 const sensor_msgs::CameraInfo & depthCameraInfoMsg,
1055 const sensor_msgs::LaserScan& scanMsg,
1056 const sensor_msgs::PointCloud2& scan3dMsg,
1057 const rtabmap_msgs::OdomInfoConstPtr& odomInfoMsg,
1058 const std::vector<rtabmap_msgs::GlobalDescriptor> & globalDescriptorMsgs,
1059 const std::vector<rtabmap_msgs::KeyPoint> & localKeyPoints,
1060 const std::vector<rtabmap_msgs::Point3f> & localPoints3d,
1061 const cv::Mat & localDescriptors)
1063 std::vector<std::vector<rtabmap_msgs::KeyPoint> > localKeyPointsMsgs;
1064 localKeyPointsMsgs.push_back(localKeyPoints);
1065 std::vector<std::vector<rtabmap_msgs::Point3f> > localPoints3dMsgs;
1066 localPoints3dMsgs.push_back(localPoints3d);
1067 std::vector<cv::Mat> localDescriptorsMsgs;
1068 localDescriptorsMsgs.push_back(localDescriptors);
1070 std::vector<cv_bridge::CvImageConstPtr> imageMsgs;
1071 std::vector<cv_bridge::CvImageConstPtr> depthMsgs;
1072 std::vector<sensor_msgs::CameraInfo> cameraInfoMsgs;
1073 std::vector<sensor_msgs::CameraInfo> depthCameraInfoMsgs;
1076 imageMsgs.push_back(imageMsg);
1080 depthMsgs.push_back(depthMsg);
1082 cameraInfoMsgs.push_back(rgbCameraInfoMsg);
1083 depthCameraInfoMsgs.push_back(depthCameraInfoMsg);
1090 depthCameraInfoMsgs,
1094 globalDescriptorMsgs,
1097 localDescriptorsMsgs);