mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
Added parameter Rtabmap/LoopGPS (default true) to enabled/disable the use of GPS in likelihood computation
This commit is contained in:
@@ -193,6 +193,7 @@ class RTABMAP_EXP Parameters
|
|||||||
// Hypotheses selection
|
// Hypotheses selection
|
||||||
RTABMAP_PARAM(Rtabmap, LoopThr, float, 0.11, "Loop closing threshold.");
|
RTABMAP_PARAM(Rtabmap, LoopThr, float, 0.11, "Loop closing threshold.");
|
||||||
RTABMAP_PARAM(Rtabmap, LoopRatio, float, 0, "The loop closure hypothesis must be over LoopRatio x lastHypothesisValue.");
|
RTABMAP_PARAM(Rtabmap, LoopRatio, float, 0, "The loop closure hypothesis must be over LoopRatio x lastHypothesisValue.");
|
||||||
|
RTABMAP_PARAM(Rtabmap, LoopGPS, bool, true, uFormat("Use GPS to filter likelihood (if GPS is recorded). Only locations inside the local radius \"%s\" of the current GPS location are considered for loop closure detection.", kRGBDLocalRadius().c_str()));
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
RTABMAP_PARAM(Mem, RehearsalSimilarity, float, 0.6, "Rehearsal similarity.");
|
RTABMAP_PARAM(Mem, RehearsalSimilarity, float, 0.6, "Rehearsal similarity.");
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ private:
|
|||||||
float _pathAngularVelocity;
|
float _pathAngularVelocity;
|
||||||
bool _savedLocalizationIgnored;
|
bool _savedLocalizationIgnored;
|
||||||
bool _loopCovLimited;
|
bool _loopCovLimited;
|
||||||
|
bool _loopGPS;
|
||||||
|
|
||||||
std::pair<int, float> _loopClosureHypothesis;
|
std::pair<int, float> _loopClosureHypothesis;
|
||||||
std::pair<int, float> _highestHypothesis;
|
std::pair<int, float> _highestHypothesis;
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ Rtabmap::Rtabmap() :
|
|||||||
_pathAngularVelocity(Parameters::defaultRGBDPlanAngularVelocity()),
|
_pathAngularVelocity(Parameters::defaultRGBDPlanAngularVelocity()),
|
||||||
_savedLocalizationIgnored(Parameters::defaultRGBDSavedLocalizationIgnored()),
|
_savedLocalizationIgnored(Parameters::defaultRGBDSavedLocalizationIgnored()),
|
||||||
_loopCovLimited(Parameters::defaultRGBDLoopCovLimited()),
|
_loopCovLimited(Parameters::defaultRGBDLoopCovLimited()),
|
||||||
|
_loopGPS(Parameters::defaultRtabmapLoopGPS()),
|
||||||
_loopClosureHypothesis(0,0.0f),
|
_loopClosureHypothesis(0,0.0f),
|
||||||
_highestHypothesis(0,0.0f),
|
_highestHypothesis(0,0.0f),
|
||||||
_lastProcessTime(0.0),
|
_lastProcessTime(0.0),
|
||||||
@@ -469,6 +470,7 @@ void Rtabmap::parseParameters(const ParametersMap & parameters)
|
|||||||
Parameters::parse(parameters, Parameters::kRGBDPlanAngularVelocity(), _pathAngularVelocity);
|
Parameters::parse(parameters, Parameters::kRGBDPlanAngularVelocity(), _pathAngularVelocity);
|
||||||
Parameters::parse(parameters, Parameters::kRGBDSavedLocalizationIgnored(), _savedLocalizationIgnored);
|
Parameters::parse(parameters, Parameters::kRGBDSavedLocalizationIgnored(), _savedLocalizationIgnored);
|
||||||
Parameters::parse(parameters, Parameters::kRGBDLoopCovLimited(), _loopCovLimited);
|
Parameters::parse(parameters, Parameters::kRGBDLoopCovLimited(), _loopCovLimited);
|
||||||
|
Parameters::parse(parameters, Parameters::kRtabmapLoopGPS(), _loopGPS);
|
||||||
|
|
||||||
UASSERT(_rgbdLinearUpdate >= 0.0f);
|
UASSERT(_rgbdLinearUpdate >= 0.0f);
|
||||||
UASSERT(_rgbdAngularUpdate >= 0.0f);
|
UASSERT(_rgbdAngularUpdate >= 0.0f);
|
||||||
@@ -1399,37 +1401,41 @@ bool Rtabmap::process(
|
|||||||
ULOGGER_INFO("computing likelihood...");
|
ULOGGER_INFO("computing likelihood...");
|
||||||
|
|
||||||
std::list<int> signaturesToCompare;
|
std::list<int> signaturesToCompare;
|
||||||
GPS originGPS = signature->sensorData().gps();
|
GPS originGPS;
|
||||||
Transform originOffsetENU = Transform::getIdentity();
|
Transform originOffsetENU = Transform::getIdentity();
|
||||||
if(originGPS.stamp() == 0.0 && _currentSessionHasGPS)
|
if(_loopGPS)
|
||||||
{
|
{
|
||||||
UTimer tmpT;
|
originGPS = signature->sensorData().gps();
|
||||||
if(_optimizedPoses.size() && _memory->isIncremental())
|
if(originGPS.stamp() == 0.0 && _currentSessionHasGPS)
|
||||||
{
|
{
|
||||||
//Search for latest node having GPS linked to current signature not too far.
|
UTimer tmpT;
|
||||||
std::map<int, float> nearestIds = graph::getNodesInRadius(signature->id(), _optimizedPoses, _localRadius);
|
if(_optimizedPoses.size() && _memory->isIncremental())
|
||||||
for(std::map<int, float>::reverse_iterator iter=nearestIds.rbegin(); iter!=nearestIds.rend(); ++iter)
|
|
||||||
{
|
{
|
||||||
const Signature * s = _memory->getSignature(iter->first);
|
//Search for latest node having GPS linked to current signature not too far.
|
||||||
UASSERT(s!=0);
|
std::map<int, float> nearestIds = graph::getNodesInRadius(signature->id(), _optimizedPoses, _localRadius);
|
||||||
if(s->sensorData().gps().stamp() > 0.0)
|
for(std::map<int, float>::reverse_iterator iter=nearestIds.rbegin(); iter!=nearestIds.rend(); ++iter)
|
||||||
{
|
{
|
||||||
originGPS = s->sensorData().gps();
|
const Signature * s = _memory->getSignature(iter->first);
|
||||||
const Transform & sPose = _optimizedPoses.at(s->id());
|
UASSERT(s!=0);
|
||||||
Transform localToENU(0,0,(float)((-(originGPS.bearing()-90))*M_PI/180.0) - sPose.theta());
|
if(s->sensorData().gps().stamp() > 0.0)
|
||||||
originOffsetENU = localToENU * (sPose.rotation()*(sPose.inverse()*_optimizedPoses.at(signature->id())));
|
{
|
||||||
break;
|
originGPS = s->sensorData().gps();
|
||||||
|
const Transform & sPose = _optimizedPoses.at(s->id());
|
||||||
|
Transform localToENU(0,0,(float)((-(originGPS.bearing()-90))*M_PI/180.0) - sPose.theta());
|
||||||
|
originOffsetENU = localToENU * (sPose.rotation()*(sPose.inverse()*_optimizedPoses.at(signature->id())));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//else if(!_memory->isIncremental()) // TODO, how can we estimate current GPS position in localization?
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
if(originGPS.stamp() > 0.0)
|
||||||
|
{
|
||||||
|
// no need to save it if it is in localization mode
|
||||||
|
_gpsGeocentricCache.insert(std::make_pair(signature->id(), std::make_pair(originGPS.toGeodeticCoords().toGeocentric_WGS84(), originOffsetENU)));
|
||||||
}
|
}
|
||||||
//else if(!_memory->isIncremental()) // TODO, how can we estimate current GPS position in localization?
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
if(originGPS.stamp() > 0.0)
|
|
||||||
{
|
|
||||||
// no need to save it if it is in localization mode
|
|
||||||
_gpsGeocentricCache.insert(std::make_pair(signature->id(), std::make_pair(originGPS.toGeodeticCoords().toGeocentric_WGS84(), originOffsetENU)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::map<int, double>::const_iterator iter=_memory->getWorkingMem().begin();
|
for(std::map<int, double>::const_iterator iter=_memory->getWorkingMem().begin();
|
||||||
|
|||||||
@@ -709,6 +709,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
|||||||
_ui->general_checkBox_startNewMapOnGoodSignature->setObjectName(Parameters::kRtabmapStartNewMapOnGoodSignature().c_str());
|
_ui->general_checkBox_startNewMapOnGoodSignature->setObjectName(Parameters::kRtabmapStartNewMapOnGoodSignature().c_str());
|
||||||
_ui->general_checkBox_imagesAlreadyRectified->setObjectName(Parameters::kRtabmapImagesAlreadyRectified().c_str());
|
_ui->general_checkBox_imagesAlreadyRectified->setObjectName(Parameters::kRtabmapImagesAlreadyRectified().c_str());
|
||||||
_ui->general_checkBox_rectifyOnlyFeatures->setObjectName(Parameters::kRtabmapRectifyOnlyFeatures().c_str());
|
_ui->general_checkBox_rectifyOnlyFeatures->setObjectName(Parameters::kRtabmapRectifyOnlyFeatures().c_str());
|
||||||
|
_ui->checkBox_rtabmap_loopGPS->setObjectName(Parameters::kRtabmapLoopGPS().c_str());
|
||||||
_ui->lineEdit_workingDirectory->setObjectName(Parameters::kRtabmapWorkingDirectory().c_str());
|
_ui->lineEdit_workingDirectory->setObjectName(Parameters::kRtabmapWorkingDirectory().c_str());
|
||||||
connect(_ui->toolButton_workingDirectory, SIGNAL(clicked()), this, SLOT(changeWorkingDirectory()));
|
connect(_ui->toolButton_workingDirectory, SIGNAL(clicked()), this, SLOT(changeWorkingDirectory()));
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-57</y>
|
||||||
<width>681</width>
|
<width>681</width>
|
||||||
<height>2983</height>
|
<height>2983</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>24</number>
|
<number>11</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_22">
|
<widget class="QWidget" name="page_22">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
||||||
@@ -8704,6 +8704,26 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="label_502">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use GPS to filter likelihood (if GPS is recorded). Only locations inside the Local Radius (see RGBD-SLAM panel) of the current GPS location are considered for loop closure detection.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkBox_rtabmap_loopGPS">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user