mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
Fixed QMutex still locked on exit warning. Removing old parameters from ini file on saving. Memory: Removed completely the use of Vis/CorType (only used by F2F odom).
This commit is contained in:
@@ -102,7 +102,6 @@ Memory::Memory(const ParametersMap & parameters) :
|
||||
_useOdometryFeatures(Parameters::defaultMemUseOdomFeatures()),
|
||||
_createOccupancyGrid(Parameters::defaultRGBDCreateOccupancyGrid()),
|
||||
_visMaxFeatures(Parameters::defaultVisMaxFeatures()),
|
||||
_visCorType(Parameters::defaultVisCorType()),
|
||||
_imagesAlreadyRectified(Parameters::defaultRtabmapImagesAlreadyRectified()),
|
||||
_rectifyOnlyFeatures(Parameters::defaultRtabmapRectifyOnlyFeatures()),
|
||||
_covOffDiagonalIgnored(Parameters::defaultMemCovOffDiagIgnored()),
|
||||
@@ -500,20 +499,10 @@ void Memory::parseParameters(const ParametersMap & parameters)
|
||||
Parameters::parse(params, Parameters::kMemUseOdomFeatures(), _useOdometryFeatures);
|
||||
Parameters::parse(params, Parameters::kRGBDCreateOccupancyGrid(), _createOccupancyGrid);
|
||||
Parameters::parse(params, Parameters::kVisMaxFeatures(), _visMaxFeatures);
|
||||
Parameters::parse(params, Parameters::kVisCorType(), _visCorType);
|
||||
if(_visCorType != 0)
|
||||
{
|
||||
UWARN("%s is not 0 (Features Matching), the only approach supported for loop closure transformation estimation. Setting to 0...",
|
||||
Parameters::kVisCorType().c_str());
|
||||
_visCorType = 0;
|
||||
uInsert(parameters_, ParametersPair(Parameters::kVisCorType(), "0"));
|
||||
uInsert(params, ParametersPair(Parameters::kVisCorType(), "0"));
|
||||
}
|
||||
Parameters::parse(params, Parameters::kRtabmapImagesAlreadyRectified(), _imagesAlreadyRectified);
|
||||
Parameters::parse(params, Parameters::kRtabmapRectifyOnlyFeatures(), _rectifyOnlyFeatures);
|
||||
Parameters::parse(params, Parameters::kMemCovOffDiagIgnored(), _covOffDiagonalIgnored);
|
||||
|
||||
|
||||
UASSERT_MSG(_maxStMemSize >= 0, uFormat("value=%d", _maxStMemSize).c_str());
|
||||
UASSERT_MSG(_similarityThreshold >= 0.0f && _similarityThreshold <= 1.0f, uFormat("value=%f", _similarityThreshold).c_str());
|
||||
UASSERT_MSG(_recentWmRatio >= 0.0f && _recentWmRatio <= 1.0f, uFormat("value=%f", _recentWmRatio).c_str());
|
||||
@@ -573,6 +562,10 @@ void Memory::parseParameters(const ParametersMap & parameters)
|
||||
_feature2D->parseParameters(params);
|
||||
}
|
||||
|
||||
// Features Matching is the only correspondence approach supported for loop closure transformation estimation.
|
||||
uInsert(parameters_, ParametersPair(Parameters::kVisCorType(), "0"));
|
||||
uInsert(params, ParametersPair(Parameters::kVisCorType(), "0"));
|
||||
|
||||
Registration::Type regStrategy = Registration::kTypeUndef;
|
||||
if((iter=params.find(Parameters::kRegStrategy())) != params.end())
|
||||
{
|
||||
@@ -2475,13 +2468,13 @@ Transform Memory::computeTransform(
|
||||
|
||||
// make sure we have all data needed
|
||||
// load binary data from database if not in RAM (if image is already here, scan and userData should be or they are null)
|
||||
if((((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired()) && fromS.sensorData().imageCompressed().empty()) ||
|
||||
if(((_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired()) && fromS.sensorData().imageCompressed().empty()) ||
|
||||
(_registrationPipeline->isScanRequired() && fromS.sensorData().imageCompressed().empty() && fromS.sensorData().laserScanCompressed().isEmpty()) ||
|
||||
(_registrationPipeline->isUserDataRequired() && fromS.sensorData().imageCompressed().empty() && fromS.sensorData().userDataCompressed().empty()))
|
||||
{
|
||||
fromS.sensorData() = getNodeData(fromS.id());
|
||||
}
|
||||
if((((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired()) && toS.sensorData().imageCompressed().empty()) ||
|
||||
if(((_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired()) && toS.sensorData().imageCompressed().empty()) ||
|
||||
(_registrationPipeline->isScanRequired() && toS.sensorData().imageCompressed().empty() && toS.sensorData().laserScanCompressed().isEmpty()) ||
|
||||
(_registrationPipeline->isUserDataRequired() && toS.sensorData().imageCompressed().empty() && toS.sensorData().userDataCompressed().empty()))
|
||||
{
|
||||
@@ -2491,13 +2484,13 @@ Transform Memory::computeTransform(
|
||||
cv::Mat imgBuf, depthBuf, userBuf;
|
||||
LaserScan laserBuf;
|
||||
fromS.sensorData().uncompressData(
|
||||
((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired())?&imgBuf:0,
|
||||
((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired())?&depthBuf:0,
|
||||
(_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired())?&imgBuf:0,
|
||||
(_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired())?&depthBuf:0,
|
||||
_registrationPipeline->isScanRequired()?&laserBuf:0,
|
||||
_registrationPipeline->isUserDataRequired()?&userBuf:0);
|
||||
toS.sensorData().uncompressData(
|
||||
((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired())?&imgBuf:0,
|
||||
((_reextractLoopClosureFeatures || _visCorType==1) && _registrationPipeline->isImageRequired())?&depthBuf:0,
|
||||
(_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired())?&imgBuf:0,
|
||||
(_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired())?&depthBuf:0,
|
||||
_registrationPipeline->isScanRequired()?&laserBuf:0,
|
||||
_registrationPipeline->isUserDataRequired()?&userBuf:0);
|
||||
|
||||
@@ -2530,7 +2523,7 @@ Transform Memory::computeTransform(
|
||||
tmpTo.setWordsDescriptors(std::multimap<int, cv::Mat>());
|
||||
}
|
||||
|
||||
if(guess.isNull() && (!_registrationPipeline->isImageRequired() || _visCorType==1))
|
||||
if(guess.isNull() && !_registrationPipeline->isImageRequired())
|
||||
{
|
||||
UDEBUG("");
|
||||
// no visual in the pipeline, make visual registration for guess
|
||||
|
||||
@@ -1045,17 +1045,43 @@ void Parameters::writeINI(const std::string & configFile, const ParametersMap &
|
||||
// Save current version
|
||||
ini.SetValue("Core", "Version", RTABMAP_VERSION, NULL, true);
|
||||
|
||||
for(ParametersMap::const_iterator i=parameters.begin(); i!=parameters.end(); ++i)
|
||||
for(ParametersMap::const_iterator iter=parameters.begin(); iter!=parameters.end(); ++iter)
|
||||
{
|
||||
std::string key = (*i).first;
|
||||
std::string key = iter->first;
|
||||
key = uReplaceChar(key, '/', '\\'); // Ini files use \ by default for separators, so replace the /
|
||||
|
||||
std::string value = (*i).second.c_str();
|
||||
std::string value = iter->second.c_str();
|
||||
value = uReplaceChar(value, '\\', '/'); // use always slash for values
|
||||
|
||||
ini.SetValue("Core", key.c_str(), value.c_str(), NULL, true);
|
||||
}
|
||||
|
||||
// Delete removed parameters
|
||||
if(parameters.size() == getDefaultParameters().size())
|
||||
{
|
||||
for(std::map<std::string, std::pair<bool, std::string> >::const_iterator iter = removedParameters_.begin();
|
||||
iter!=removedParameters_.end();
|
||||
++iter)
|
||||
{
|
||||
std::string key = iter->first;
|
||||
key = uReplaceChar(key, '/', '\\'); // Ini files use \ by default for separators, so replace the /
|
||||
|
||||
std::string value = ini.GetValue("Core", key.c_str(), "");
|
||||
|
||||
if(ini.Delete("Core", key.c_str(), true))
|
||||
{
|
||||
if(iter->second.first && parameters.find(iter->second.second) != parameters.end())
|
||||
{
|
||||
UWARN("Removed deprecated parameter %s=%s (replaced by %s=%s) from \"%s\".", iter->first.c_str(), value.c_str(), iter->second.second.c_str(), parameters.at(iter->second.second).c_str(), configFile.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
UWARN("Removed deprecated parameter %s=%s from \"%s\".", iter->first.c_str(), value.c_str(), configFile.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ini.SaveFile(configFile.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user