report: added --ignore_inter_nodes option. CloudViewer: set max absolute scan intensity to 100 (was 0=auto). reprocess/replay db: ignore intermediate nodes if Rtabmap/CreateIntermediateNodes is false.

This commit is contained in:
matlabbe
2021-06-21 17:23:53 -04:00
parent f475f2d21c
commit 5167927d01
11 changed files with 57 additions and 19 deletions

View File

@@ -173,7 +173,7 @@ public:
void loadLinks(int signatureId, std::multimap<int, Link> & links, Link::Type type = Link::kUndef) const;
void getWeight(int signatureId, int & weight) const;
void getLastNodeIds(std::set<int> & ids) const;
void getAllNodeIds(std::set<int> & ids, bool ignoreChildren = false, bool ignoreBadSignatures = false) const;
void getAllNodeIds(std::set<int> & ids, bool ignoreChildren = false, bool ignoreBadSignatures = false, bool ignoreIntermediateNodes = false) const;
void getAllLinks(std::multimap<int, Link> & links, bool ignoreNullLinks = true, bool withLandmarks = false) const;
void getLastNodeId(int & id) const;
void getLastMapId(int & mapId) const;
@@ -276,7 +276,7 @@ protected:
virtual bool getLaserScanInfoQuery(int signatureId, LaserScan & info) const = 0;
virtual bool getNodeInfoQuery(int signatureId, Transform & pose, int & mapId, int & weight, std::string & label, double & stamp, Transform & groundTruthPose, std::vector<float> & velocity, GPS & gps, EnvSensors & sensors) const = 0;
virtual void getLastNodeIdsQuery(std::set<int> & ids) const = 0;
virtual void getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures) const = 0;
virtual void getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures, bool ignoreIntermediateNodes) const = 0;
virtual void getAllLinksQuery(std::multimap<int, Link> & links, bool ignoreNullLinks, bool withLandmarks) const = 0;
virtual void getLastIdQuery(const std::string & tableName, int & id, const std::string & fieldName="id") const = 0;
virtual void getInvertedIndexNiQuery(int signatureId, int & ni) const = 0;

View File

@@ -141,7 +141,7 @@ protected:
virtual bool getLaserScanInfoQuery(int signatureId, LaserScan & info) const;
virtual bool getNodeInfoQuery(int signatureId, Transform & pose, int & mapId, int & weight, std::string & label, double & stamp, Transform & groundTruthPose, std::vector<float> & velocity, GPS & gps, EnvSensors & sensors) const;
virtual void getLastNodeIdsQuery(std::set<int> & ids) const;
virtual void getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures) const;
virtual void getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures, bool ignoreIntermediateNodes) const;
virtual void getAllLinksQuery(std::multimap<int, Link> & links, bool ignoreNullLinks, bool withLandmarks) const;
virtual void getLastIdQuery(const std::string & tableName, int & id, const std::string & fieldName="id") const;
virtual void getInvertedIndexNiQuery(int signatureId, int & ni) const;

View File

@@ -52,7 +52,8 @@ public:
bool goalsIgnored = false,
int startId = 0,
int cameraIndex = -1,
int stopId = 0);
int stopId = 0,
bool intermediateNodesIgnored = false);
DBReader(const std::list<std::string> & databasePaths,
float frameRate = 0.0f, // -1 = use Database stamps, 0 = inf
bool odometryIgnored = false,
@@ -60,7 +61,8 @@ public:
bool goalsIgnored = false,
int startId = 0,
int cameraIndex = -1,
int stopId = 0);
int stopId = 0,
bool intermediateNodesIgnored = false);
virtual ~DBReader();
virtual bool init(
@@ -85,6 +87,7 @@ private:
int _startId;
int _stopId;
int _cameraIndex;
bool _intermediateNodesIgnored;
DBDriver * _dbDriver;
UTimer _timer;

View File

@@ -873,7 +873,7 @@ void DBDriver::getLastNodeIds(std::set<int> & ids) const
_dbSafeAccessMutex.unlock();
}
void DBDriver::getAllNodeIds(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures) const
void DBDriver::getAllNodeIds(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures, bool ignoreIntermediateNodes) const
{
// look in the trash
_trashesMutex.lock();
@@ -896,7 +896,7 @@ void DBDriver::getAllNodeIds(std::set<int> & ids, bool ignoreChildren, bool igno
}
}
}
if(hasNeighbors)
if(hasNeighbors && (!ignoreIntermediateNodes || sIter->second->getWeight() != -1))
{
ids.insert(sIter->first);
}
@@ -908,7 +908,7 @@ void DBDriver::getAllNodeIds(std::set<int> & ids, bool ignoreChildren, bool igno
_trashesMutex.unlock();
_dbSafeAccessMutex.lock();
this->getAllNodeIdsQuery(ids, ignoreChildren, ignoreBadSignatures);
this->getAllNodeIdsQuery(ids, ignoreChildren, ignoreBadSignatures, ignoreIntermediateNodes);
_dbSafeAccessMutex.unlock();
}

View File

@@ -2396,7 +2396,7 @@ void DBDriverSqlite3::getLastNodeIdsQuery(std::set<int> & ids) const
}
}
void DBDriverSqlite3::getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures) const
void DBDriverSqlite3::getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren, bool ignoreBadSignatures, bool ignoreIntermediateNodes) const
{
if(_ppDb)
{
@@ -2414,11 +2414,19 @@ void DBDriverSqlite3::getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildre
query << "ON id = to_id "; // use to_id to ignore all children (which don't have link pointing on them)
query << "WHERE from_id != to_id "; // ignore self referring links
query << "AND weight>-9 "; //ignore invalid nodes
if(ignoreIntermediateNodes)
{
query << "AND weight!=-1 "; //ignore intermediate nodes
}
}
else if(ignoreIntermediateNodes)
{
query << "WHERE weight!=-1 "; //ignore intermediate nodes
}
if(ignoreBadSignatures)
{
if(ignoreChildren)
if(ignoreChildren || ignoreIntermediateNodes)
{
query << "AND ";
}
@@ -2435,6 +2443,7 @@ void DBDriverSqlite3::getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildre
query << " id in (select node_id from Map_Node_Word) ";
}
}
query << "ORDER BY id";
rc = sqlite3_prepare_v2(_ppDb, query.str().c_str(), -1, &ppStmt, 0);

View File

@@ -49,7 +49,8 @@ DBReader::DBReader(const std::string & databasePath,
bool goalsIgnored,
int startId,
int cameraIndex,
int stopId) :
int stopId,
bool intermediateNodesIgnored) :
Camera(frameRate),
_paths(uSplit(databasePath, ';')),
_odometryIgnored(odometryIgnored),
@@ -58,6 +59,7 @@ DBReader::DBReader(const std::string & databasePath,
_startId(startId),
_stopId(stopId),
_cameraIndex(cameraIndex),
_intermediateNodesIgnored(intermediateNodesIgnored),
_dbDriver(0),
_currentId(_ids.end()),
_previousMapId(-1),
@@ -78,7 +80,8 @@ DBReader::DBReader(const std::list<std::string> & databasePaths,
bool goalsIgnored,
int startId,
int cameraIndex,
int stopId) :
int stopId,
bool intermediateNodesIgnored) :
Camera(frameRate),
_paths(databasePaths),
_odometryIgnored(odometryIgnored),
@@ -87,6 +90,7 @@ DBReader::DBReader(const std::list<std::string> & databasePaths,
_startId(startId),
_stopId(stopId),
_cameraIndex(cameraIndex),
_intermediateNodesIgnored(intermediateNodesIgnored),
_dbDriver(0),
_currentId(_ids.end()),
_previousMapId(-1),
@@ -341,7 +345,7 @@ SensorData DBReader::getNextData(CameraInfo * info)
SensorData data;
if(_dbDriver)
{
if(_currentId != _ids.end())
while(_currentId != _ids.end())
{
std::list<int> signIds;
signIds.push_back(*_currentId);
@@ -353,6 +357,14 @@ SensorData DBReader::getNextData(CameraInfo * info)
}
_dbDriver->loadNodeData(signatures);
Signature * s = signatures.front();
if(_intermediateNodesIgnored && s->getWeight() == -1)
{
++_currentId;
delete s;
continue;
}
data = s->sensorData();
// info
@@ -558,6 +570,7 @@ SensorData DBReader::getNextData(CameraInfo * info)
}
}
delete s;
break;
}
}
else