mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Added some asserts on pose radius filtering
This commit is contained in:
@@ -899,9 +899,10 @@ std::map<int, Transform> radiusPosesFiltering(
|
|||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||||
cloud->resize(poses.size());
|
cloud->resize(poses.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
for(std::map<int, Transform>::const_iterator iter = poses.begin(); iter!=poses.end(); ++iter)
|
for(std::map<int, Transform>::const_iterator iter = poses.begin(); iter!=poses.end(); ++iter, ++i)
|
||||||
{
|
{
|
||||||
(*cloud)[i++] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
(*cloud)[i] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
||||||
|
UASSERT_MSG(pcl::isFinite((*cloud)[i]), uFormat("Invalid pose (%d) %s", iter->first, iter->second.prettyPrint().c_str()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// radius filtering
|
// radius filtering
|
||||||
@@ -1003,9 +1004,10 @@ std::multimap<int, int> radiusPosesClustering(const std::map<int, Transform> & p
|
|||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||||
cloud->resize(poses.size());
|
cloud->resize(poses.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
for(std::map<int, Transform>::const_iterator iter = poses.begin(); iter!=poses.end(); ++iter)
|
for(std::map<int, Transform>::const_iterator iter = poses.begin(); iter!=poses.end(); ++iter, ++i)
|
||||||
{
|
{
|
||||||
(*cloud)[i++] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
(*cloud)[i] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
||||||
|
UASSERT_MSG(pcl::isFinite((*cloud)[i]), uFormat("Invalid pose (%d) %s", iter->first, iter->second.prettyPrint().c_str()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// radius clustering (nearest neighbors)
|
// radius clustering (nearest neighbors)
|
||||||
@@ -1249,17 +1251,21 @@ std::map<int, float> getNodesInRadius(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||||
cloud->resize(nodes.size()-1);
|
cloud->resize(nodes.size());
|
||||||
std::vector<int> ids(nodes.size()-1);
|
std::vector<int> ids(nodes.size());
|
||||||
int oi = 0;
|
int oi = 0;
|
||||||
for(std::map<int, Transform>::const_iterator iter = nodes.begin(); iter!=nodes.end(); ++iter)
|
for(std::map<int, Transform>::const_iterator iter = nodes.begin(); iter!=nodes.end(); ++iter)
|
||||||
{
|
{
|
||||||
if(iter->first != nodeId)
|
if(iter->first != nodeId)
|
||||||
{
|
{
|
||||||
(*cloud)[oi] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
(*cloud)[oi] = pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z());
|
||||||
ids[oi++] = iter->first;
|
UASSERT_MSG(pcl::isFinite((*cloud)[oi]), uFormat("Invalid pose (%d) %s", iter->first, iter->second.prettyPrint().c_str()).c_str());
|
||||||
|
ids[oi] = iter->first;
|
||||||
|
++oi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cloud->resize(oi);
|
||||||
|
ids.resize(oi);
|
||||||
|
|
||||||
Transform fromT = nodes.at(nodeId);
|
Transform fromT = nodes.at(nodeId);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user