diff --git a/CMakeLists.txt b/CMakeLists.txt index 277d50e0..d7ee6201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ find_package(find_object_2d) ## System dependencies are found with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system) -find_package(RTABMap 0.17.0 REQUIRED) +find_package(RTABMap 0.17.2 REQUIRED) find_package(OpenCV REQUIRED) diff --git a/include/rtabmap_ros/CoreWrapper.h b/include/rtabmap_ros/CoreWrapper.h index 7c4a87b7..74d5f333 100644 --- a/include/rtabmap_ros/CoreWrapper.h +++ b/include/rtabmap_ros/CoreWrapper.h @@ -216,6 +216,7 @@ private: ros::Publisher mapGraphPub_; ros::Publisher labelsPub_; ros::Publisher mapPathPub_; + ros::Publisher localizationPosePub_; ros::Subscriber initialPoseSub_; //Planning stuff diff --git a/package.xml b/package.xml index fc1026a3..422b9e02 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ rtabmap_ros - 0.17.0 + 0.17.2 RTAB-Map's ros-pkg. RTAB-Map is a RGB-D SLAM approach with real-time constraints. Mathieu Labbe Mathieu Labbe diff --git a/src/CoreWrapper.cpp b/src/CoreWrapper.cpp index 17657c35..a4f0ae0b 100644 --- a/src/CoreWrapper.cpp +++ b/src/CoreWrapper.cpp @@ -210,6 +210,7 @@ void CoreWrapper::onInit() mapGraphPub_ = nh.advertise("mapGraph", 1); labelsPub_ = nh.advertise("labels", 1); mapPathPub_ = nh.advertise("mapPath", 1); + localizationPosePub_ = nh.advertise("localization_pose", 1); initialPoseSub_ = nh.subscribe("initialpose", 1, &CoreWrapper::initialPoseCallback, this); // planning topics @@ -1497,6 +1498,18 @@ void CoreWrapper::process( { // Publish local graph, info this->publishStats(stamp); + if(localizationPosePub_.getNumSubscribers() && + !rtabmap_.getStatistics().localizationCovariance().empty()) + { + geometry_msgs::PoseWithCovarianceStamped poseMsg; + poseMsg.header.frame_id = mapFrameId_; + poseMsg.header.stamp = stamp; + rtabmap_ros::transformToPoseMsg(mapToOdom_*odom, poseMsg.pose.pose); + poseMsg.pose.covariance; + const cv::Mat & cov = rtabmap_.getStatistics().localizationCovariance(); + memcpy(poseMsg.pose.covariance.data(), cov.data, cov.total()*sizeof(double)); + localizationPosePub_.publish(poseMsg); + } std::map filteredPoses = rtabmap_.getLocalOptimizedPoses(); // create a tmp signature with latest sensory data if latest signature was ignored