mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
Added get_map_data2 service (for fine selection of data wanted)
This commit is contained in:
+2
-1
@@ -31,7 +31,7 @@ find_package(find_object_2d)
|
|||||||
|
|
||||||
## System dependencies are found with CMake's conventions
|
## System dependencies are found with CMake's conventions
|
||||||
# find_package(Boost REQUIRED COMPONENTS system)
|
# find_package(Boost REQUIRED COMPONENTS system)
|
||||||
find_package(RTABMap 0.20.0 REQUIRED)
|
find_package(RTABMap 0.20.2 REQUIRED)
|
||||||
|
|
||||||
find_package(OpenCV REQUIRED)
|
find_package(OpenCV REQUIRED)
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ add_message_files(
|
|||||||
add_service_files(
|
add_service_files(
|
||||||
FILES
|
FILES
|
||||||
GetMap.srv
|
GetMap.srv
|
||||||
|
GetMap2.srv
|
||||||
ListLabels.srv
|
ListLabels.srv
|
||||||
PublishMap.srv
|
PublishMap.srv
|
||||||
ResetPose.srv
|
ResetPose.srv
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "rtabmap_ros/GetNodeData.h"
|
#include "rtabmap_ros/GetNodeData.h"
|
||||||
#include "rtabmap_ros/GetMap.h"
|
#include "rtabmap_ros/GetMap.h"
|
||||||
|
#include "rtabmap_ros/GetMap2.h"
|
||||||
#include "rtabmap_ros/ListLabels.h"
|
#include "rtabmap_ros/ListLabels.h"
|
||||||
#include "rtabmap_ros/PublishMap.h"
|
#include "rtabmap_ros/PublishMap.h"
|
||||||
#include "rtabmap_ros/SetGoal.h"
|
#include "rtabmap_ros/SetGoal.h"
|
||||||
@@ -196,6 +197,7 @@ private:
|
|||||||
bool setLogError(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
|
bool setLogError(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
|
||||||
bool getNodeDataCallback(rtabmap_ros::GetNodeData::Request& req, rtabmap_ros::GetNodeData::Response& res);
|
bool getNodeDataCallback(rtabmap_ros::GetNodeData::Request& req, rtabmap_ros::GetNodeData::Response& res);
|
||||||
bool getMapDataCallback(rtabmap_ros::GetMap::Request& req, rtabmap_ros::GetMap::Response& res);
|
bool getMapDataCallback(rtabmap_ros::GetMap::Request& req, rtabmap_ros::GetMap::Response& res);
|
||||||
|
bool getMapData2Callback(rtabmap_ros::GetMap2::Request& req, rtabmap_ros::GetMap2::Response& res);
|
||||||
bool getMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
bool getMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
||||||
bool getProbMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
bool getProbMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
||||||
bool getProjMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
bool getProjMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
|
||||||
@@ -304,6 +306,7 @@ private:
|
|||||||
ros::ServiceServer setLogErrorSrv_;
|
ros::ServiceServer setLogErrorSrv_;
|
||||||
ros::ServiceServer getNodeDataSrv_;
|
ros::ServiceServer getNodeDataSrv_;
|
||||||
ros::ServiceServer getMapDataSrv_;
|
ros::ServiceServer getMapDataSrv_;
|
||||||
|
ros::ServiceServer getMapData2Srv_;
|
||||||
ros::ServiceServer getProjMapSrv_;
|
ros::ServiceServer getProjMapSrv_;
|
||||||
ros::ServiceServer getMapSrv_;
|
ros::ServiceServer getMapSrv_;
|
||||||
ros::ServiceServer getProbMapSrv_;
|
ros::ServiceServer getProbMapSrv_;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<package>
|
<package>
|
||||||
<name>rtabmap_ros</name>
|
<name>rtabmap_ros</name>
|
||||||
<version>0.20.0</version>
|
<version>0.20.2</version>
|
||||||
<description>RTAB-Map's ros-pkg. RTAB-Map is a RGB-D SLAM approach with real-time constraints.</description>
|
<description>RTAB-Map's ros-pkg. RTAB-Map is a RGB-D SLAM approach with real-time constraints.</description>
|
||||||
<maintainer email="[email protected]">Mathieu Labbe</maintainer>
|
<maintainer email="[email protected]">Mathieu Labbe</maintainer>
|
||||||
<author>Mathieu Labbe</author>
|
<author>Mathieu Labbe</author>
|
||||||
|
|||||||
+41
-3
@@ -74,8 +74,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "rtabmap_ros/Info.h"
|
#include "rtabmap_ros/Info.h"
|
||||||
#include "rtabmap_ros/MapData.h"
|
#include "rtabmap_ros/MapData.h"
|
||||||
#include "rtabmap_ros/MapGraph.h"
|
#include "rtabmap_ros/MapGraph.h"
|
||||||
#include "rtabmap_ros/GetMap.h"
|
|
||||||
#include "rtabmap_ros/PublishMap.h"
|
|
||||||
#include "rtabmap_ros/Path.h"
|
#include "rtabmap_ros/Path.h"
|
||||||
|
|
||||||
#include "rtabmap_ros/MsgConversion.h"
|
#include "rtabmap_ros/MsgConversion.h"
|
||||||
@@ -601,6 +599,7 @@ void CoreWrapper::onInit()
|
|||||||
setModeMappingSrv_ = nh.advertiseService("set_mode_mapping", &CoreWrapper::setModeMappingCallback, this);
|
setModeMappingSrv_ = nh.advertiseService("set_mode_mapping", &CoreWrapper::setModeMappingCallback, this);
|
||||||
getNodeDataSrv_ = nh.advertiseService("get_node_data", &CoreWrapper::getNodeDataCallback, this);
|
getNodeDataSrv_ = nh.advertiseService("get_node_data", &CoreWrapper::getNodeDataCallback, this);
|
||||||
getMapDataSrv_ = nh.advertiseService("get_map_data", &CoreWrapper::getMapDataCallback, this);
|
getMapDataSrv_ = nh.advertiseService("get_map_data", &CoreWrapper::getMapDataCallback, this);
|
||||||
|
getMapData2Srv_ = nh.advertiseService("get_map_data2", &CoreWrapper::getMapData2Callback, this);
|
||||||
getMapSrv_ = nh.advertiseService("get_map", &CoreWrapper::getMapCallback, this);
|
getMapSrv_ = nh.advertiseService("get_map", &CoreWrapper::getMapCallback, this);
|
||||||
getProbMapSrv_ = nh.advertiseService("get_prob_map", &CoreWrapper::getProbMapCallback, this);
|
getProbMapSrv_ = nh.advertiseService("get_prob_map", &CoreWrapper::getProbMapCallback, this);
|
||||||
getGridMapSrv_ = nh.advertiseService("get_grid_map", &CoreWrapper::getGridMapCallback, this);
|
getGridMapSrv_ = nh.advertiseService("get_grid_map", &CoreWrapper::getGridMapCallback, this);
|
||||||
@@ -2675,7 +2674,7 @@ bool CoreWrapper::getNodeDataCallback(rtabmap_ros::GetNodeData::Request& req, rt
|
|||||||
{
|
{
|
||||||
|
|
||||||
int id = req.ids[i];
|
int id = req.ids[i];
|
||||||
Signature s = rtabmap_.getSignatureCopy(id, req.images, req.scan, req.user_data, req.grid);
|
Signature s = rtabmap_.getSignatureCopy(id, req.images, req.scan, req.user_data, req.grid, true, true);
|
||||||
|
|
||||||
if(s.id()>0)
|
if(s.id()>0)
|
||||||
{
|
{
|
||||||
@@ -2722,6 +2721,45 @@ bool CoreWrapper::getMapDataCallback(rtabmap_ros::GetMap::Request& req, rtabmap_
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CoreWrapper::getMapData2Callback(rtabmap_ros::GetMap2::Request& req, rtabmap_ros::GetMap2::Response& res)
|
||||||
|
{
|
||||||
|
NODELET_INFO("rtabmap: Getting map (global=%s optimized=%s with_images=%s with_scans=%s with_user_data=%s with_grids=%s)...",
|
||||||
|
req.global?"true":"false",
|
||||||
|
req.optimized?"true":"false",
|
||||||
|
req.with_images?"true":"false",
|
||||||
|
req.with_scans?"true":"false",
|
||||||
|
req.with_user_data?"true":"false",
|
||||||
|
req.with_grids?"true":"false");
|
||||||
|
std::map<int, Signature> signatures;
|
||||||
|
std::map<int, Transform> poses;
|
||||||
|
std::multimap<int, rtabmap::Link> constraints;
|
||||||
|
|
||||||
|
rtabmap_.getGraph(
|
||||||
|
poses,
|
||||||
|
constraints,
|
||||||
|
req.optimized,
|
||||||
|
req.global,
|
||||||
|
&signatures,
|
||||||
|
req.with_images,
|
||||||
|
req.with_scans,
|
||||||
|
req.with_user_data,
|
||||||
|
req.with_grids,
|
||||||
|
req.with_words,
|
||||||
|
req.with_global_descriptors);
|
||||||
|
|
||||||
|
//RGB-D SLAM data
|
||||||
|
rtabmap_ros::mapDataToROS(poses,
|
||||||
|
constraints,
|
||||||
|
signatures,
|
||||||
|
mapToOdom_,
|
||||||
|
res.data);
|
||||||
|
|
||||||
|
res.data.header.stamp = ros::Time::now();
|
||||||
|
res.data.header.frame_id = mapFrameId_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CoreWrapper::getProjMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res)
|
bool CoreWrapper::getProjMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res)
|
||||||
{
|
{
|
||||||
if(parameters_.find(Parameters::kGridFromDepth()) != parameters_.end() &&
|
if(parameters_.find(Parameters::kGridFromDepth()) != parameters_.end() &&
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#request
|
||||||
|
bool global
|
||||||
|
bool optimized
|
||||||
|
bool with_images
|
||||||
|
bool with_scans
|
||||||
|
bool with_user_data
|
||||||
|
bool with_grids
|
||||||
|
bool with_words
|
||||||
|
bool with_global_descriptors
|
||||||
|
---
|
||||||
|
#response
|
||||||
|
MapData data
|
||||||
Reference in New Issue
Block a user