mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
removing query from poses returned from Graph::getNodesInRadius()
This commit is contained in:
@@ -875,7 +875,7 @@ int findNearestNode(
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return <id, sqrd distance>, including query
|
// return <id, sqrd distance>, excluding query
|
||||||
std::map<int, float> getNodesInRadius(
|
std::map<int, float> getNodesInRadius(
|
||||||
int nodeId,
|
int nodeId,
|
||||||
const std::map<int, Transform> & nodes,
|
const std::map<int, Transform> & nodes,
|
||||||
@@ -883,20 +883,27 @@ std::map<int, float> getNodesInRadius(
|
|||||||
float radius)
|
float radius)
|
||||||
{
|
{
|
||||||
UASSERT(uContains(nodes, nodeId));
|
UASSERT(uContains(nodes, nodeId));
|
||||||
|
std::map<int, float> foundNodes;
|
||||||
|
if(nodes.size() <= 1)
|
||||||
|
{
|
||||||
|
return foundNodes;
|
||||||
|
}
|
||||||
|
|
||||||
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());
|
cloud->resize(nodes.size()-1);
|
||||||
std::vector<int> ids(nodes.size());
|
std::vector<int> ids(nodes.size()-1);
|
||||||
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)
|
||||||
{
|
{
|
||||||
(*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;
|
ids[oi++] = iter->first;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Transform fromT = nodes.at(nodeId);
|
Transform fromT = nodes.at(nodeId);
|
||||||
|
|
||||||
std::map<int, float> foundNodes;
|
|
||||||
if(cloud->size())
|
if(cloud->size())
|
||||||
{
|
{
|
||||||
pcl::search::KdTree<pcl::PointXYZ>::Ptr kdTree(new pcl::search::KdTree<pcl::PointXYZ>);
|
pcl::search::KdTree<pcl::PointXYZ>::Ptr kdTree(new pcl::search::KdTree<pcl::PointXYZ>);
|
||||||
|
|||||||
@@ -1432,7 +1432,8 @@ bool Rtabmap::process(const SensorData & data)
|
|||||||
rejectedHypothesis = transform.isNull();
|
rejectedHypothesis = transform.isNull();
|
||||||
if(rejectedHypothesis)
|
if(rejectedHypothesis)
|
||||||
{
|
{
|
||||||
UINFO("Cannot compute a loop closure transform between %d and %d: %s", _loopClosureHypothesis.first, signature->id(), rejectedMsg.c_str());
|
UWARN("Rejected loop closure transform between %d and %d: %s",
|
||||||
|
_loopClosureHypothesis.first, signature->id(), rejectedMsg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!rejectedHypothesis)
|
if(!rejectedHypothesis)
|
||||||
|
|||||||
Reference in New Issue
Block a user