41 keyFrameThr_(
Parameters::defaultOdomKeyFrameThr()),
42 visKeyFrameThr_(
Parameters::defaultOdomVisKeyFrameThr()),
43 scanKeyFrameThr_(
Parameters::defaultOdomScanKeyFrameThr())
78 UERROR(
"Calibrated stereo camera required");
84 UERROR(
"Calibrated camera required (multi-cameras not supported).");
88 bool addKeyFrame =
false;
101 float maxCorrespondenceDistance = 0.0f;
102 float pmOutlierRatio = 0.0f;
109 maxCorrespondenceDistance = Parameters::defaultIcpMaxCorrespondenceDistance();
110 pmOutlierRatio = Parameters::defaultIcpPMOutlierRatio();
127 if(maxCorrespondenceDistance>0.0
f)
140 newFrame.
setWords(std::multimap<int, cv::KeyPoint>());
141 newFrame.
setWords3(std::multimap<int, cv::Point3f>());
143 UWARN(
"Failed to find a transformation with the provided guess (%s), trying again without a guess.", guess.
prettyPrint().c_str());
145 int visCorTypeBackup = Parameters::defaultVisCorType();
147 if(visCorTypeBackup == 1)
160 if(visCorTypeBackup == 1)
169 UWARN(
"Trial with no guess still fail.");
173 UWARN(
"Trial with no guess succeeded.");
179 std::list<std::pair<int, std::pair<cv::KeyPoint, cv::KeyPoint> > > pairs;
183 std::map<int, int> idToIndex;
185 for(std::list<std::pair<
int, std::pair<cv::KeyPoint, cv::KeyPoint> > >::iterator iter=pairs.begin();
191 idToIndex.insert(std::make_pair(iter->first, i));
202 for(std::multimap<int, cv::Point3f>::const_iterator iter=tmpRefFrame.
getWords3().begin(); iter!=tmpRefFrame.
getWords3().end(); ++iter)
219 regInfo.
covariance = cv::Mat::eye(6,6,CV_64FC1)*9999.0;
224 output = motionSinceLastKeyFrame.
inverse() * output;
234 UDEBUG(
"Update key frame");
271 if(features < registrationPipeline_->getMinVisualCorrespondences())
273 UWARN(
"Too low 2D features (%d), keeping last key frame...", features);
309 UINFO(
"Odom update time = %fs lost=%s inliers=%d, ref frame corners=%d, transform accepted=%s",
311 output.
isNull()?
"true":
"false",
314 !output.
isNull()?
"true":
"false");
const std::multimap< int, cv::Point3f > & getWords3() const
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
int getMinVisualCorrespondences() const
std::vector< cv::Point2f > refCorners
unsigned int framesProcessed() const
cv::Point3f RTABMAP_EXP transformPoint(const cv::Point3f &pt, const Transform &transform)
float getMinGeometryCorrespondencesRatio() const
const std::multimap< int, cv::KeyPoint > & getWords() const
void setWords3(const std::multimap< int, cv::Point3f > &words3)
bool isInfoDataFilled() const
virtual void reset(const Transform &initialPose=Transform::getIdentity())
void setWords(const std::multimap< int, cv::KeyPoint > &words)
Transform computeTransformationMod(Signature &from, Signature &to, Transform guess=Transform::getIdentity(), RegistrationInfo *info=0) const
std::map< int, cv::Point3f > localMap
std::pair< std::string, std::string > ParametersPair
const cv::Mat & descriptors() const
std::map< std::string, std::string > ParametersMap
const std::vector< cv::KeyPoint > & keypoints() const
const std::multimap< int, cv::Mat > & getWordsDescriptors() const
const Transform & getPose() const
std::vector< int > inliersIDs
Transform lastKeyFramePose_
const LaserScan & laserScanRaw() const
static int findPairsUnique(const std::multimap< int, cv::KeyPoint > &wordsA, const std::multimap< int, cv::KeyPoint > &wordsB, std::list< std::pair< int, std::pair< cv::KeyPoint, cv::KeyPoint > > > &pairs, bool ignoreNegativeIds=true)
GLM_FUNC_DECL bool isNull(detail::tmat2x2< T, P > const &m, T const &epsilon)
#define UASSERT(condition)
Wrappers of STL for convenient functions.
bool isValidForProjection() const
OdometryF2F(const rtabmap::ParametersMap ¶meters=rtabmap::ParametersMap())
std::vector< int > cornerInliers
LaserScan RTABMAP_EXP transformLaserScan(const LaserScan &laserScan, const Transform &transform)
bool isScanRequired() const
virtual void parseParameters(const ParametersMap ¶meters)
void setWordsDescriptors(const std::multimap< int, cv::Mat > &descriptors)
Transform localTransform() const
ParametersMap parameters_
const std::vector< CameraModel > & cameraModels() const
static Registration * create(const ParametersMap ¶meters)
std::multimap< int, cv::KeyPoint > words
SensorData & sensorData()
ULogger class and convenient macros.
const StereoCameraModel & stereoCameraModel() const
bool isImageRequired() const
std::vector< cv::Point2f > newCorners
virtual Transform computeTransform(SensorData &image, const Transform &guess=Transform(), OdometryInfo *info=0)
std::string UTILITE_EXP uNumber2Str(unsigned int number)
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
const std::vector< cv::Point3f > & keypoints3D() const
Registration * registrationPipeline_
RegistrationInfo copyWithoutData() const
virtual void reset(const Transform &initialPose=Transform::getIdentity())