43 #include <opencv2/core/core.hpp> 44 #include <opencv2/features2d/features2d.hpp> 45 #include <pcl/pcl_config.h> 56 class RegistrationInfo;
57 class RegistrationIcp;
73 virtual void parseParameters(
const ParametersMap & parameters);
79 const cv::Mat & covariance,
80 const std::vector<float> & velocity = std::vector<float>(),
82 bool init(
const std::string & dbUrl,
83 bool dbOverwritten =
false,
85 bool postInitClosingEvents =
false);
86 void close(
bool databaseSaved =
true,
bool postInitClosingEvents =
false,
const std::string & ouputDatabasePath =
"");
87 std::map<int, float> computeLikelihood(
const Signature * signature,
88 const std::list<int> & ids);
89 int incrementMapId(std::map<int, int> * reducedIds = 0);
90 void updateAge(
int signatureId);
92 std::list<int> forget(
const std::set<int> & ignoredIds = std::set<int>());
93 std::set<int> reactivateSignatures(
const std::list<int> & ids,
unsigned int maxLoaded,
double & timeDbAccess);
96 void saveStatistics(
const Statistics & statistics,
bool saveWMState);
97 void savePreviewImage(
const cv::Mat & image)
const;
98 cv::Mat loadPreviewImage()
const;
99 void saveOptimizedPoses(
const std::map<int, Transform> & optimizedPoses,
const Transform & lastlocalizationPose)
const;
100 std::map<int, Transform> loadOptimizedPoses(
Transform * lastlocalizationPose)
const;
101 void save2DMap(
const cv::Mat & map,
float xMin,
float yMin,
float cellSize)
const;
102 cv::Mat load2DMap(
float & xMin,
float & yMin,
float & cellSize)
const;
103 void saveOptimizedMesh(
104 const cv::Mat & cloud,
105 const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons = std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > >(),
106 #
if PCL_VERSION_COMPARE(>=, 1, 8, 0)
107 const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(),
109 const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(),
111 const cv::Mat & textures = cv::Mat())
const;
112 cv::Mat loadOptimizedMesh(
113 std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons = 0,
114 #
if PCL_VERSION_COMPARE(>=, 1, 8, 0)
115 std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
117 std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0,
119 cv::Mat * textures = 0)
const;
121 void joinTrashThread();
122 bool addLink(
const Link & link,
bool addInDatabase =
false);
123 void updateLink(
const Link & link,
bool updateInDatabase =
false);
124 void removeAllVirtualLinks();
125 void removeVirtualLinks(
int signatureId);
126 std::map<int, int> getNeighborsId(
129 int maxCheckedInDatabase = -1,
130 bool incrementMarginOnLoop =
false,
131 bool ignoreLoopIds =
false,
132 bool ignoreIntermediateNodes =
false,
133 bool ignoreLocalSpaceLoopIds =
false,
134 const std::set<int> & nodesSet = std::set<int>(),
135 double * dbAccessTime = 0)
const;
136 std::map<int, float> getNeighborsIdRadius(
139 const std::map<int, Transform> & optimizedPoses,
140 int maxGraphDepth)
const;
141 void deleteLocation(
int locationId, std::list<int> * deletedWords = 0);
142 void saveLocationData(
int locationId);
143 void removeLink(
int idA,
int idB);
144 void removeRawData(
int id,
bool image =
true,
bool scan =
true,
bool userData =
true);
148 const std::set<int> &
getStMem()
const {
return _stMem;}
150 std::multimap<int, Link> getNeighborLinks(
int signatureId,
151 bool lookInDatabase =
false)
const;
152 std::multimap<int, Link> getLoopClosureLinks(
int signatureId,
153 bool lookInDatabase =
false)
const;
154 std::multimap<int, Link> getLinks(
int signatureId,
155 bool lookInDatabase =
false,
156 bool withLandmarks =
false)
const;
157 std::multimap<int, Link> getAllLinks(
bool lookInDatabase,
bool ignoreNullLinks =
true,
bool withLandmarks =
false)
const;
160 std::map<int, int> getWeights()
const;
161 int getLastSignatureId()
const;
162 const Signature * getLastWorkingSignature()
const;
163 std::map<int, Link> getNodesObservingLandmark(
int landmarkId,
bool lookInDatabase)
const;
164 int getSignatureIdByLabel(
const std::string & label,
bool lookInDatabase =
true)
const;
165 bool labelSignature(
int id,
const std::string & label);
166 const std::map<int, std::string> &
getAllLabels()
const {
return _labels;}
178 bool setUserData(
int id,
const cv::Mat & data);
179 int getDatabaseMemoryUsed()
const;
180 std::string getDatabaseVersion()
const;
181 std::string getDatabaseUrl()
const;
182 double getDbSavingTime()
const;
183 int getMapId(
int id,
bool lookInDatabase =
false)
const;
184 Transform getOdomPose(
int signatureId,
bool lookInDatabase =
false)
const;
185 Transform getGroundTruthPose(
int signatureId,
bool lookInDatabase =
false)
const;
187 void getGPS(
int id,
GPS & gps,
Transform & offsetENU,
bool lookInDatabase,
int maxGraphDepth = 0)
const;
188 bool getNodeInfo(
int signatureId,
195 std::vector<float> & velocity,
198 bool lookInDatabase =
false)
const;
199 cv::Mat getImageCompressed(
int signatureId)
const;
200 SensorData getNodeData(
int locationId,
bool images,
bool scan,
bool userData,
bool occupancyGrid)
const;
201 void getNodeWordsAndGlobalDescriptors(
int nodeId,
202 std::multimap<int, int> & words,
203 std::vector<cv::KeyPoint> & wordsKpts,
204 std::vector<cv::Point3f> & words3,
205 cv::Mat & wordsDescriptors,
206 std::vector<GlobalDescriptor> & globalDescriptors)
const;
207 void getNodeCalibration(
int nodeId,
208 std::vector<CameraModel> & models,
210 std::set<int> getAllSignatureIds(
bool ignoreChildren =
true)
const;
214 const Signature * getSignature(
int id)
const;
215 bool isInSTM(
int signatureId)
const {
return _stMem.find(signatureId) != _stMem.end();}
216 bool isInWM(
int signatureId)
const {
return _workingMem.find(signatureId) != _workingMem.end();}
217 bool isInLTM(
int signatureId)
const {
return !this->isInSTM(signatureId) && !this->isInWM(signatureId);}
225 void dumpMemoryTree(
const char * fileNameTree)
const;
226 virtual void dumpMemory(std::string directory)
const;
227 virtual void dumpSignatures(
const char * fileNameSign,
bool words3D)
const;
228 void dumpDictionary(
const char * fileNameRef,
const char * fileNameDesc)
const;
229 unsigned long getMemoryUsed()
const;
231 void generateGraph(
const std::string & fileName,
const std::set<int> & ids = std::set<int>());
237 void getMetricConstraints(
238 const std::set<int> & ids,
239 std::map<int, Transform> & poses,
240 std::multimap<int, Link> & links,
241 bool lookInDatabase =
false,
242 bool landmarksAdded =
false);
249 const std::map<int, Transform> & poses,
254 void addSignatureToStm(
Signature * signature,
const cv::Mat & covariance);
256 void loadDataFromDb(
bool postInitClosingEvents);
257 void moveToTrash(
Signature * s,
bool keepLinkedToGraph =
true, std::list<int> * deletedWords = 0);
259 void moveSignatureToWMFromSTM(
int id,
int * reducedTo = 0);
260 void addSignatureToWmFromLTM(
Signature * signature);
262 std::list<Signature *> getRemovableSignatures(
int count,
263 const std::set<int> & ignoredIds = std::set<int>());
267 bool rehearsalMerge(
int oldId,
int newId);
269 const std::map<int, Signature*> &
getSignatures()
const {
return _signatures;}
278 void disableWordsRef(
int signatureId);
279 void enableWordsRef(
const std::list<int> & signatureIds);
280 void cleanUnusedWords();
281 int getNi(
int signatureId)
const;
OccupancyGrid * _occupancy
Signature * _lastSignature
float getSimilarityThreshold() const
float _similarityThreshold
bool _localizationDataSaved
bool _imagesAlreadyRectified
const std::map< int, std::set< int > > & getLandmarksIndex() const
bool isInSTM(int signatureId) const
int getMaxStMemSize() const
def init(descriptorDim, matchThreshold, iterations, cuda, model_path)
std::map< int, std::set< int > > _landmarksInvertedIndex
bool _transferSortingByWeightId
bool _tfIdfLikelihoodUsed
bool _compressionParallelized
std::map< std::string, std::string > ParametersMap
const std::map< int, Transform > & getGroundTruths() const
Registration * _registrationPipeline
bool isLocalizationDataSaved() const
bool _reextractLoopClosureFeatures
const std::set< int > & getStMem() const
bool isInWM(int signatureId) const
bool allNodesInWM() const
std::map< int, std::string > _labels
Wrappers of STL for convenient functions.
const std::map< int, double > & getWorkingMem() const
float _laserScanDownsampleStepSize
const std::map< int, Signature * > & getSignatures() const
const std::map< int, std::string > & getAllLabels() const
bool _localBundleOnLoopClosure
bool isGraphReduced() const
RegistrationIcp * _registrationIcpMulti
static const int kIdStart
bool _createOccupancyGrid
static const int kIdInvalid
const std::vector< double > & getOdomMaxInf() const
float _laserScanVoxelSize
bool _rectifyOnlyFeatures
int getLastGlobalLoopClosureId() const
std::map< int, Transform > _groundTruths
bool _saveIntermediateNodeData
bool isOdomGravityUsed() const
const Feature2D * getFeature2D() const
std::vector< CameraModel > _rectCameraModels
StereoCameraModel _rectStereoCameraModel
bool _notLinkedNodesKeptInDb
bool _badSignaturesIgnored
std::string _rgbCompressionFormat
bool _useOdometryFeatures
static const int kIdVirtual
MarkerDetector * _markerDetector
const std::map< int, std::set< int > > & getLandmarksInvertedIndex() const
float _rehearsalMaxDistance
bool isBinDataKept() const
bool _idUpdatedToNewOneRehearsal
bool memoryChanged() const
float _laserScanNormalRadius
std::map< EnvSensor::Type, EnvSensor > EnvSensors
ParametersMap parameters_
bool isIncremental() const
virtual const ParametersMap & getParameters() const
std::map< int, std::set< int > > _landmarksIndex
std::map< int, Signature * > _signatures
std::vector< double > _odomMaxInf
bool _rehearsalWeightIgnoredWhileMoving
bool _covOffDiagonalIgnored
bool isInLTM(int signatureId) const
int _lastGlobalLoopClosureId
std::map< int, double > _workingMem
bool isIDsGenerated() const