45 #include <opencv2/calib3d/calib3d.hpp> 47 #include <pcl/common/io.h> 50 #define ISFINITE(value) _finite(value) 52 #define ISFINITE(value) std::isfinite(value) 59 maximumMapSize_(
Parameters::defaultOdomF2MMaxSize()),
60 keyFrameThr_(
Parameters::defaultOdomKeyFrameThr()),
61 visKeyFrameThr_(
Parameters::defaultOdomVisKeyFrameThr()),
62 maxNewFeatures_(
Parameters::defaultOdomF2MMaxNewFeatures()),
63 scanKeyFrameThr_(
Parameters::defaultOdomScanKeyFrameThr()),
64 scanMaximumMapSize_(
Parameters::defaultOdomF2MScanMaxSize()),
65 scanSubtractRadius_(
Parameters::defaultOdomF2MScanSubtractRadius()),
66 scanSubtractAngle_(
Parameters::defaultOdomF2MScanSubtractAngle()),
67 scanMapMaxRange_(
Parameters::defaultOdomF2MScanRange()),
68 bundleAdjustment_(
Parameters::defaultOdomF2MBundleAdjustment()),
69 bundleMaxFrames_(
Parameters::defaultOdomF2MBundleAdjustmentMaxFrames()),
70 validDepthRatio_(
Parameters::defaultOdomF2MValidDepthRatio()),
71 pointToPlaneK_(
Parameters::defaultIcpPointToPlaneK()),
72 pointToPlaneRadius_(
Parameters::defaultIcpPointToPlaneRadius()),
75 lastFrameOldestNewId_(0),
113 UWARN(
"Selected bundle adjustment approach (\"%s\"=\"%d\") is not available, " 114 "local bundle adjustment is then disabled.", Parameters::kOdomF2MBundleAdjustment().c_str(),
bundleAdjustment_);
124 int corType = Parameters::defaultVisCorType();
128 UWARN(
"%s=%d is not supported by OdometryF2M, using Features matching approach instead (type=0).",
129 Parameters::kVisCorType().c_str(),
135 int estType = Parameters::defaultVisEstimationType();
139 UWARN(
"%s=%d is not supported by OdometryF2M, using 2D->3D approach instead (type=1).",
140 Parameters::kVisEstimationType().c_str(),
146 bool forwardEst = Parameters::defaultVisForwardEstOnly();
150 UWARN(
"%s=false is not supported by OdometryF2M, setting to true.",
151 Parameters::kVisForwardEstOnly().c_str());
159 UWARN(
"%s=%d cannot be used with registration not done only with images (%s=%s), disabling bundle adjustment.",
160 Parameters::kOdomF2MBundleAdjustment().c_str(),
162 Parameters::kRegStrategy().c_str(),
163 uValue(bundleParameters, Parameters::kRegStrategy(),
uNumber2Str(Parameters::defaultRegStrategy())).c_str());
228 bool addKeyFrame =
false;
229 int totalBundleWordReferencesUsed = 0;
230 int totalBundleOutliers = 0;
231 float bundleTime = 0.0f;
232 bool visDepthAsMask = Parameters::defaultVisDepthAsMask();
235 std::vector<CameraModel> lastFrameModels;
255 lastFrameModels.push_back(model);
258 UDEBUG(
"lastFrameModels=%ld", lastFrameModels.size());
271 std::map<int, cv::Point3f> points3DMap;
272 std::map<int, Transform> bundlePoses;
273 std::multimap<int, Link> bundleLinks;
274 std::map<int, std::vector<CameraModel> > bundleModels;
276 for(
int guessIteration=0;
287 bundleModels.clear();
289 float maxCorrespondenceDistance = 0.0f;
290 float outlierRatio = 0.0f;
297 maxCorrespondenceDistance = Parameters::defaultIcpMaxCorrespondenceDistance();
298 outlierRatio = Parameters::defaultIcpOutlierRatio();
307 if(guessIteration == 1)
309 UWARN(
"Failed to find a transformation with the provided guess (%s), trying again without a guess.", guess.
prettyPrint().c_str());
319 if(maxCorrespondenceDistance>0.0
f)
331 UDEBUG(
"Registration time = %fs", regInfo.totalTime);
332 if(!transform.isNull())
337 !lastFrameModels.empty() &&
338 regInfo.inliersIDs.size())
340 UDEBUG(
"Local Bundle Adjustment");
348 UERROR(
"Bundle Adjustment cannot be used with a registration approach recomputing " 349 "features from the \"from\" signature (e.g., Optical Flow) that would change " 350 "their ids (size=old=%ld new=%ld first/last: old=%d->%d new=%d->%d).",
368 uFormat(
"Frame %d already added! Make sure the input frames have unique IDs!",
lastFrame_->
id()).c_str());
370 bundlePoses.insert(std::make_pair(
lastFrame_->
id(), transform));
377 bundleModels.insert(std::make_pair(
lastFrame_->
id(), lastFrameModels));
379 UDEBUG(
"Fill matches (%d)", (
int)regInfo.inliersIDs.size());
380 std::map<int, std::map<int, FeatureBA> > wordReferences;
381 for(
unsigned int i=0; i<regInfo.inliersIDs.size(); ++i)
383 int wordId =regInfo.inliersIDs[i];
386 std::multimap<int, int>::const_iterator iter3D = tmpMap.
getWords().find(wordId);
388 points3DMap.insert(std::make_pair(wordId, tmpMap.
getWords3()[iter3D->second]));
394 std::map<int, FeatureBA> references;
401 for(std::map<int, FeatureBA>::iterator jter=refIter->second.begin(); jter!=refIter->second.end(); ++jter)
403 if(oi++ % step == 0 && bundlePoses.find(jter->first)!=bundlePoses.end())
405 references.insert(*jter);
406 ++totalBundleWordReferencesUsed;
410 if(refIter->second.size() > 1)
412 if(references.insert(*refIter->second.rbegin()).second)
414 ++totalBundleWordReferencesUsed;
425 if(lastFrameModels.size()>1)
427 UASSERT(lastFrameModels[0].imageWidth()>0);
428 float subImageWidth = lastFrameModels[0].imageWidth();
429 cameraIndex = int(kpt.pt.x / subImageWidth);
430 UASSERT(cameraIndex < (
int)lastFrameModels.size());
431 kpt.pt.x = kpt.pt.x - (subImageWidth*float(cameraIndex));
444 wordReferences.insert(std::make_pair(wordId, references));
455 std::set<int> sbaOutliers;
457 bundlePoses =
sba_->
optimizeBA(-
lastFrame_->
id(), bundlePoses, bundleLinks, bundleModels, points3DMap, wordReferences, &sbaOutliers);
458 bundleTime = bundleTimer.
ticks();
460 totalBundleOutliers = (int)sbaOutliers.size();
462 UDEBUG(
"bundleTime=%fs (poses=%d wordRef=%d outliers=%d)", bundleTime, (
int)bundlePoses.size(), (int)
bundleWordReferences_.size(), (int)sbaOutliers.size());
469 UDEBUG(
"Local Bundle Adjustment Before: %s", transform.prettyPrint().c_str());
472 if(!bundlePoses.rbegin()->second.isNull())
474 if(sbaOutliers.size())
476 std::vector<int> newInliers(regInfo.inliersIDs.size());
478 for(
unsigned int i=0; i<regInfo.inliersIDs.size(); ++i)
480 if(sbaOutliers.find(regInfo.inliersIDs[i]) == sbaOutliers.end())
482 newInliers[oi++] = regInfo.inliersIDs[i];
485 newInliers.resize(oi);
486 UDEBUG(
"BA outliers ratio %f",
float(sbaOutliers.size())/
float(regInfo.inliersIDs.size()));
487 regInfo.inliers = (int)newInliers.size();
488 regInfo.inliersIDs = newInliers;
497 transform = bundlePoses.rbegin()->second;
499 UASSERT(iter != bundleLinks.end());
500 iter->second.setTransform(
bundlePoses_.rbegin()->second.inverse()*transform);
505 float rollImu,pitchImu,
yaw;
506 iter->second.transform().getEulerAngles(rollImu, pitchImu, yaw);
508 transform.getEulerAngles(roll, pitch, yaw);
514 UASSERT(regInfo.covariance.cols==6 && regInfo.covariance.rows == 6 && regInfo.covariance.type() == CV_64FC1);
517 if(regInfo.covariance.at<
double>(0,0)>thrLin)
518 regInfo.covariance.at<
double>(0,0) *= 0.1;
519 if(regInfo.covariance.at<
double>(1,1)>thrLin)
520 regInfo.covariance.at<
double>(1,1) *= 0.1;
521 if(regInfo.covariance.at<
double>(2,2)>thrLin)
522 regInfo.covariance.at<
double>(2,2) *= 0.1;
523 if(regInfo.covariance.at<
double>(3,3)>thrAng)
524 regInfo.covariance.at<
double>(3,3) *= 0.1;
525 if(regInfo.covariance.at<
double>(4,4)>thrAng)
526 regInfo.covariance.at<
double>(4,4) *= 0.1;
527 if(regInfo.covariance.at<
double>(5,5)>thrAng)
528 regInfo.covariance.at<
double>(5,5) *= 0.1;
531 UDEBUG(
"Local Bundle Adjustment After : %s", transform.prettyPrint().c_str());
535 UWARN(
"Local bundle adjustment failed! transform is not refined.");
540 if(!transform.isNull())
547 if(transform.isNull())
549 if(guessIteration == 1)
551 UWARN(
"Trial with no guess still fail.");
553 if(!regInfo.rejectedMsg.empty())
557 UWARN(
"Registration failed: \"%s\"", regInfo.rejectedMsg.c_str());
561 UWARN(
"Registration failed: \"%s\" (guess=%s)", regInfo.rejectedMsg.c_str(), guess.
prettyPrint().c_str());
566 UWARN(
"Unknown registration error");
569 else if(guessIteration == 1)
571 UWARN(
"Trial with no guess succeeded!");
579 bool modified =
false;
584 std::multimap<int, int> mapWords = tmpMap.
getWords();
585 std::vector<cv::KeyPoint> mapWordsKpts = tmpMap.
getWordsKpts();
586 std::vector<cv::Point3f> mapPoints = tmpMap.
getWords3();
599 addKeyFrame = addKeyFrame || addVisualKeyFrame || addGeometricKeyFrame;
609 UDEBUG(
"Update local map");
612 UASSERT(mapWords.size() == mapPoints.size());
613 UASSERT(mapWords.size() == mapWordsKpts.size());
614 UASSERT((
int)mapPoints.size() == mapDescriptors.rows);
622 UASSERT(iter != bundleLinks.end());
625 if(iter != bundleLinks.end())
635 for(std::map<int, cv::Point3f>::iterator iter=points3DMap.begin(); iter!=points3DMap.end(); ++iter)
637 UASSERT(mapWords.count(iter->first) == 1);
639 mapPoints[mapWords.find(iter->first)->second] = iter->second;
644 std::multimap<float, std::pair<int, std::pair<cv::KeyPoint, std::pair<cv::Point3f, std::pair<cv::Mat, int> > > > > newIds;
647 std::set<int> seenStatusUpdated;
650 bool addPointsWithoutDepth =
false;
651 if(!visDepthAsMask && validDepthRatio_ < 1.0f && !lastFrame_->getWords3().empty())
653 int ptsWithDepth = 0;
665 if(!addPointsWithoutDepth)
667 UWARN(
"Not enough points with valid depth in current frame (%d/%d=%f < %s=%f), points without depth are not added to map.",
672 if(!lastFrameModels.empty())
680 if(lastFrameModels.size()>1)
682 UASSERT(lastFrameModels[0].imageWidth()>0);
683 float subImageWidth = lastFrameModels[0].imageWidth();
684 cameraIndex = int(kpt.pt.x / subImageWidth);
685 UASSERT(cameraIndex < (
int)lastFrameModels.size());
686 kpt.pt.x = kpt.pt.x - (subImageWidth*float(cameraIndex));
689 if(mapWords.find(iter->first) == mapWords.end())
694 std::make_pair(kpt.response>0?1.0f/kpt.response:0.0f,
695 std::make_pair(iter->first,
705 std::multimap<int, int>::iterator iterKpts = mapWords.find(iter->first);
706 if(iterKpts!=mapWords.end() && !mapWordsKpts.empty())
708 mapWordsKpts[iterKpts->second].octave = kpt.octave;
712 iterBundlePosesRef->second += 1;
722 std::map<int, FeatureBA> framePt;
733 UDEBUG(
"newIds=%d", (
int)newIds.size());
738 for(std::multimap<
float, std::pair<
int, std::pair<cv::KeyPoint, std::pair<cv::Point3f, std::pair<cv::Mat, int> > > > >::reverse_iterator iter=newIds.rbegin();
744 int cameraIndex = iter->second.second.second.second.second;
750 iterBundlePosesRef->second += 1;
756 depth =
util3d::transformPoint(iter->second.second.second.first, lastFrameModels[cameraIndex].localTransform().inverse()).z;
760 std::map<int, FeatureBA> framePt;
761 framePt.insert(std::make_pair(
lastFrame_->
id(),
FeatureBA(iter->second.second.first, depth, cv::Mat(), cameraIndex)));
771 mapWords.insert(mapWords.end(), std::make_pair(iter->second.first, mapWords.size()));
772 mapWordsKpts.push_back(iter->second.second.first);
773 cv::Point3f pt = iter->second.second.second.first;
777 float x = iter->second.second.first.pt.x;
778 float y = iter->second.second.first.pt.y;
780 lastFrameModels[cameraIndex].imageSize(),
783 lastFrameModels[cameraIndex].cx(),
784 lastFrameModels[cameraIndex].cy(),
785 lastFrameModels[cameraIndex].fx(),
786 lastFrameModels[cameraIndex].fy());
787 float scaleInf = (0.05 * lastFrameModels[cameraIndex].fx()) / 0.01;
788 pt =
util3d::transformPoint(cv::Point3f(ray[0]*scaleInf, ray[1]*scaleInf, ray[2]*scaleInf), lastFrameModels[cameraIndex].localTransform());
791 mapDescriptors.push_back(iter->second.second.second.second.first);
805 std::set<int> inliers(regInfo.inliersIDs.begin(), regInfo.inliersIDs.end());
806 std::vector<int> ids = regInfo.matchesIDs;
807 if(regInfo.projectedIDs.size())
809 ids.resize(ids.size() + regInfo.projectedIDs.size());
811 for(
unsigned int i=0; i<regInfo.projectedIDs.size(); ++i)
813 if(regInfo.projectedIDs[i]>=lastFrameOldestNewId)
815 ids[regInfo.matchesIDs.size()+oi++] = regInfo.projectedIDs[i];
818 ids.resize(regInfo.matchesIDs.size()+oi);
819 UDEBUG(
"projected added=%d/%d minLastFrameId=%d", oi, (
int)regInfo.projectedIDs.size(), lastFrameOldestNewId);
821 for(
unsigned int i=0; i<ids.size() && (int)mapWords.size() >
maximumMapSize_ && mapWords.size() >= newIds.size(); ++i)
824 if(inliers.find(
id) == inliers.end())
829 for(std::map<int, FeatureBA>::iterator iterFrame = iterRef->second.begin(); iterFrame != iterRef->second.end(); ++iterFrame)
845 for(std::multimap<int, int>::iterator iter = mapWords.begin();
846 iter!=mapWords.end() && (int)mapWords.size() >
maximumMapSize_ && mapWords.size() >= newIds.size();)
848 if(inliers.find(iter->first) == inliers.end())
850 std::map<int, std::map<int, FeatureBA> >::iterator iterRef =
bundleWordReferences_.find(iter->first);
853 for(std::map<int, FeatureBA>::iterator iterFrame = iterRef->second.begin(); iterFrame != iterRef->second.end(); ++iterFrame)
863 mapWords.erase(iter++);
872 if(mapWords.size() != mapPoints.size())
875 std::vector<cv::KeyPoint> mapWordsKptsClean(mapWords.size());
876 std::vector<cv::Point3f> mapPointsClean(mapWords.size());
877 cv::Mat mapDescriptorsClean(mapWords.size(), mapDescriptors.cols, mapDescriptors.type());
879 for(std::multimap<int, int>::iterator iter = mapWords.begin(); iter!=mapWords.end(); ++iter, ++index)
881 mapWordsKptsClean[index] = mapWordsKpts[iter->second];
882 mapPointsClean[index] = mapPoints[iter->second];
883 mapDescriptors.row(iter->second).copyTo(mapDescriptorsClean.row(index));
884 iter->second = index;
886 mapWordsKpts = mapWordsKptsClean;
887 mapWordsKptsClean.clear();
888 mapPoints = mapPointsClean;
889 mapPointsClean.clear();
890 mapDescriptors = mapDescriptorsClean;
893 Link * previousLink = 0;
896 if(iter->second <= 0)
902 UASSERT(previousLink->
to() == iter->first);
903 *previousLink = previousLink->
merge(
bundleLinks_.find(iter->first)->second, previousLink->type());
928 UDEBUG(
"Update local features map = %fs", tmpTimer.
ticks());
938 pcl::PointCloud<pcl::PointXYZINormal>::Ptr frameCloudNormals (
new pcl::PointCloud<pcl::PointXYZINormal>());
953 pcl::IndicesPtr frameCloudNormalsIndices(
new std::vector<int>);
960 pcl::IndicesPtr(
new std::vector<int>),
962 pcl::IndicesPtr(
new std::vector<int>),
965 newPoints = frameCloudNormalsIndices->size();
969 newPoints = frameCloudNormals->size();
977 pcl::PointCloud<pcl::PointXYZINormal> tmp;
978 pcl::copyPointCloud(*frameCloudNormals, *frameCloudNormalsIndices, tmp);
983 UINFO(
"mapSize=%d newPoints=%d maxPoints=%d",
984 int(mapCloudNormals->size()),
988 *mapCloudNormals += tmp;
995 mapCloudNormals =
util3d::cropBox(mapCloudNormals, Eigen::Vector4f(boxMin.x, boxMin.y, boxMin.z, 0 ), Eigen::Vector4f(boxMax.x, boxMax.y, boxMax.z, 0 ));
998 *mapCloudNormals += tmp;
1002 pcl::PointCloud<pcl::PointXYZI>::Ptr mapCloud (
new pcl::PointCloud<pcl::PointXYZI> ());
1003 copyPointCloud(*mapCloudNormals, *mapCloud);
1005 copyPointCloud(*normals, *mapCloudNormals);
1008 scansBuffer_.push_back(std::make_pair(frameCloudNormals, frameCloudNormalsIndices));
1011 UDEBUG(
"scansBuffer=%d, mapSize=%d newPoints=%d maxPoints=%d",
1013 int(mapCloudNormals->size()),
1021 mapCloudNormals->clear();
1022 std::list<int> toRemove;
1037 pcl::PointCloud<pcl::PointXYZINormal> tmp;
1039 *mapCloudNormals += tmp;
1050 std::vector<std::pair<pcl::PointCloud<pcl::PointXYZINormal>::Ptr, pcl::IndicesPtr> > scansTmp(
scansBuffer_.size()-i);
1054 UASSERT(oi < (
int)scansTmp.size());
1065 pcl::PointCloud<pcl::PointXYZINormal> tmp;
1067 *mapCloudNormals += tmp;
1078 Transform mapViewpoint(-newFramePose.
x(), -newFramePose.
y(),0,0,0,0);
1083 Transform mapViewpoint(-newFramePose.
x(), -newFramePose.
y(), -newFramePose.
z(),0,0,0);
1089 UDEBUG(
"Update local scan map = %fs", tmpTimer.
ticks());
1118 map_->
setWords(mapWords, mapWordsKpts, mapPoints, mapDescriptors);
1132 for(std::multimap<int, int>::const_iterator iter=tmpMap.
getWords().begin(); iter!=tmpMap.
getWords().end(); ++iter)
1134 info->
localMap.insert(std::make_pair(iter->first, tmpMap.
getWords3()[iter->second]));
1157 regInfo.covariance = cv::Mat::eye(6,6,CV_64FC1)*9999.0;
1159 bool frameValid =
false;
1164 int ptsWithDepth = 0;
1183 std::multimap<int, int> words;
1184 std::vector<cv::KeyPoint> wordsKpts;
1185 std::vector<cv::Point3f> transformedPoints;
1186 std::multimap<int, int> mapPointWeights;
1187 cv::Mat descriptors;
1197 words.insert(words.end(), std::make_pair(iter->first, words.size()));
1200 mapPointWeights.insert(std::make_pair(iter->first, 0));
1209 if(!wordsKpts.empty())
1211 for(std::multimap<int, int>::const_iterator iter=words.begin(); iter!=words.end(); ++iter)
1213 if(words.count(iter->first) == 1)
1216 std::map<int, FeatureBA> framePt;
1218 cv::KeyPoint kpt = wordsKpts[iter->second];
1220 int cameraIndex = 0;
1221 if(lastFrameModels.size()>1)
1223 UASSERT(lastFrameModels[0].imageWidth()>0);
1224 float subImageWidth = lastFrameModels[0].imageWidth();
1225 cameraIndex = int(kpt.pt.x / subImageWidth);
1226 kpt.pt.x = kpt.pt.x - (subImageWidth*float(cameraIndex));
1256 map_->
setWords(words, wordsKpts, transformedPoints, descriptors);
1270 double complexity = 0.0;;
1273 float minComplexity = Parameters::defaultIcpPointToPlaneMinComplexity();
1274 bool p2n = Parameters::defaultIcpPointToPlane();
1277 if(p2n && minComplexity>0.0
f)
1282 if(complexity > minComplexity)
1288 UWARN(
"Scan complexity too low (%f) to init robustly the first " 1289 "keyframe. Make sure the lidar is seeing enough " 1290 "geometry in all axes for good initialization. " 1291 "Accepting as an initial guess (%s) is provided.",
1299 UWARN(
"Input raw scan doesn't have normals, complexity check on first frame is not done.");
1312 UINFO(
"Local map will be updated using range instead of time with range threshold set at %f",
scanMapMaxRange_);
1314 scansBuffer_.push_back(std::make_pair(mapCloudNormals, pcl::IndicesPtr(
new std::vector<int>)));
1318 Transform mapViewpoint(-newFramePose.
x(), -newFramePose.
y(),0,0,0,0);
1328 Transform mapViewpoint(-newFramePose.
x(), -newFramePose.
y(), -newFramePose.
z(),0,0,0);
1341 UWARN(
"Scan complexity too low (%f) to init first keyframe.", complexity);
1346 UWARN(
"Missing scan to initialize odometry.");
1383 info->
words.clear();
1396 UERROR(
"SensorData not valid!");
1410 info->
reg = regInfo;
1418 UINFO(
"Odom update time = %fs lost=%s features=%d inliers=%d/%d variance:lin=%f, ang=%f local_map=%d local_scan_map=%d",
1420 output.
isNull()?
"true":
"false",
1424 !regInfo.covariance.empty()?regInfo.covariance.at<
double>(0,0):0,
1425 !regInfo.covariance.empty()?regInfo.covariance.at<
double>(5,5):0,
GLM_FUNC_DECL T roll(detail::tquat< T, P > const &x)
bool RTABMAP_EXP isFinite(const cv::Point3f &pt)
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
int getMinVisualCorrespondences() const
static double COVARIANCE_ANGULAR_EPSILON
Link merge(const Link &link, Type outputType) const
pcl::PointCloud< pcl::PointXYZRGB >::Ptr RTABMAP_EXP subtractFiltering(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud, const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &substractCloud, float radiusSearch, int minNeighborsInRadius=1)
ParametersMap parameters_
Transform computeTransformationMod(Signature &from, Signature &to, Transform guess=Transform::getIdentity(), RegistrationInfo *info=0) const
const cv::Size & imageSize() const
std::multimap< int, Link >::iterator RTABMAP_EXP findLink(std::multimap< int, Link > &links, int from, int to, bool checkBothWays=true, Link::Type type=Link::kUndef)
cv::Point3f RTABMAP_EXP transformPoint(const cv::Point3f &pt, const Transform &transform)
const std::vector< cv::Point3f > & keypoints3D() const
pcl::PointCloud< pcl::PointXYZ >::Ptr RTABMAP_EXP transformPointCloud(const pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud, const Transform &transform)
void setLaserScan(const LaserScan &laserScan, bool clearPreviousData=true)
OdometryF2M(const rtabmap::ParametersMap ¶meters=rtabmap::ParametersMap())
virtual void reset(const Transform &initialPose=Transform::getIdentity())
unsigned int framesProcessed() const
std::map< int, cv::Point3f > localMap
float pointToPlaneRadius_
Registration * regPipeline_
std::vector< std::pair< pcl::PointCloud< pcl::PointXYZINormal >::Ptr, pcl::IndicesPtr > > scansBuffer_
std::pair< std::string, std::string > ParametersPair
const cv::Mat & getWordsDescriptors() const
std::map< int, std::vector< CameraModel > > localBundleModels
const std::vector< StereoCameraModel > & stereoCameraModels() const
std::map< int, std::vector< CameraModel > > bundleModels_
const cv::Mat & data() const
std::map< std::string, std::string > ParametersMap
std::string UTILITE_EXP uBool2Str(bool boolean)
const std::vector< cv::KeyPoint > & keypoints() const
virtual Transform computeTransform(SensorData &data, const Transform &guess=Transform(), OdometryInfo *info=0)
const std::vector< cv::Point3f > & getWords3() const
Basic mathematics functions.
Some conversion functions.
std::map< int, std::map< int, FeatureBA > > bundleWordReferences_
GLM_FUNC_DECL T pitch(detail::tquat< T, P > const &x)
virtual std::map< int, Transform > optimizeBA(int rootId, const std::map< int, Transform > &poses, const std::multimap< int, Link > &links, const std::map< int, std::vector< CameraModel > > &models, std::map< int, cv::Point3f > &points3DMap, const std::map< int, std::map< int, FeatureBA > > &wordReferences, std::set< int > *outliers=0)
float scanSubtractRadius_
int localBundleConstraints
static bool isAvailable(Optimizer::Type type)
RegistrationInfo copyWithoutData() const
GLM_FUNC_DECL genType step(genType const &edge, genType const &x)
float gravitySigma() const
static double COVARIANCE_LINEAR_EPSILON
std::multimap< int, Link > bundleIMUOrientations_
const std::vector< cv::KeyPoint > & getWordsKpts() const
#define UASSERT(condition)
bool isInfoDataFilled() const
const std::vector< CameraModel > & cameraModels() const
std::map< int, int > bundlePoseReferences_
bool isScanRequired() const
int lastFrameOldestNewId_
#define UASSERT_MSG(condition, msg_str)
pcl::PointCloud< pcl::PointXYZINormal >::Ptr RTABMAP_EXP laserScanToPointCloudINormal(const LaserScan &laserScan, const Transform &transform=Transform(), float intensity=0.0f)
std::map< int, Transform > bundlePoses_
virtual void parseParameters(const ParametersMap ¶meters)
const cv::Mat & descriptors() const
std::map< int, Transform > localBundlePoses
const std::map< double, Transform > & imus() const
bool isImageRequired() const
cv::Mat RTABMAP_EXP computeNormals(const cv::Mat &laserScan, int searchK, float searchRadius)
const Transform & localTransform() const
LaserScan laserScanFromPointCloud(const PointCloud2T &cloud, bool filterNaNs, bool is2D, const Transform &transform)
static Registration * create(const ParametersMap ¶meters)
const LaserScan & laserScanRaw() const
Eigen::Vector3f RTABMAP_EXP projectDepthTo3DRay(const cv::Size &imageSize, float x, float y, float cx, float cy, float fx, float fy)
std::multimap< int, cv::KeyPoint > words
SensorData & sensorData()
void setWords(const std::multimap< int, int > &words, const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &words3, const cv::Mat &descriptors)
pcl::IndicesPtr RTABMAP_EXP cropBox(const pcl::PCLPointCloud2::Ptr &cloud, const pcl::IndicesPtr &indices, const Eigen::Vector4f &min, const Eigen::Vector4f &max, const Transform &transform=Transform::getIdentity(), bool negative=false)
ULogger class and convenient macros.
GLM_FUNC_DECL T yaw(detail::tquat< T, P > const &x)
virtual void reset(const Transform &initialPose=Transform::getIdentity())
const Transform & getPose() const
std::multimap< int, Link > bundleLinks_
pcl::PointCloud< pcl::PointXYZ >::Ptr RTABMAP_EXP voxelize(const pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud, const pcl::IndicesPtr &indices, float voxelSize)
std::string UTILITE_EXP uFormat(const char *fmt,...)
std::string UTILITE_EXP uNumber2Str(unsigned int number)
Transform localTransform() const
static Optimizer * create(const ParametersMap ¶meters)
LaserScan RTABMAP_EXP laserScan2dFromPointCloud(const pcl::PointCloud< pcl::PointXYZ > &cloud, const Transform &transform=Transform(), bool filterNaNs=true)
V uValue(const std::map< K, V > &m, const K &key, const V &defaultValue=V())
float RTABMAP_EXP computeNormalsComplexity(const LaserScan &scan, const Transform &t=Transform::getIdentity(), cv::Mat *pcaEigenVectors=0, cv::Mat *pcaEigenValues=0)
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
void uInsert(std::map< K, V > &map, const std::pair< K, V > &pair)
const std::multimap< int, int > & getWords() const
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)