mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
Fixed GUI crash when using rectified RGB only (with odometry). Fixed empty local map when loading a fixed local map for OdometryF2M.
This commit is contained in:
@@ -98,10 +98,11 @@ OdometryF2M::OdometryF2M(const ParametersMap & parameters) :
|
|||||||
{
|
{
|
||||||
UERROR("Error initializing the memory for BOW Odometry.");
|
UERROR("Error initializing the memory for BOW Odometry.");
|
||||||
}
|
}
|
||||||
else
|
else if(memory.getLastWorkingSignature())
|
||||||
{
|
{
|
||||||
// get the graph
|
// get the graph
|
||||||
std::map<int, int> ids = memory.getNeighborsId(memory.getLastSignatureId(), 0, -1);
|
std::map<int, int> ids = memory.getNeighborsId(memory.getLastWorkingSignature()->id(), 0, -1);
|
||||||
|
UDEBUG("ids=%d", (int)ids.size());
|
||||||
std::map<int, Transform> poses;
|
std::map<int, Transform> poses;
|
||||||
std::multimap<int, Link> links;
|
std::multimap<int, Link> links;
|
||||||
memory.getMetricConstraints(uKeysSet(ids), poses, links, true);
|
memory.getMetricConstraints(uKeysSet(ids), poses, links, true);
|
||||||
@@ -113,6 +114,8 @@ OdometryF2M::OdometryF2M(const ParametersMap & parameters) :
|
|||||||
std::map<int, Transform> optimizedPoses = optimizer->optimize(poses.begin()->first, poses, links);
|
std::map<int, Transform> optimizedPoses = optimizer->optimize(poses.begin()->first, poses, links);
|
||||||
delete optimizer;
|
delete optimizer;
|
||||||
|
|
||||||
|
UDEBUG("optimizedPoses=%d", (int)optimizedPoses.size());
|
||||||
|
|
||||||
std::multimap<int, cv::Point3f> words3D;
|
std::multimap<int, cv::Point3f> words3D;
|
||||||
std::multimap<int, cv::Mat> wordsDescriptors;
|
std::multimap<int, cv::Mat> wordsDescriptors;
|
||||||
|
|
||||||
@@ -124,6 +127,7 @@ OdometryF2M::OdometryF2M(const ParametersMap & parameters) :
|
|||||||
const Signature * s = memory.getSignature(posesIter->first);
|
const Signature * s = memory.getSignature(posesIter->first);
|
||||||
if(s)
|
if(s)
|
||||||
{
|
{
|
||||||
|
UDEBUG("%d has %d words", posesIter->first, (int)s->getWords3().size());
|
||||||
// Transform 3D points accordingly to pose and add them to local map
|
// Transform 3D points accordingly to pose and add them to local map
|
||||||
for(std::multimap<int, cv::Point3f>::const_iterator pointsIter=s->getWords3().begin();
|
for(std::multimap<int, cv::Point3f>::const_iterator pointsIter=s->getWords3().begin();
|
||||||
pointsIter!=s->getWords3().end();
|
pointsIter!=s->getWords3().end();
|
||||||
@@ -148,6 +152,7 @@ OdometryF2M::OdometryF2M(const ParametersMap & parameters) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
UASSERT(words3D.size() == wordsDescriptors.size());
|
UASSERT(words3D.size() == wordsDescriptors.size());
|
||||||
|
UDEBUG("words3D=%d", (int)words3D.size());
|
||||||
map_->setWords3(words3D);
|
map_->setWords3(words3D);
|
||||||
map_->setWordsDescriptors(wordsDescriptors);
|
map_->setWordsDescriptors(wordsDescriptors);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -776,7 +776,11 @@ void Parameters::writeINI(const std::string & configFile, const ParametersMap &
|
|||||||
{
|
{
|
||||||
std::string key = (*i).first;
|
std::string key = (*i).first;
|
||||||
key = uReplaceChar(key, '/', '\\'); // Ini files use \ by default for separators, so replace the /
|
key = uReplaceChar(key, '/', '\\'); // Ini files use \ by default for separators, so replace the /
|
||||||
ini.SetValue("Core", key.c_str(), (*i).second.c_str(), NULL, true);
|
|
||||||
|
std::string value = (*i).second.c_str();
|
||||||
|
value = uReplaceChar(value, '\\', '/'); // use always slash for values
|
||||||
|
|
||||||
|
ini.SetValue("Core", key.c_str(), value.c_str(), NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.SaveFile(configFile.c_str());
|
ini.SaveFile(configFile.c_str());
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ Transform RegistrationVis::computeTransformationImpl(
|
|||||||
// create 3D keypoints
|
// create 3D keypoints
|
||||||
std::vector<cv::Point3f> kptsFrom3D;
|
std::vector<cv::Point3f> kptsFrom3D;
|
||||||
std::vector<cv::Point3f> kptsTo3D;
|
std::vector<cv::Point3f> kptsTo3D;
|
||||||
if(fromSignature.getWords3().empty() || kptsFrom.size() != fromSignature.getWords3().size())
|
if(fromSignature.getWords3().empty() || (kptsFrom.size() && kptsFrom.size() != fromSignature.getWords3().size()))
|
||||||
{
|
{
|
||||||
if(fromSignature.getWords3().size() && kptsFrom.size() != fromSignature.getWords3().size())
|
if(fromSignature.getWords3().size() && kptsFrom.size() != fromSignature.getWords3().size())
|
||||||
{
|
{
|
||||||
@@ -890,9 +890,9 @@ Transform RegistrationVis::computeTransformationImpl(
|
|||||||
// match between all descriptors
|
// match between all descriptors
|
||||||
VWDictionary dictionary(_featureParameters);
|
VWDictionary dictionary(_featureParameters);
|
||||||
std::list<int> fromWordIds;
|
std::list<int> fromWordIds;
|
||||||
for(unsigned int i=0; i<kptsFrom.size(); ++i)
|
for (unsigned int i = 0; i < descriptorsFrom.rows; ++i)
|
||||||
{
|
{
|
||||||
int id = orignalWordsFromIds.size()?orignalWordsFromIds[i]:i;
|
int id = orignalWordsFromIds.size() ? orignalWordsFromIds[i] : i;
|
||||||
dictionary.addWord(new VisualWord(id, descriptorsFrom.row(i), 1));
|
dictionary.addWord(new VisualWord(id, descriptorsFrom.row(i), 1));
|
||||||
fromWordIds.push_back(id);
|
fromWordIds.push_back(id);
|
||||||
}
|
}
|
||||||
@@ -915,7 +915,10 @@ Transform RegistrationVis::computeTransformationImpl(
|
|||||||
{
|
{
|
||||||
if(fromWordIdsSet.count(*iter) == 1)
|
if(fromWordIdsSet.count(*iter) == 1)
|
||||||
{
|
{
|
||||||
wordsFrom.insert(std::make_pair(*iter, kptsFrom[i]));
|
if (kptsFrom.size())
|
||||||
|
{
|
||||||
|
wordsFrom.insert(std::make_pair(*iter, kptsFrom[i]));
|
||||||
|
}
|
||||||
if(kptsFrom3D.size())
|
if(kptsFrom3D.size())
|
||||||
{
|
{
|
||||||
words3From.insert(std::make_pair(*iter, kptsFrom3D[i]));
|
words3From.insert(std::make_pair(*iter, kptsFrom3D[i]));
|
||||||
|
|||||||
@@ -775,6 +775,8 @@ void ImageView::setImageDepth(const QImage & imageDepth)
|
|||||||
{
|
{
|
||||||
_imageDepth = QPixmap::fromImage(imageDepth);
|
_imageDepth = QPixmap::fromImage(imageDepth);
|
||||||
|
|
||||||
|
UASSERT(_imageDepth.width() && _imageDepth.height());
|
||||||
|
|
||||||
if( _image.width() > 0 &&
|
if( _image.width() > 0 &&
|
||||||
_image.width() > _imageDepth.width() &&
|
_image.width() > _imageDepth.width() &&
|
||||||
_image.height() > _imageDepth.height() &&
|
_image.height() > _imageDepth.height() &&
|
||||||
|
|||||||
@@ -1245,7 +1245,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ui->imageView_odometry->setImage(uCvMat2QImage(odom.data().imageRaw()));
|
_ui->imageView_odometry->setImage(uCvMat2QImage(odom.data().imageRaw()));
|
||||||
if(_ui->imageView_odometry->isImageDepthShown())
|
if(_ui->imageView_odometry->isImageDepthShown() && !odom.data().depthOrRightRaw().empty())
|
||||||
{
|
{
|
||||||
_ui->imageView_odometry->setImageDepth(uCvMat2QImage(odom.data().depthOrRightRaw()));
|
_ui->imageView_odometry->setImageDepth(uCvMat2QImage(odom.data().depthOrRightRaw()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2189,65 +2189,8 @@ void PreferencesDialog::writeCoreSettings(const QString & filePath) const
|
|||||||
{
|
{
|
||||||
path = filePath;
|
path = filePath;
|
||||||
}
|
}
|
||||||
QSettings settings(path, QSettings::IniFormat);
|
|
||||||
settings.beginGroup("Core");
|
|
||||||
settings.remove("");
|
|
||||||
|
|
||||||
// save current RTAB-Map version
|
Parameters::writeINI(path.toStdString(), this->getAllParameters());
|
||||||
settings.setValue("Version", QString(RTABMAP_VERSION));
|
|
||||||
|
|
||||||
const rtabmap::ParametersMap & parameters = Parameters::getDefaultParameters();
|
|
||||||
for(rtabmap::ParametersMap::const_iterator iter=parameters.begin(); iter!=parameters.end(); ++iter)
|
|
||||||
{
|
|
||||||
QObject * obj = _ui->stackedWidget->findChild<QObject*>((*iter).first.c_str());
|
|
||||||
if(obj)
|
|
||||||
{
|
|
||||||
QSpinBox * spin = qobject_cast<QSpinBox *>(obj);
|
|
||||||
QDoubleSpinBox * doubleSpin = qobject_cast<QDoubleSpinBox *>(obj);
|
|
||||||
QComboBox * combo = qobject_cast<QComboBox *>(obj);
|
|
||||||
QCheckBox * check = qobject_cast<QCheckBox *>(obj);
|
|
||||||
QRadioButton * radio = qobject_cast<QRadioButton *>(obj);
|
|
||||||
QLineEdit * lineEdit = qobject_cast<QLineEdit *>(obj);
|
|
||||||
QGroupBox * groupBox = qobject_cast<QGroupBox *>(obj);
|
|
||||||
if(spin)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), spin->value());
|
|
||||||
}
|
|
||||||
else if(doubleSpin)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), doubleSpin->value());
|
|
||||||
}
|
|
||||||
else if(combo)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), combo->currentIndex());
|
|
||||||
}
|
|
||||||
else if(check)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), uBool2Str(check->isChecked()).c_str());
|
|
||||||
}
|
|
||||||
else if(radio)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), uBool2Str(radio->isChecked()).c_str());
|
|
||||||
}
|
|
||||||
else if(lineEdit)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), lineEdit->text());
|
|
||||||
}
|
|
||||||
else if(groupBox)
|
|
||||||
{
|
|
||||||
settings.setValue(obj->objectName(), uBool2Str(groupBox->isChecked()).c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ULOGGER_WARN("QObject called %s can't be cast to a supported widget", (*iter).first.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ULOGGER_WARN("Can't find the related QObject for parameter %s", (*iter).first.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
settings.endGroup(); // Core
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PreferencesDialog::validateForm()
|
bool PreferencesDialog::validateForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user