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 loadLinks(int signatureId, std::multimap<int, Link> & links, Link::Type type = Link::kUndef) const;
void getWeight(int signatureId, int & weight) const; void getWeight(int signatureId, int & weight) const;
void getLastNodeIds(std::set<int> & ids) 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 getAllLinks(std::multimap<int, Link> & links, bool ignoreNullLinks = true, bool withLandmarks = false) const;
void getLastNodeId(int & id) const; void getLastNodeId(int & id) const;
void getLastMapId(int & mapId) const; void getLastMapId(int & mapId) const;
@@ -276,7 +276,7 @@ protected:
virtual bool getLaserScanInfoQuery(int signatureId, LaserScan & info) const = 0; 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 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 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 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 getLastIdQuery(const std::string & tableName, int & id, const std::string & fieldName="id") const = 0;
virtual void getInvertedIndexNiQuery(int signatureId, int & ni) 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 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 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 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 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 getLastIdQuery(const std::string & tableName, int & id, const std::string & fieldName="id") const;
virtual void getInvertedIndexNiQuery(int signatureId, int & ni) const; virtual void getInvertedIndexNiQuery(int signatureId, int & ni) const;

View File

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

View File

@@ -873,7 +873,7 @@ void DBDriver::getLastNodeIds(std::set<int> & ids) const
_dbSafeAccessMutex.unlock(); _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 // look in the trash
_trashesMutex.lock(); _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); ids.insert(sIter->first);
} }
@@ -908,7 +908,7 @@ void DBDriver::getAllNodeIds(std::set<int> & ids, bool ignoreChildren, bool igno
_trashesMutex.unlock(); _trashesMutex.unlock();
_dbSafeAccessMutex.lock(); _dbSafeAccessMutex.lock();
this->getAllNodeIdsQuery(ids, ignoreChildren, ignoreBadSignatures); this->getAllNodeIdsQuery(ids, ignoreChildren, ignoreBadSignatures, ignoreIntermediateNodes);
_dbSafeAccessMutex.unlock(); _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) 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 << "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 << "WHERE from_id != to_id "; // ignore self referring links
query << "AND weight>-9 "; //ignore invalid nodes 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(ignoreBadSignatures)
{ {
if(ignoreChildren) if(ignoreChildren || ignoreIntermediateNodes)
{ {
query << "AND "; 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 << " id in (select node_id from Map_Node_Word) ";
} }
} }
query << "ORDER BY id"; query << "ORDER BY id";
rc = sqlite3_prepare_v2(_ppDb, query.str().c_str(), -1, &ppStmt, 0); 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, bool goalsIgnored,
int startId, int startId,
int cameraIndex, int cameraIndex,
int stopId) : int stopId,
bool intermediateNodesIgnored) :
Camera(frameRate), Camera(frameRate),
_paths(uSplit(databasePath, ';')), _paths(uSplit(databasePath, ';')),
_odometryIgnored(odometryIgnored), _odometryIgnored(odometryIgnored),
@@ -58,6 +59,7 @@ DBReader::DBReader(const std::string & databasePath,
_startId(startId), _startId(startId),
_stopId(stopId), _stopId(stopId),
_cameraIndex(cameraIndex), _cameraIndex(cameraIndex),
_intermediateNodesIgnored(intermediateNodesIgnored),
_dbDriver(0), _dbDriver(0),
_currentId(_ids.end()), _currentId(_ids.end()),
_previousMapId(-1), _previousMapId(-1),
@@ -78,7 +80,8 @@ DBReader::DBReader(const std::list<std::string> & databasePaths,
bool goalsIgnored, bool goalsIgnored,
int startId, int startId,
int cameraIndex, int cameraIndex,
int stopId) : int stopId,
bool intermediateNodesIgnored) :
Camera(frameRate), Camera(frameRate),
_paths(databasePaths), _paths(databasePaths),
_odometryIgnored(odometryIgnored), _odometryIgnored(odometryIgnored),
@@ -87,6 +90,7 @@ DBReader::DBReader(const std::list<std::string> & databasePaths,
_startId(startId), _startId(startId),
_stopId(stopId), _stopId(stopId),
_cameraIndex(cameraIndex), _cameraIndex(cameraIndex),
_intermediateNodesIgnored(intermediateNodesIgnored),
_dbDriver(0), _dbDriver(0),
_currentId(_ids.end()), _currentId(_ids.end()),
_previousMapId(-1), _previousMapId(-1),
@@ -341,7 +345,7 @@ SensorData DBReader::getNextData(CameraInfo * info)
SensorData data; SensorData data;
if(_dbDriver) if(_dbDriver)
{ {
if(_currentId != _ids.end()) while(_currentId != _ids.end())
{ {
std::list<int> signIds; std::list<int> signIds;
signIds.push_back(*_currentId); signIds.push_back(*_currentId);
@@ -353,6 +357,14 @@ SensorData DBReader::getNextData(CameraInfo * info)
} }
_dbDriver->loadNodeData(signatures); _dbDriver->loadNodeData(signatures);
Signature * s = signatures.front(); Signature * s = signatures.front();
if(_intermediateNodesIgnored && s->getWeight() == -1)
{
++_currentId;
delete s;
continue;
}
data = s->sensorData(); data = s->sensorData();
// info // info
@@ -558,6 +570,7 @@ SensorData DBReader::getNextData(CameraInfo * info)
} }
} }
delete s; delete s;
break;
} }
} }
else else

View File

@@ -136,7 +136,7 @@ CloudViewer::CloudViewer(QWidget *parent, CloudViewerInteractorStyle * style) :
_frontfaceCulling(false), _frontfaceCulling(false),
_renderingRate(5.0), _renderingRate(5.0),
_octomapActor(0), _octomapActor(0),
_intensityAbsMax(0.0f), _intensityAbsMax(100.0f),
_coordinateFrameScale(1.0) _coordinateFrameScale(1.0)
{ {
UDEBUG(""); UDEBUG("");

View File

@@ -3736,6 +3736,10 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
_ui->spinBox_filteringMinNeighbors->value() > 0) _ui->spinBox_filteringMinNeighbors->value() > 0)
{ {
indices = util3d::radiusFiltering(cloud, indices, _ui->doubleSpinBox_filteringRadius->value(), _ui->spinBox_filteringMinNeighbors->value()); indices = util3d::radiusFiltering(cloud, indices, _ui->doubleSpinBox_filteringRadius->value(), _ui->spinBox_filteringMinNeighbors->value());
if(indices->empty())
{
UWARN("Point cloud %d doesn't have anymore points (had %d points) after radius filtering.", iter->first, (int)cloud->size());
}
} }
} }

View File

@@ -6271,7 +6271,8 @@ Camera * PreferencesDialog::createCamera(
_ui->source_checkBox_ignoreGoals->isChecked(), _ui->source_checkBox_ignoreGoals->isChecked(),
_ui->source_spinBox_databaseStartId->value(), _ui->source_spinBox_databaseStartId->value(),
_ui->source_spinBox_database_cameraIndex->value(), _ui->source_spinBox_database_cameraIndex->value(),
_ui->source_spinBox_databaseStopId->value()); _ui->source_spinBox_databaseStopId->value(),
!_ui->general_checkBox_createIntermediateNodes->isChecked());
} }
else else
{ {

View File

@@ -78,6 +78,7 @@ void showUsage()
" session for 1=min,2=max,4=mean,8=stddev,16=total,32=nonnull%%\n" " session for 1=min,2=max,4=mean,8=stddev,16=total,32=nonnull%%\n"
" --loc_delay # Delay to split sessions for localization statistics (default 60 seconds)\n" " --loc_delay # Delay to split sessions for localization statistics (default 60 seconds)\n"
" (it is a mask, we can combine those numbers, e.g., 63 for all) \n" " (it is a mask, we can combine those numbers, e.g., 63 for all) \n"
" --ignore_inter_nodes Ignore intermediate poses and statistics.\n"
" --help Show usage\n\n"); " --help Show usage\n\n");
exit(1); exit(1);
} }
@@ -135,6 +136,7 @@ int main(int argc, char * argv[])
bool outputLoopAccuracy = false; bool outputLoopAccuracy = false;
bool showAvailableStats = false; bool showAvailableStats = false;
bool invertFigures = false; bool invertFigures = false;
bool ignoreInterNodes = false;
bool useIds = false; bool useIds = false;
int startId = 0; int startId = 0;
bool exportFigures = false; bool exportFigures = false;
@@ -191,6 +193,10 @@ int main(int argc, char * argv[])
{ {
useIds = true; useIds = true;
} }
else if(strcmp(argv[i],"--ignore_inter_nodes") == 0)
{
ignoreInterNodes = true;
}
else if(strcmp(argv[i],"--export") == 0) else if(strcmp(argv[i],"--export") == 0)
{ {
exportFigures = true; exportFigures = true;
@@ -372,7 +378,7 @@ int main(int argc, char * argv[])
params = driver->getLastParameters(); params = driver->getLastParameters();
ULogger::setLevel(ULogger::kWarning); ULogger::setLevel(ULogger::kWarning);
std::set<int> ids; std::set<int> ids;
driver->getAllNodeIds(ids); driver->getAllNodeIds(ids, false, false, ignoreInterNodes);
std::map<int, std::pair<std::map<std::string, float>, double> > stats = driver->getAllStatistics(); std::map<int, std::pair<std::map<std::string, float>, double> > stats = driver->getAllStatistics();
std::map<int, Transform> odomPoses, gtPoses; std::map<int, Transform> odomPoses, gtPoses;
std::map<int, double> odomStamps; std::map<int, double> odomStamps;

View File

@@ -505,10 +505,12 @@ int main(int argc, char * argv[])
bool incrementalMemory = Parameters::defaultMemIncrementalMemory(); bool incrementalMemory = Parameters::defaultMemIncrementalMemory();
Parameters::parse(parameters, Parameters::kMemIncrementalMemory(), incrementalMemory); Parameters::parse(parameters, Parameters::kMemIncrementalMemory(), incrementalMemory);
Parameters::parse(parameters, Parameters::kDbTargetVersion(), targetVersion); Parameters::parse(parameters, Parameters::kDbTargetVersion(), targetVersion);
bool intermediateNodes = Parameters::defaultRtabmapCreateIntermediateNodes();
Parameters::parse(parameters, Parameters::kRtabmapCreateIntermediateNodes(), intermediateNodes);
int totalIds = 0; int totalIds = 0;
std::set<int> ids; std::set<int> ids;
dbDriver->getAllNodeIds(ids); dbDriver->getAllNodeIds(ids, false, false, !intermediateNodes);
if(ids.empty()) if(ids.empty())
{ {
printf("Input database doesn't have any nodes saved in it.\n"); printf("Input database doesn't have any nodes saved in it.\n");
@@ -532,7 +534,7 @@ int main(int argc, char * argv[])
return -1; return -1;
} }
ids.clear(); ids.clear();
dbDriver->getAllNodeIds(ids); dbDriver->getAllNodeIds(ids, false, false, !intermediateNodes);
totalIds += ids.size(); totalIds += ids.size();
dbDriver->closeConnection(false); dbDriver->closeConnection(false);
} }
@@ -567,7 +569,7 @@ int main(int argc, char * argv[])
bool rgbdEnabled = Parameters::defaultRGBDEnabled(); bool rgbdEnabled = Parameters::defaultRGBDEnabled();
Parameters::parse(parameters, Parameters::kRGBDEnabled(), rgbdEnabled); Parameters::parse(parameters, Parameters::kRGBDEnabled(), rgbdEnabled);
bool odometryIgnored = !rgbdEnabled; bool odometryIgnored = !rgbdEnabled;
DBReader * dbReader = new DBReader(inputDatabasePath, useDatabaseRate?-1:0, odometryIgnored, false, false, startId, -1, stopId); DBReader * dbReader = new DBReader(inputDatabasePath, useDatabaseRate?-1:0, odometryIgnored, false, false, startId, -1, stopId, !intermediateNodes);
dbReader->init(); dbReader->init();
OccupancyGrid grid(parameters); OccupancyGrid grid(parameters);