mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Database update (version 0.8.5): added Node.stamp and Node.label fields
Added labeling mechanism of nodes (by default the first node of a map is tagged "map#")
This commit is contained in:
@@ -44,9 +44,9 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
CameraEvent(const cv::Mat & image, int seq=0) :
|
||||
CameraEvent(const cv::Mat & image, int seq=0, double stamp = 0.0) :
|
||||
UEvent(kCodeImage),
|
||||
data_(image, seq)
|
||||
data_(image, seq, stamp)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
CameraEvent(const cv::Mat & rgb, const cv::Mat & depth, float fx, float fy, float cx, float cy, const Transform & localTransform, int id) :
|
||||
CameraEvent(const cv::Mat & rgb, const cv::Mat & depth, float fx, float fy, float cx, float cy, const Transform & localTransform, int id, double stamp) :
|
||||
UEvent(kCodeImageDepth),
|
||||
data_(rgb, depth, fx, fy, cx, cy, localTransform, Transform(), 1.0f, 1.0f, id)
|
||||
data_(rgb, depth, fx, fy, cx, cy, localTransform, Transform(), 1.0f, 1.0f, id, stamp)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@ public:
|
||||
|
||||
public:
|
||||
// Mutex-protected methods of abstract versions below
|
||||
bool getSignature(int signatureId, Signature ** s);
|
||||
bool getVisualWord(int wordId, VisualWord ** vw);
|
||||
|
||||
bool openConnection(const std::string & url, bool overwritten = false);
|
||||
void closeConnection();
|
||||
@@ -106,6 +104,7 @@ public:
|
||||
void getLastNodeId(int & id) const;
|
||||
void getLastWordId(int & id) const;
|
||||
void getInvertedIndexNi(int signatureId, int & ni) const;
|
||||
void getNodeIdByLabel(const std::string & label, int & id) const;
|
||||
|
||||
protected:
|
||||
DBDriver(const ParametersMap & parameters = ParametersMap());
|
||||
@@ -140,6 +139,7 @@ private:
|
||||
virtual void getAllNodeIdsQuery(std::set<int> & ids, bool ignoreChildren) const = 0;
|
||||
virtual void getLastIdQuery(const std::string & tableName, int & id) const = 0;
|
||||
virtual void getInvertedIndexNiQuery(int signatureId, int & ni) const = 0;
|
||||
virtual void getNodeIdByLabelQuery(const std::string & label, int & id) const = 0;
|
||||
|
||||
private:
|
||||
//non-abstract methods
|
||||
|
||||
@@ -109,6 +109,8 @@ public:
|
||||
std::map<int, int> getWeights() const;
|
||||
int getLastSignatureId() const;
|
||||
const Signature * getLastWorkingSignature() const;
|
||||
int getSignatureIdByLabel(const std::string & label, bool lookInDatabase = true) const;
|
||||
bool labelSignature(int id, const std::string & label);
|
||||
int getDatabaseMemoryUsed() const; // in bytes
|
||||
double getDbSavingTime() const;
|
||||
int getMapId(int signatureId) const;
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
void setTimeThreshold(float maxTimeAllowed); // in ms
|
||||
|
||||
int triggerNewMap();
|
||||
bool labelLocation(int id, const std::string & label);
|
||||
void generateDOTGraph(const std::string & path, int id=0, int margin=5);
|
||||
void generateTOROGraph(const std::string & path, bool optimized, bool global);
|
||||
void resetMemory();
|
||||
|
||||
@@ -43,7 +43,7 @@ class RTABMAP_EXP SensorData
|
||||
{
|
||||
public:
|
||||
SensorData(); // empty constructor
|
||||
SensorData(const cv::Mat & image, int id = 0);
|
||||
SensorData(const cv::Mat & image, int id = 0, double stamp = 0.0);
|
||||
|
||||
// Metric constructor
|
||||
SensorData(const cv::Mat & image,
|
||||
@@ -56,7 +56,8 @@ public:
|
||||
const Transform & pose,
|
||||
float poseRotVariance,
|
||||
float poseTransVariance,
|
||||
int id);
|
||||
int id,
|
||||
double stamp);
|
||||
|
||||
// Metric constructor + 2d laser scan
|
||||
SensorData(const cv::Mat & laserScan,
|
||||
@@ -70,7 +71,8 @@ public:
|
||||
const Transform & pose,
|
||||
float poseRotVariance,
|
||||
float poseTransVariance,
|
||||
int id);
|
||||
int id,
|
||||
double stamp);
|
||||
|
||||
virtual ~SensorData() {}
|
||||
|
||||
@@ -82,6 +84,7 @@ public:
|
||||
const cv::Mat & image() const {return _image;}
|
||||
int id() const {return _id;}
|
||||
void setId(int id) {_id = id;}
|
||||
double stamp() const {return _stamp;}
|
||||
|
||||
bool isMetric() const {return !_depthOrRightImage.empty() || _fx != 0.0f || _fyOrBaseline != 0.0f || !_pose.isNull();}
|
||||
void setPose(const Transform & pose, float rotVariance, float transVariance) {_pose = pose; _poseRotVariance=rotVariance; _poseTransVariance = transVariance;}
|
||||
@@ -111,6 +114,7 @@ public:
|
||||
private:
|
||||
cv::Mat _image;
|
||||
int _id;
|
||||
double _stamp;
|
||||
|
||||
// Metric stuff
|
||||
cv::Mat _depthOrRightImage;
|
||||
|
||||
@@ -54,6 +54,9 @@ public:
|
||||
Signature();
|
||||
Signature(int id,
|
||||
int mapId,
|
||||
int weight,
|
||||
double stamp,
|
||||
const std::string & label,
|
||||
const std::multimap<int, cv::KeyPoint> & words,
|
||||
const std::multimap<int, pcl::PointXYZ> & words3,
|
||||
const Transform & pose = Transform(),
|
||||
@@ -76,9 +79,14 @@ public:
|
||||
int id() const {return _id;}
|
||||
int mapId() const {return _mapId;}
|
||||
|
||||
void setWeight(int weight) {if(_weight!=weight)_modified=true;_weight = weight;}
|
||||
void setWeight(int weight) {_modified=_weight!=weight;_weight = weight;}
|
||||
int getWeight() const {return _weight;}
|
||||
|
||||
void setLabel(const std::string & label) {_modified=_label.compare(label)!=0;_label = label;}
|
||||
const std::string & getLabel() const {return _label;}
|
||||
|
||||
double getStamp() const {return _stamp;}
|
||||
|
||||
void addLinks(const std::list<Link> & links);
|
||||
void addLinks(const std::map<int, Link> & links);
|
||||
void addLink(const Link & link);
|
||||
@@ -141,8 +149,10 @@ public:
|
||||
private:
|
||||
int _id;
|
||||
int _mapId;
|
||||
double _stamp;
|
||||
std::map<int, Link> _links; // id, transform
|
||||
int _weight;
|
||||
std::string _label;
|
||||
bool _saved; // If it's saved to bd
|
||||
bool _modified;
|
||||
bool _linksModified; // Optimization when updating signatures in database
|
||||
|
||||
Reference in New Issue
Block a user