DbViewer: Updated add constraint order (from=old, to=newer)

This commit is contained in:
matlabbe
2020-04-08 18:52:38 -04:00
parent 7e8e80db2c
commit 82a19a2ff1

View File

@@ -7088,7 +7088,7 @@ bool DatabaseViewer::addConstraint(int from, int to, bool silent)
if(from == to) if(from == to)
{ {
UWARN("Cannot add link to same node"); UWARN("Cannot add link to same node");
return false; return false;
} }
else if(from > to) else if(from > to)
{ {
@@ -7398,6 +7398,10 @@ bool DatabaseViewer::addConstraint(int from, int to, bool silent)
//simply remove from linksRemoved //simply remove from linksRemoved
linksRemoved_.erase(rtabmap::graph::findLink(linksRemoved_, from, to)); linksRemoved_.erase(rtabmap::graph::findLink(linksRemoved_, from, to));
} }
else
{
if(newLink.from() < newLink.to())
{
newLink = newLink.inverse(); newLink = newLink.inverse();
} }
linksAdded_.insert(std::make_pair(newLink.from(), newLink)); linksAdded_.insert(std::make_pair(newLink.from(), newLink));