mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-09 13:00:19 +08:00
DbViewer/info tool: Updated number of links to report unique links. Added statistics about length of loop closures in info tool.
This commit is contained in:
@@ -7290,15 +7290,25 @@ void DatabaseViewer::updateGraphView()
|
||||
int totalPriors = 0;
|
||||
int totalLandmarks = 0;
|
||||
int totalGravity = 0;
|
||||
std::multimap<int, int> uniqueLinks;
|
||||
for(std::multimap<int, rtabmap::Link>::iterator iter=links.begin(); iter!=links.end();)
|
||||
{
|
||||
bool isUnique = iter->second.from() == iter->second.to(); // Count all self-reference links
|
||||
if(graph::findLink(uniqueLinks, iter->second.from(), iter->second.to(), true) == uniqueLinks.end())
|
||||
{
|
||||
uniqueLinks.insert(std::make_pair(iter->second.from(), iter->second.to()));
|
||||
isUnique = true;
|
||||
}
|
||||
|
||||
if(iter->second.type() == Link::kNeighbor)
|
||||
{
|
||||
++totalNeighbor;
|
||||
if(isUnique)
|
||||
++totalNeighbor;
|
||||
}
|
||||
else if(iter->second.type() == Link::kNeighborMerged)
|
||||
{
|
||||
++totalNeighborMerged;
|
||||
if(isUnique)
|
||||
++totalNeighborMerged;
|
||||
}
|
||||
else if(iter->second.type() == Link::kGlobalClosure)
|
||||
{
|
||||
@@ -7308,7 +7318,8 @@ void DatabaseViewer::updateGraphView()
|
||||
continue;
|
||||
}
|
||||
loopLinks_.push_back(iter->second);
|
||||
++totalGlobal;
|
||||
if(isUnique)
|
||||
++totalGlobal;
|
||||
}
|
||||
else if(iter->second.type() == Link::kLocalSpaceClosure)
|
||||
{
|
||||
@@ -7318,7 +7329,8 @@ void DatabaseViewer::updateGraphView()
|
||||
continue;
|
||||
}
|
||||
loopLinks_.push_back(iter->second);
|
||||
++totalLocalSpace;
|
||||
if(isUnique)
|
||||
++totalLocalSpace;
|
||||
}
|
||||
else if(iter->second.type() == Link::kLocalTimeClosure)
|
||||
{
|
||||
@@ -7328,7 +7340,8 @@ void DatabaseViewer::updateGraphView()
|
||||
continue;
|
||||
}
|
||||
loopLinks_.push_back(iter->second);
|
||||
++totalLocalTime;
|
||||
if(isUnique)
|
||||
++totalLocalTime;
|
||||
}
|
||||
else if(iter->second.type() == Link::kUserClosure)
|
||||
{
|
||||
@@ -7338,7 +7351,8 @@ void DatabaseViewer::updateGraphView()
|
||||
continue;
|
||||
}
|
||||
loopLinks_.push_back(iter->second);
|
||||
++totalUser;
|
||||
if(isUnique)
|
||||
++totalUser;
|
||||
}
|
||||
else if(iter->second.type() == Link::kLandmark)
|
||||
{
|
||||
@@ -7353,7 +7367,8 @@ void DatabaseViewer::updateGraphView()
|
||||
poses.insert(std::make_pair(iter->second.to(), poses.at(iter->second.from())*iter->second.transform()));
|
||||
}
|
||||
loopLinks_.push_back(iter->second);
|
||||
++totalLandmarks;
|
||||
if(isUnique)
|
||||
++totalLandmarks;
|
||||
|
||||
// add landmark priors if there are some
|
||||
int markerId = iter->second.to();
|
||||
@@ -7365,16 +7380,19 @@ void DatabaseViewer::updateGraphView()
|
||||
links.insert(std::make_pair(markerId, Link(markerId, markerId, Link::kPosePrior, markerPriors.at(markerId), infMatrix)));
|
||||
UDEBUG("Added prior %d : %s (variance: lin=%f ang=%f)", markerId, markerPriors.at(markerId).prettyPrint().c_str(),
|
||||
markerPriorsLinearVariance, markerPriorsAngularVariance);
|
||||
++totalPriors;
|
||||
if(isUnique)
|
||||
++totalPriors;
|
||||
}
|
||||
}
|
||||
else if(iter->second.type() == Link::kPosePrior)
|
||||
{
|
||||
++totalPriors;
|
||||
if(isUnique)
|
||||
++totalPriors;
|
||||
}
|
||||
else if(iter->second.type() == Link::kGravity)
|
||||
{
|
||||
++totalGravity;
|
||||
if(isUnique)
|
||||
++totalGravity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1393,6 +1393,9 @@
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_41">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>N: Neighbor</p><p>NM: Neighbor Merged</p><p>G: Global</p><p>LS: Local by Space (Proximity)</p><p>LT: Local by Time (Proximity)</p><p>U: User</p><p>P: Prior</p><p>LM: Landmark</p><p>GR: Gravity</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Links (N, NM, G, LS, LT, U, P, LM, GR)</string>
|
||||
</property>
|
||||
|
||||
+17
-2
@@ -347,7 +347,9 @@ int main(int argc, char * argv[])
|
||||
driver->getAllLinks(links, true, true);
|
||||
bool reducedGraph = false;
|
||||
std::vector<int> linkTypes(Link::kEnd, 0);
|
||||
for(std::multimap<int, Link>::iterator iter=links.begin(); iter!=links.end(); ++iter)
|
||||
std::vector<std::vector<float> > linkLengths(Link::kEnd);
|
||||
std::multimap<int, Link> uniqueLinks = graph::filterDuplicateLinks(links);
|
||||
for(std::multimap<int, Link>::iterator iter=uniqueLinks.begin(); iter!=uniqueLinks.end(); ++iter)
|
||||
{
|
||||
if(iter->second.type() == Link::kNeighborMerged)
|
||||
{
|
||||
@@ -356,6 +358,7 @@ int main(int argc, char * argv[])
|
||||
if(iter->second.type()>=0 && iter->second.type()<Link::kEnd)
|
||||
{
|
||||
++linkTypes[iter->second.type()];
|
||||
linkLengths[iter->second.type()].push_back(iter->second.transform().getNorm());
|
||||
}
|
||||
}
|
||||
if(reducedGraph)
|
||||
@@ -408,7 +411,19 @@ int main(int argc, char * argv[])
|
||||
std::cout << (uFormat("Links:\n"));
|
||||
for(size_t i=0; i<linkTypes.size(); ++i)
|
||||
{
|
||||
std::cout << (uFormat("%s%d\n", pad(uFormat(" %s:", Link::typeName((Link::Type)i).c_str())).c_str(), linkTypes[i]));
|
||||
float avg = uMean(linkLengths[i]);
|
||||
float std = uVariance(linkLengths[i], avg);
|
||||
float max = uMax(linkLengths[i]);
|
||||
if(std>0)
|
||||
{
|
||||
std = std::sqrt(std);
|
||||
}
|
||||
std::cout << (uFormat("%s%d\t(length avg: %.2fm, std: %.2fm, max: %.2fm)\n",
|
||||
pad(uFormat(" %s:", Link::typeName((Link::Type)i).c_str())).c_str(),
|
||||
linkTypes[i],
|
||||
avg,
|
||||
std,
|
||||
max));
|
||||
}
|
||||
std::cout << ("\n");
|
||||
long total = 0;
|
||||
|
||||
Reference in New Issue
Block a user