mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 08:47:45 +08:00
Updated ros-pkg with new rtabmap messages including retrieved data
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/ros-pkg@1059 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -38,3 +38,4 @@ General\voxelSize2=0.01
|
|||||||
General\decimation2=1
|
General\decimation2=1
|
||||||
General\maxDepth2=4
|
General\maxDepth2=4
|
||||||
General\showScans2=true
|
General\showScans2=true
|
||||||
|
General\meshing0=false
|
||||||
|
|||||||
@@ -7,11 +7,8 @@
|
|||||||
Header header
|
Header header
|
||||||
|
|
||||||
int32 refId
|
int32 refId
|
||||||
int32 refMapId
|
|
||||||
int32 loopClosureId
|
int32 loopClosureId
|
||||||
int32 loopClosureMapId
|
|
||||||
int32 localLoopClosureId
|
int32 localLoopClosureId
|
||||||
int32 localLoopClosureMapId
|
|
||||||
|
|
||||||
# std::map<int, Poses> poses;
|
# std::map<int, Poses> poses;
|
||||||
int32[] nodeIds
|
int32[] nodeIds
|
||||||
|
|||||||
+5
-31
@@ -6,21 +6,18 @@
|
|||||||
Header header
|
Header header
|
||||||
|
|
||||||
int32 refId
|
int32 refId
|
||||||
int32 refMapId
|
|
||||||
int32 loopClosureId
|
int32 loopClosureId
|
||||||
int32 loopClosureMapId
|
|
||||||
int32 localLoopClosureId
|
int32 localLoopClosureId
|
||||||
int32 localLoopClosureMapId
|
|
||||||
|
|
||||||
# std::map<int, Poses> poses;
|
# The map data (rgb, depth, depthConstant, depth2D, localTransform, poses, map ids, mapCorrection)
|
||||||
int32[] nodeIds
|
rtabmap/MapData data
|
||||||
geometry_msgs/Pose[] nodePoses
|
|
||||||
|
|
||||||
geometry_msgs/Transform mapCorrection
|
|
||||||
geometry_msgs/Transform loopClosureTransform
|
geometry_msgs/Transform loopClosureTransform
|
||||||
|
|
||||||
geometry_msgs/Pose currentPose
|
geometry_msgs/Pose currentPose
|
||||||
|
|
||||||
|
####
|
||||||
|
# For statistics and visualization below...
|
||||||
|
####
|
||||||
# std::map<int, float> posterior;
|
# std::map<int, float> posterior;
|
||||||
int32[] posteriorKeys
|
int32[] posteriorKeys
|
||||||
float32[] posteriorValues
|
float32[] posteriorValues
|
||||||
@@ -41,29 +38,6 @@ int32[] weightsValues
|
|||||||
string[] statsKeys
|
string[] statsKeys
|
||||||
float32[] statsValues
|
float32[] statsValues
|
||||||
|
|
||||||
#compressed image
|
|
||||||
# use rtabmap::util3d::uncompressImage() from <rtabmap/core/util3d.h>
|
|
||||||
uint8[] refImage
|
|
||||||
uint8[] loopImage
|
|
||||||
|
|
||||||
#compressed depth
|
|
||||||
# use rtabmap::util3d::uncompressImage() from <rtabmap/core/util3d.h>
|
|
||||||
uint8[] refDepth
|
|
||||||
uint8[] loopDepth
|
|
||||||
|
|
||||||
#compressed depth2d
|
|
||||||
# use rtabmap::util3d::uncompressData() from <rtabmap/core/util3d.h>
|
|
||||||
uint8[] refDepth2D
|
|
||||||
uint8[] loopDepth2D
|
|
||||||
|
|
||||||
#camera info
|
|
||||||
float32 refDepthConstant
|
|
||||||
float32 loopDepthConstant
|
|
||||||
|
|
||||||
#local transform
|
|
||||||
geometry_msgs/Transform refLocalTransform
|
|
||||||
geometry_msgs/Transform loopLocalTransform
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# For features2d : std::multimap<int, cv::Keypoint> words
|
# For features2d : std::multimap<int, cv::Keypoint> words
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
Header header
|
Header header
|
||||||
|
|
||||||
|
# Map ids
|
||||||
|
int32[] mapIDs
|
||||||
|
int32[] maps
|
||||||
|
|
||||||
# compressed images
|
# compressed images
|
||||||
# use rtabmap::util3d::uncompressImage() from <rtabmap/core/util3d.h>
|
# use rtabmap::util3d::uncompressImage() from <rtabmap/core/util3d.h>
|
||||||
# std::map<int, uint8[]> images;
|
# std::map<int, uint8[]> images;
|
||||||
@@ -17,7 +21,7 @@ rtabmap/Bytes[] depths
|
|||||||
# use rtabmap::util3d::uncompressData() from <rtabmap/core/util3d.h>
|
# use rtabmap::util3d::uncompressData() from <rtabmap/core/util3d.h>
|
||||||
# std::map<int, uint8[]> depths2d;
|
# std::map<int, uint8[]> depths2d;
|
||||||
int32[] depth2DIDs
|
int32[] depth2DIDs
|
||||||
rtabmap/Bytes[] depths2D
|
rtabmap/Bytes[] depth2Ds
|
||||||
|
|
||||||
# depth constants
|
# depth constants
|
||||||
int32[] depthConstantIDs
|
int32[] depthConstantIDs
|
||||||
|
|||||||
+54
-24
@@ -650,12 +650,12 @@ bool CoreWrapper::publishMapDataCallback(std_srvs::Empty::Request&, std_srvs::Em
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg->depth2DIDs.resize(depths2d.size());
|
msg->depth2DIDs.resize(depths2d.size());
|
||||||
msg->depths2D.resize(depths2d.size());
|
msg->depth2Ds.resize(depths2d.size());
|
||||||
i=0;
|
i=0;
|
||||||
for(std::map<int, std::vector<unsigned char> >::iterator iter = depths2d.begin(); iter!=depths2d.end(); ++iter)
|
for(std::map<int, std::vector<unsigned char> >::iterator iter = depths2d.begin(); iter!=depths2d.end(); ++iter)
|
||||||
{
|
{
|
||||||
msg->depth2DIDs[i] = iter->first;
|
msg->depth2DIDs[i] = iter->first;
|
||||||
msg->depths2D[i].bytes = iter->second;
|
msg->depth2Ds[i].bytes = iter->second;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,11 +709,8 @@ void CoreWrapper::publishStats(const Statistics & stats)
|
|||||||
msg->header.frame_id = mapFrameId_;
|
msg->header.frame_id = mapFrameId_;
|
||||||
|
|
||||||
msg->refId = stats.refImageId();
|
msg->refId = stats.refImageId();
|
||||||
msg->refMapId = stats.refImageMapId();
|
|
||||||
msg->loopClosureId = stats.loopClosureId();
|
msg->loopClosureId = stats.loopClosureId();
|
||||||
msg->loopClosureMapId = stats.loopClosureMapId();
|
|
||||||
msg->localLoopClosureId = stats.localLoopClosureId();
|
msg->localLoopClosureId = stats.localLoopClosureId();
|
||||||
msg->localLoopClosureMapId = stats.localLoopClosureMapId();
|
|
||||||
|
|
||||||
msg->nodeIds.resize(stats.poses().size());
|
msg->nodeIds.resize(stats.poses().size());
|
||||||
msg->nodePoses.resize(stats.poses().size());
|
msg->nodePoses.resize(stats.poses().size());
|
||||||
@@ -742,34 +739,28 @@ void CoreWrapper::publishStats(const Statistics & stats)
|
|||||||
msg->header.frame_id = mapFrameId_;
|
msg->header.frame_id = mapFrameId_;
|
||||||
|
|
||||||
msg->refId = stats.refImageId();
|
msg->refId = stats.refImageId();
|
||||||
msg->refMapId = stats.refImageMapId();
|
|
||||||
msg->loopClosureId = stats.loopClosureId();
|
msg->loopClosureId = stats.loopClosureId();
|
||||||
msg->loopClosureMapId = stats.loopClosureMapId();
|
|
||||||
msg->localLoopClosureId = stats.localLoopClosureId();
|
msg->localLoopClosureId = stats.localLoopClosureId();
|
||||||
msg->localLoopClosureMapId = stats.localLoopClosureMapId();
|
|
||||||
|
|
||||||
msg->nodeIds.resize(stats.poses().size());
|
msg->data.poseIDs.resize(stats.poses().size());
|
||||||
msg->nodePoses.resize(stats.poses().size());
|
msg->data.poses.resize(stats.poses().size());
|
||||||
int i=0;
|
int i=0;
|
||||||
for(std::map<int, Transform>::const_iterator iter = stats.poses().begin();
|
for(std::map<int, Transform>::const_iterator iter = stats.poses().begin();
|
||||||
iter!=stats.poses().end();
|
iter!=stats.poses().end();
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
msg->nodeIds[i] = iter->first;
|
msg->data.poseIDs[i] = iter->first;
|
||||||
transformToPoseMsg(iter->second, msg->nodePoses[i]);
|
transformToPoseMsg(iter->second, msg->data.poses[i]);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
transformToGeometryMsg(stats.mapCorrection(), msg->mapCorrection);
|
transformToGeometryMsg(stats.mapCorrection(), msg->data.mapCorrection);
|
||||||
transformToGeometryMsg(stats.loopClosureTransform(), msg->loopClosureTransform);
|
transformToGeometryMsg(stats.loopClosureTransform(), msg->loopClosureTransform);
|
||||||
transformToPoseMsg(stats.currentPose(), msg->currentPose);
|
transformToPoseMsg(stats.currentPose(), msg->currentPose);
|
||||||
|
|
||||||
// Detailed info
|
// Detailed info
|
||||||
if(stats.extended())
|
if(stats.extended())
|
||||||
{
|
{
|
||||||
msg->refImage = stats.refImage();
|
|
||||||
msg->loopImage = stats.loopImage();
|
|
||||||
|
|
||||||
//Posterior, likelihood, childCount
|
//Posterior, likelihood, childCount
|
||||||
msg->posteriorKeys = uKeys(stats.posterior());
|
msg->posteriorKeys = uKeys(stats.posterior());
|
||||||
msg->posteriorValues = uValues(stats.posterior());
|
msg->posteriorValues = uValues(stats.posterior());
|
||||||
@@ -819,17 +810,56 @@ void CoreWrapper::publishStats(const Statistics & stats)
|
|||||||
msg->statsKeys = uKeys(stats.data());
|
msg->statsKeys = uKeys(stats.data());
|
||||||
msg->statsValues = uValues(stats.data());
|
msg->statsValues = uValues(stats.data());
|
||||||
|
|
||||||
|
msg->data.mapIDs = uKeys(stats.getMapIds());
|
||||||
|
msg->data.maps = uValues(stats.getMapIds());
|
||||||
|
|
||||||
//RGB-D SLAM data
|
//RGB-D SLAM data
|
||||||
msg->refDepth = stats.refDepth();
|
msg->data.imageIDs.resize(stats.getImages().size());
|
||||||
msg->refDepth2D = stats.refDepth2D();
|
msg->data.images.resize(stats.getImages().size());
|
||||||
msg->loopDepth = stats.loopDepth();
|
index = 0;
|
||||||
msg->loopDepth2D = stats.loopDepth2D();
|
for(std::map<int, std::vector<unsigned char> >::const_iterator i=stats.getImages().begin();
|
||||||
|
i!=stats.getImages().end();
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
msg->data.imageIDs[index] = i->first;
|
||||||
|
msg->data.images[index].bytes = i->second;
|
||||||
|
}
|
||||||
|
|
||||||
msg->refDepthConstant = stats.refDepthConstant();
|
msg->data.depthIDs.resize(stats.getDepths().size());
|
||||||
msg->loopDepthConstant = stats.loopDepthConstant();
|
msg->data.depths.resize(stats.getDepths().size());
|
||||||
|
index = 0;
|
||||||
|
for(std::map<int, std::vector<unsigned char> >::const_iterator i=stats.getDepths().begin();
|
||||||
|
i!=stats.getDepths().end();
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
msg->data.depthIDs[index] = i->first;
|
||||||
|
msg->data.depths[index].bytes = i->second;
|
||||||
|
}
|
||||||
|
|
||||||
transformToGeometryMsg(stats.refLocalTransform(), msg->refLocalTransform);
|
msg->data.depth2DIDs.resize(stats.getDepth2ds().size());
|
||||||
transformToGeometryMsg(stats.loopLocalTransform(), msg->loopLocalTransform);
|
msg->data.depth2Ds.resize(stats.getDepth2ds().size());
|
||||||
|
index = 0;
|
||||||
|
for(std::map<int, std::vector<unsigned char> >::const_iterator i=stats.getDepth2ds().begin();
|
||||||
|
i!=stats.getDepth2ds().end();
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
msg->data.depth2DIDs[index] = i->first;
|
||||||
|
msg->data.depth2Ds[index].bytes = i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg->data.localTransformIDs.resize(stats.getLocalTransforms().size());
|
||||||
|
msg->data.localTransforms.resize(stats.getLocalTransforms().size());
|
||||||
|
index = 0;
|
||||||
|
for(std::map<int, Transform>::const_iterator i=stats.getLocalTransforms().begin();
|
||||||
|
i!=stats.getLocalTransforms().end();
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
msg->data.localTransformIDs[index] = i->first;
|
||||||
|
transformToGeometryMsg(i->second, msg->data.localTransforms[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg->data.depthConstantIDs = uKeys(stats.getDepthConstants());
|
||||||
|
msg->data.depthConstants = uValues(stats.getDepthConstants());
|
||||||
}
|
}
|
||||||
infoPubEx_.publish(msg);
|
infoPubEx_.publish(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,16 +62,19 @@ public:
|
|||||||
|
|
||||||
void infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
void infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
||||||
{
|
{
|
||||||
if(!uContains(scans_, msg->refId) && msg->refDepth2D.size())
|
for(unsigned int i=0; i<msg->data.depth2DIDs.size() && i<msg->data.depth2Ds.size(); ++i)
|
||||||
{
|
{
|
||||||
cv::Mat depth2d = util3d::uncompressData(msg->refDepth2D);
|
if(!uContains(scans_, msg->data.depth2DIDs[i]))
|
||||||
scans_.insert(std::make_pair(msg->refId, util3d::depth2DToPointCloud(depth2d)));
|
{
|
||||||
|
cv::Mat depth2d = util3d::uncompressData(msg->data.depth2Ds[i].bytes);
|
||||||
|
scans_.insert(std::make_pair(msg->data.depth2DIDs[i], util3d::depth2DToPointCloud(depth2d)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int, Transform> poses;
|
std::map<int, Transform> poses;
|
||||||
for(unsigned int i=0; i<msg->nodeIds.size() && i<msg->nodePoses.size(); ++i)
|
for(unsigned int i=0; i<msg->data.poseIDs.size() && i<msg->data.poses.size(); ++i)
|
||||||
{
|
{
|
||||||
poses.insert(std::make_pair(msg->nodeIds[i], transformFromPoseMsg(msg->nodePoses[i])));
|
poses.insert(std::make_pair(msg->data.poseIDs[i], transformFromPoseMsg(msg->data.poses[i])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gridMap_.getNumSubscribers())
|
if(gridMap_.getNumSubscribers())
|
||||||
@@ -114,18 +117,18 @@ public:
|
|||||||
{
|
{
|
||||||
std::map<int, std::vector<unsigned char> > depths2d;
|
std::map<int, std::vector<unsigned char> > depths2d;
|
||||||
|
|
||||||
if(msg->depth2DIDs.size() != msg->depths2D.size())
|
if(msg->depth2DIDs.size() != msg->depth2Ds.size())
|
||||||
{
|
{
|
||||||
ROS_WARN("grid_map_assembler: receiving map... depths2D and depth2DIDs are not the same size (%d vs %d)!",
|
ROS_WARN("grid_map_assembler: receiving map... depths2D and depth2DIDs are not the same size (%d vs %d)!",
|
||||||
(int)msg->depths2D.size(), (int)msg->depth2DIDs.size());
|
(int)msg->depth2Ds.size(), (int)msg->depth2DIDs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill maps
|
// fill maps
|
||||||
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depths2D.size(); ++i)
|
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depth2Ds.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!uContains(scans_, msg->depth2DIDs[i]))
|
if(!uContains(scans_, msg->depth2DIDs[i]))
|
||||||
{
|
{
|
||||||
cv::Mat depth2d = util3d::uncompressData(msg->depths2D[i].bytes);
|
cv::Mat depth2d = util3d::uncompressData(msg->depth2Ds[i].bytes);
|
||||||
scans_.insert(std::make_pair(msg->depth2DIDs[i], util3d::depth2DToPointCloud(depth2d)));
|
scans_.insert(std::make_pair(msg->depth2DIDs[i], util3d::depth2DToPointCloud(depth2d)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-25
@@ -111,14 +111,8 @@ void GuiWrapper::infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
|||||||
stat.setExtended(true); // Extended
|
stat.setExtended(true); // Extended
|
||||||
|
|
||||||
stat.setRefImageId(msg->refId);
|
stat.setRefImageId(msg->refId);
|
||||||
stat.setRefImageMapId(msg->refMapId);
|
|
||||||
stat.setLoopClosureId(msg->loopClosureId);
|
stat.setLoopClosureId(msg->loopClosureId);
|
||||||
stat.setLoopClosureMapId(msg->loopClosureMapId);
|
|
||||||
stat.setLocalLoopClosureId(msg->localLoopClosureId);
|
stat.setLocalLoopClosureId(msg->localLoopClosureId);
|
||||||
stat.setLocalLoopClosureMapId(msg->localLoopClosureMapId);
|
|
||||||
|
|
||||||
stat.setRefImage(msg->refImage);
|
|
||||||
stat.setLoopImage(msg->loopImage);
|
|
||||||
|
|
||||||
//Posterior, likelihood, childCount
|
//Posterior, likelihood, childCount
|
||||||
std::map<int, float> mapIntFloat;
|
std::map<int, float> mapIntFloat;
|
||||||
@@ -179,28 +173,59 @@ void GuiWrapper::infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//RGB-D SLAM data
|
//RGB-D SLAM data
|
||||||
stat.setRefDepth(msg->refDepth);
|
stat.setMapCorrection(transformFromGeometryMsg(msg->data.mapCorrection));
|
||||||
stat.setRefDepth2D(msg->refDepth2D);
|
|
||||||
stat.setLoopDepth(msg->loopDepth);
|
|
||||||
stat.setLoopDepth2D(msg->loopDepth2D);
|
|
||||||
|
|
||||||
stat.setRefDepthConstant(msg->refDepthConstant);
|
|
||||||
stat.setLoopDepthConstant(msg->loopDepthConstant);
|
|
||||||
|
|
||||||
stat.setRefLocalTransform(transformFromGeometryMsg(msg->refLocalTransform));
|
|
||||||
stat.setLoopLocalTransform(transformFromGeometryMsg(msg->loopLocalTransform));
|
|
||||||
|
|
||||||
stat.setMapCorrection(transformFromGeometryMsg(msg->mapCorrection));
|
|
||||||
stat.setLoopClosureTransform(transformFromGeometryMsg(msg->loopClosureTransform));
|
stat.setLoopClosureTransform(transformFromGeometryMsg(msg->loopClosureTransform));
|
||||||
stat.setCurrentPose(transformFromPoseMsg(msg->currentPose));
|
stat.setCurrentPose(transformFromPoseMsg(msg->currentPose));
|
||||||
|
|
||||||
std::map<int, Transform> poses;
|
std::map<int, std::vector<unsigned char> > images;
|
||||||
for(unsigned int i=0; i<msg->nodeIds.size() && i<msg->nodePoses.size(); ++i)
|
for(unsigned int i=0; i<msg->data.imageIDs.size() && i<msg->data.images.size(); ++i)
|
||||||
{
|
{
|
||||||
poses.insert(std::make_pair(msg->nodeIds[i], transformFromPoseMsg(msg->nodePoses[i])));
|
images.insert(std::make_pair(msg->data.imageIDs[i], msg->data.images[i].bytes));
|
||||||
|
}
|
||||||
|
stat.setImages(images);
|
||||||
|
|
||||||
|
std::map<int, std::vector<unsigned char> > depths;
|
||||||
|
for(unsigned int i=0; i<msg->data.depthIDs.size() && i<msg->data.depths.size(); ++i)
|
||||||
|
{
|
||||||
|
depths.insert(std::make_pair(msg->data.depthIDs[i], msg->data.depths[i].bytes));
|
||||||
|
}
|
||||||
|
stat.setDepths(depths);
|
||||||
|
|
||||||
|
std::map<int, std::vector<unsigned char> > depth2ds;
|
||||||
|
for(unsigned int i=0; i<msg->data.depth2DIDs.size() && i<msg->data.depth2Ds.size(); ++i)
|
||||||
|
{
|
||||||
|
depth2ds.insert(std::make_pair(msg->data.depth2DIDs[i], msg->data.depth2Ds[i].bytes));
|
||||||
|
}
|
||||||
|
stat.setDepth2ds(depth2ds);
|
||||||
|
|
||||||
|
std::map<int, float> depthConstants;
|
||||||
|
for(unsigned int i=0; i<msg->data.depthConstantIDs.size() && i<msg->data.depthConstants.size(); ++i)
|
||||||
|
{
|
||||||
|
depthConstants.insert(std::make_pair(msg->data.depthConstantIDs[i], msg->data.depthConstants[i]));
|
||||||
|
}
|
||||||
|
stat.setDepthConstants(depthConstants);
|
||||||
|
|
||||||
|
std::map<int, Transform> localTransforms;
|
||||||
|
for(unsigned int i=0; i<msg->data.localTransformIDs.size() && i<msg->data.localTransforms.size(); ++i)
|
||||||
|
{
|
||||||
|
localTransforms.insert(std::make_pair(msg->data.localTransformIDs[i], transformFromGeometryMsg(msg->data.localTransforms[i])));
|
||||||
|
}
|
||||||
|
stat.setLocalTransforms(localTransforms);
|
||||||
|
|
||||||
|
std::map<int, Transform> poses;
|
||||||
|
for(unsigned int i=0; i<msg->data.poseIDs.size() && i<msg->data.poses.size(); ++i)
|
||||||
|
{
|
||||||
|
poses.insert(std::make_pair(msg->data.poseIDs[i], transformFromPoseMsg(msg->data.poses[i])));
|
||||||
}
|
}
|
||||||
stat.setPoses(poses);
|
stat.setPoses(poses);
|
||||||
|
|
||||||
|
std::map<int, int> mapIds;
|
||||||
|
for(unsigned int i=0; i<msg->data.mapIDs.size() && i<msg->data.maps.size(); ++i)
|
||||||
|
{
|
||||||
|
mapIds.insert(std::make_pair(msg->data.mapIDs[i], msg->data.maps[i]));
|
||||||
|
}
|
||||||
|
stat.setMapIds(mapIds);
|
||||||
|
|
||||||
this->post(new RtabmapEvent(stat));
|
this->post(new RtabmapEvent(stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,10 +251,10 @@ void GuiWrapper::mapDataReceivedCallback(const rtabmap::MapDataConstPtr & msg)
|
|||||||
(int)msg->depths.size(), (int)msg->depthIDs.size());
|
(int)msg->depths.size(), (int)msg->depthIDs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg->depth2DIDs.size() != msg->depths2D.size())
|
if(msg->depth2DIDs.size() != msg->depth2Ds.size())
|
||||||
{
|
{
|
||||||
ROS_WARN("rtabmapviz: receiving map... depths2D and IDs are not the same size (%d vs %d)!",
|
ROS_WARN("rtabmapviz: receiving map... depths2D and IDs are not the same size (%d vs %d)!",
|
||||||
(int)msg->depths2D.size(), (int)msg->depth2DIDs.size());
|
(int)msg->depth2Ds.size(), (int)msg->depth2DIDs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg->depthConstantIDs.size() != msg->depthConstants.size())
|
if(msg->depthConstantIDs.size() != msg->depthConstants.size())
|
||||||
@@ -248,9 +273,9 @@ void GuiWrapper::mapDataReceivedCallback(const rtabmap::MapDataConstPtr & msg)
|
|||||||
depths.insert(std::make_pair(msg->depthIDs[i], msg->depths[i].bytes));
|
depths.insert(std::make_pair(msg->depthIDs[i], msg->depths[i].bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depths2D.size(); ++i)
|
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depth2Ds.size(); ++i)
|
||||||
{
|
{
|
||||||
depths2d.insert(std::make_pair(msg->depth2DIDs[i], msg->depths2D[i].bytes));
|
depths2d.insert(std::make_pair(msg->depth2DIDs[i], msg->depth2Ds[i].bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i=0; i<msg->depthConstantIDs.size() && i < msg->depthConstants.size(); ++i)
|
for(unsigned int i=0; i<msg->depthConstantIDs.size() && i < msg->depthConstants.size(); ++i)
|
||||||
|
|||||||
@@ -64,50 +64,89 @@ public:
|
|||||||
|
|
||||||
void infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
void infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg)
|
||||||
{
|
{
|
||||||
if(!uContains(rgbClouds_, msg->refId) && msg->refImage.size() && msg->refDepth.size() && msg->refDepthConstant > 0)
|
for(unsigned int i=0; i<msg->data.localTransformIDs.size() && i<msg->data.localTransforms.size(); ++i)
|
||||||
{
|
|
||||||
rtabmap::Transform localTransform = transformFromGeometryMsg(msg->refLocalTransform);
|
|
||||||
|
|
||||||
if(!localTransform.isNull())
|
|
||||||
{
|
{
|
||||||
cv::Mat image = util3d::uncompressImage(msg->refImage);
|
int id = msg->data.localTransformIDs[i];
|
||||||
cv::Mat depth = util3d::uncompressImage(msg->refDepth);
|
if(!uContains(rgbClouds_, id))
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = util3d::cloudFromDepthRGB(image, depth, msg->refDepthConstant, cloudDecimation_);
|
|
||||||
|
|
||||||
if(cloudVoxelSize_ > 0)
|
|
||||||
{
|
{
|
||||||
cloud = util3d::voxelize(cloud, cloudVoxelSize_);
|
rtabmap::Transform localTransform = transformFromGeometryMsg(msg->data.localTransforms[i]);
|
||||||
|
if(!localTransform.isNull())
|
||||||
|
{
|
||||||
|
cv::Mat image, depth;
|
||||||
|
float depthConstant = 0.0f;
|
||||||
|
|
||||||
|
for(unsigned int i=0; i<msg->data.imageIDs.size() && i<msg->data.images.size(); ++i)
|
||||||
|
{
|
||||||
|
if(msg->data.imageIDs[i] == id)
|
||||||
|
{
|
||||||
|
image = util3d::uncompressImage(msg->data.images[i].bytes);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(unsigned int i=0; i<msg->data.depthIDs.size() && i<msg->data.depths.size(); ++i)
|
||||||
|
{
|
||||||
|
if(msg->data.depthIDs[i] == id)
|
||||||
|
{
|
||||||
|
depth = util3d::uncompressImage(msg->data.depths[i].bytes);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(unsigned int i=0; i<msg->data.depthConstantIDs.size() && i<msg->data.depthConstants.size(); ++i)
|
||||||
|
{
|
||||||
|
if(msg->data.depthConstantIDs[i] == id)
|
||||||
|
{
|
||||||
|
depthConstant = msg->data.depthConstants[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!image.empty() && !depth.empty() && depthConstant > 0.0f)
|
||||||
|
{
|
||||||
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = util3d::cloudFromDepthRGB(image, depth, depthConstant, cloudDecimation_);
|
||||||
|
|
||||||
|
if(cloudVoxelSize_ > 0)
|
||||||
|
{
|
||||||
|
cloud = util3d::voxelize(cloud, cloudVoxelSize_);
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud = util3d::transformPointCloud(cloud, localTransform);
|
||||||
|
|
||||||
|
rgbClouds_.insert(std::make_pair(id, cloud));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cloud = util3d::transformPointCloud(cloud, localTransform);
|
|
||||||
|
|
||||||
rgbClouds_.insert(std::make_pair(msg->refId, cloud));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!uContains(scans_, msg->refId) && msg->refDepth2D.size())
|
|
||||||
|
for(unsigned int i=0; i<msg->data.depth2DIDs.size() && i<msg->data.depth2Ds.size(); ++i)
|
||||||
{
|
{
|
||||||
cv::Mat depth2d = util3d::uncompressData(msg->refDepth2D);
|
if(!uContains(scans_, msg->data.depth2DIDs[i]))
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud = util3d::depth2DToPointCloud(depth2d);
|
|
||||||
if(scanVoxelSize_ > 0)
|
|
||||||
{
|
{
|
||||||
cloud = util3d::voxelize(cloud, scanVoxelSize_);
|
cv::Mat depth2d = util3d::uncompressData(msg->data.depth2Ds[i].bytes);
|
||||||
}
|
if(!depth2d.empty())
|
||||||
|
{
|
||||||
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud = util3d::depth2DToPointCloud(depth2d);
|
||||||
|
if(scanVoxelSize_ > 0)
|
||||||
|
{
|
||||||
|
cloud = util3d::voxelize(cloud, scanVoxelSize_);
|
||||||
|
}
|
||||||
|
|
||||||
scans_.insert(std::make_pair(msg->refId, cloud));
|
scans_.insert(std::make_pair(msg->data.depth2DIDs[i], cloud));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(assembledMapClouds_.getNumSubscribers())
|
if(assembledMapClouds_.getNumSubscribers())
|
||||||
{
|
{
|
||||||
// generate the assembled cloud!
|
// generate the assembled cloud!
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr assembledCloud(new pcl::PointCloud<pcl::PointXYZRGB>);
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr assembledCloud(new pcl::PointCloud<pcl::PointXYZRGB>);
|
||||||
|
|
||||||
for(unsigned int i=0; i<msg->nodeIds.size() && i<msg->nodePoses.size(); ++i)
|
for(unsigned int i=0; i<msg->data.poseIDs.size() && i<msg->data.poses.size(); ++i)
|
||||||
{
|
{
|
||||||
Transform pose = transformFromPoseMsg(msg->nodePoses[i]);
|
Transform pose = transformFromPoseMsg(msg->data.poses[i]);
|
||||||
|
|
||||||
std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr >::iterator iter = rgbClouds_.find(msg->nodeIds[i]);
|
std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr >::iterator iter = rgbClouds_.find(msg->data.poseIDs[i]);
|
||||||
if(iter != rgbClouds_.end())
|
if(iter != rgbClouds_.end())
|
||||||
{
|
{
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr transformed = util3d::transformPointCloud(iter->second, pose);
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr transformed = util3d::transformPointCloud(iter->second, pose);
|
||||||
@@ -135,11 +174,11 @@ public:
|
|||||||
// generate the assembled scan!
|
// generate the assembled scan!
|
||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr assembledCloud(new pcl::PointCloud<pcl::PointXYZ>);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr assembledCloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||||
|
|
||||||
for(unsigned int i=0; i<msg->nodeIds.size() && i<msg->nodePoses.size(); ++i)
|
for(unsigned int i=0; i<msg->data.poseIDs.size() && i<msg->data.poses.size(); ++i)
|
||||||
{
|
{
|
||||||
Transform pose = transformFromPoseMsg(msg->nodePoses[i]);
|
Transform pose = transformFromPoseMsg(msg->data.poses[i]);
|
||||||
|
|
||||||
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr >::iterator iter = scans_.find(msg->nodeIds[i]);
|
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr >::iterator iter = scans_.find(msg->data.poseIDs[i]);
|
||||||
if(iter != scans_.end())
|
if(iter != scans_.end())
|
||||||
{
|
{
|
||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr transformed = util3d::transformPointCloud(iter->second, pose);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr transformed = util3d::transformPointCloud(iter->second, pose);
|
||||||
@@ -190,10 +229,10 @@ public:
|
|||||||
(int)msg->depthConstants.size(), (int)msg->depthConstantIDs.size());
|
(int)msg->depthConstants.size(), (int)msg->depthConstantIDs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg->depth2DIDs.size() != msg->depths2D.size())
|
if(msg->depth2DIDs.size() != msg->depth2Ds.size())
|
||||||
{
|
{
|
||||||
ROS_WARN("rtabmapviz: receiving map... depths2D and depth2DIDs are not the same size (%d vs %d)!",
|
ROS_WARN("rtabmapviz: receiving map... depths2D and depth2DIDs are not the same size (%d vs %d)!",
|
||||||
(int)msg->depths2D.size(), (int)msg->depth2DIDs.size());
|
(int)msg->depth2Ds.size(), (int)msg->depth2DIDs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill maps
|
// fill maps
|
||||||
@@ -230,11 +269,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depths2D.size(); ++i)
|
for(unsigned int i=0; i<msg->depth2DIDs.size() && i < msg->depth2Ds.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!uContains(scans_, msg->depth2DIDs[i]))
|
if(!uContains(scans_, msg->depth2DIDs[i]))
|
||||||
{
|
{
|
||||||
cv::Mat depth2d = util3d::uncompressData(msg->depths2D[i].bytes);
|
cv::Mat depth2d = util3d::uncompressData(msg->depth2Ds[i].bytes);
|
||||||
scans_.insert(std::make_pair(msg->depth2DIDs[i], util3d::depth2DToPointCloud(depth2d)));
|
scans_.insert(std::make_pair(msg->depth2DIDs[i], util3d::depth2DToPointCloud(depth2d)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user