43 #include <opencv2/core/core.hpp> 44 #include <opencv2/features2d/features2d.hpp> 45 #include <pcl/pcl_config.h> 56 class RegistrationInfo;
57 class RegistrationIcp;
72 virtual void parseParameters(
const ParametersMap & parameters);
78 const cv::Mat & covariance,
79 const std::vector<float> & velocity = std::vector<float>(),
81 bool init(
const std::string & dbUrl,
82 bool dbOverwritten =
false,
84 bool postInitClosingEvents =
false);
85 void close(
bool databaseSaved =
true,
bool postInitClosingEvents =
false,
const std::string & ouputDatabasePath =
"");
86 std::map<int, float> computeLikelihood(
const Signature * signature,
87 const std::list<int> & ids);
88 int incrementMapId(std::map<int, int> * reducedIds = 0);
89 void updateAge(
int signatureId);
91 std::list<int> forget(
const std::set<int> & ignoredIds = std::set<int>());
92 std::set<int> reactivateSignatures(
const std::list<int> & ids,
unsigned int maxLoaded,
double & timeDbAccess);
95 void saveStatistics(
const Statistics & statistics);
96 void savePreviewImage(
const cv::Mat & image)
const;
97 cv::Mat loadPreviewImage()
const;
98 void saveOptimizedPoses(
const std::map<int, Transform> & optimizedPoses,
const Transform & lastlocalizationPose)
const;
99 std::map<int, Transform> loadOptimizedPoses(
Transform * lastlocalizationPose)
const;
100 void save2DMap(
const cv::Mat & map,
float xMin,
float yMin,
float cellSize)
const;
101 cv::Mat load2DMap(
float & xMin,
float & yMin,
float & cellSize)
const;
102 void saveOptimizedMesh(
103 const cv::Mat & cloud,
104 const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(),
105 #
if PCL_VERSION_COMPARE(>=, 1, 8, 0)
106 const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(),
108 const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(),
110 const cv::Mat & textures = cv::Mat())
const;
111 cv::Mat loadOptimizedMesh(
112 std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0,
113 #
if PCL_VERSION_COMPARE(>=, 1, 8, 0)
114 std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
116 std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0,
118 cv::Mat * textures = 0)
const;
120 void joinTrashThread();
121 bool addLink(
const Link & link,
bool addInDatabase =
false);
122 void updateLink(
const Link & link,
bool updateInDatabase =
false);
123 void removeAllVirtualLinks();
124 void removeVirtualLinks(
int signatureId);
125 std::map<int, int> getNeighborsId(
128 int maxCheckedInDatabase = -1,
129 bool incrementMarginOnLoop =
false,
130 bool ignoreLoopIds =
false,
131 bool ignoreIntermediateNodes =
false,
132 bool ignoreLocalSpaceLoopIds =
false,
133 const std::set<int> & nodesSet = std::set<int>(),
134 double * dbAccessTime = 0)
const;
135 std::map<int, float> getNeighborsIdRadius(
138 const std::map<int, Transform> & optimizedPoses,
139 int maxGraphDepth)
const;
140 void deleteLocation(
int locationId, std::list<int> * deletedWords = 0);
141 void saveLocationData(
int locationId);
142 void removeLink(
int idA,
int idB);
143 void removeRawData(
int id,
bool image =
true,
bool scan =
true,
bool userData =
true);
147 const std::set<int> &
getStMem()
const {
return _stMem;}
149 std::map<int, Link> getNeighborLinks(
int signatureId,
150 bool lookInDatabase =
false)
const;
151 std::map<int, Link> getLoopClosureLinks(
int signatureId,
152 bool lookInDatabase =
false)
const;
153 std::map<int, Link> getLinks(
int signatureId,
154 bool lookInDatabase =
false)
const;
155 std::multimap<int, Link> getAllLinks(
bool lookInDatabase,
bool ignoreNullLinks =
true)
const;
158 std::map<int, int> getWeights()
const;
159 int getLastSignatureId()
const;
160 const Signature * getLastWorkingSignature()
const;
161 int getSignatureIdByLabel(
const std::string & label,
bool lookInDatabase =
true)
const;
162 bool labelSignature(
int id,
const std::string & label);
163 std::map<int, std::string> getAllLabels()
const;
171 bool setUserData(
int id,
const cv::Mat & data);
172 int getDatabaseMemoryUsed()
const;
173 std::string getDatabaseVersion()
const;
174 std::string getDatabaseUrl()
const;
175 double getDbSavingTime()
const;
176 Transform getOdomPose(
int signatureId,
bool lookInDatabase =
false)
const;
177 Transform getGroundTruthPose(
int signatureId,
bool lookInDatabase =
false)
const;
178 bool getNodeInfo(
int signatureId,
185 std::vector<float> & velocity,
187 bool lookInDatabase =
false)
const;
188 cv::Mat getImageCompressed(
int signatureId)
const;
189 SensorData getNodeData(
int nodeId,
bool uncompressedData =
false)
const;
190 void getNodeWords(
int nodeId,
191 std::multimap<int, cv::KeyPoint> & words,
192 std::multimap<int, cv::Point3f> & words3,
193 std::multimap<int, cv::Mat> & wordsDescriptors);
194 void getNodeCalibration(
int nodeId,
195 std::vector<CameraModel> & models,
197 SensorData getSignatureDataConst(
int locationId,
bool images =
true,
bool scan =
true,
bool userData =
true,
bool occupancyGrid =
true)
const;
198 std::set<int> getAllSignatureIds()
const;
201 const Signature * getSignature(
int id)
const;
202 bool isInSTM(
int signatureId)
const {
return _stMem.find(signatureId) != _stMem.end();}
203 bool isInWM(
int signatureId)
const {
return _workingMem.find(signatureId) != _workingMem.end();}
204 bool isInLTM(
int signatureId)
const {
return !this->isInSTM(signatureId) && !this->isInWM(signatureId);}
210 void dumpMemoryTree(
const char * fileNameTree)
const;
211 virtual void dumpMemory(std::string directory)
const;
212 virtual void dumpSignatures(
const char * fileNameSign,
bool words3D)
const;
213 void dumpDictionary(
const char * fileNameRef,
const char * fileNameDesc)
const;
215 void generateGraph(
const std::string & fileName,
const std::set<int> & ids = std::set<int>());
221 void getMetricConstraints(
222 const std::set<int> & ids,
223 std::map<int, Transform> & poses,
224 std::multimap<int, Link> & links,
225 bool lookInDatabase =
false);
232 const std::map<int, Transform> & poses,
237 void addSignatureToStm(
Signature * signature,
const cv::Mat & covariance);
239 void loadDataFromDb(
bool postInitClosingEvents);
240 void moveToTrash(
Signature * s,
bool keepLinkedToGraph =
true, std::list<int> * deletedWords = 0);
242 void moveSignatureToWMFromSTM(
int id,
int * reducedTo = 0);
243 void addSignatureToWmFromLTM(
Signature * signature);
245 std::list<Signature *> getRemovableSignatures(
int count,
246 const std::set<int> & ignoredIds = std::set<int>());
250 bool rehearsalMerge(
int oldId,
int newId);
252 const std::map<int, Signature*> &
getSignatures()
const {
return _signatures;}
261 void disableWordsRef(
int signatureId);
262 void enableWordsRef(
const std::list<int> & signatureIds);
263 void cleanUnusedWords();
264 int getNi(
int signatureId)
const;
326 float _badSignRatio;;
OccupancyGrid * _occupancy
Signature * _lastSignature
float getSimilarityThreshold() const
float _similarityThreshold
bool _imagesAlreadyRectified
bool isInSTM(int signatureId) const
int getMaxStMemSize() const
bool _transferSortingByWeightId
bool _tfIdfLikelihoodUsed
bool _compressionParallelized
std::map< std::string, std::string > ParametersMap
Registration * _registrationPipeline
bool _reextractLoopClosureFeatures
const std::set< int > & getStMem() const
bool isInWM(int signatureId) const
Wrappers of STL for convenient functions.
const std::map< int, double > & getWorkingMem() const
float _laserScanDownsampleStepSize
const std::map< int, Signature * > & getSignatures() const
bool _localBundleOnLoopClosure
bool isGraphReduced() const
RegistrationIcp * _registrationIcpMulti
static const int kIdStart
bool _createOccupancyGrid
static const int kIdInvalid
float _laserScanVoxelSize
bool _rectifyOnlyFeatures
int getLastGlobalLoopClosureId() const
bool _saveIntermediateNodeData
const Feature2D * getFeature2D() const
std::vector< CameraModel > _rectCameraModels
StereoCameraModel _rectStereoCameraModel
bool _notLinkedNodesKeptInDb
bool _badSignaturesIgnored
bool _useOdometryFeatures
static const int kIdVirtual
float _rehearsalMaxDistance
bool isBinDataKept() const
bool _idUpdatedToNewOneRehearsal
bool memoryChanged() const
float _laserScanNormalRadius
ParametersMap parameters_
bool isIncremental() const
virtual const ParametersMap & getParameters() const
std::map< int, Signature * > _signatures
bool _rehearsalWeightIgnoredWhileMoving
bool _covOffDiagonalIgnored
bool isInLTM(int signatureId) const
int _lastGlobalLoopClosureId
std::map< int, double > _workingMem
bool isIDsGenerated() const