mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
Reprocess: added -track_changes option. Added rtabmap-dpupdate.
This commit is contained in:
@@ -72,6 +72,14 @@ public:
|
||||
const std::string & getUrl() const {return _url;}
|
||||
const std::string & getTargetVersion() const {return _targetVersion;}
|
||||
|
||||
// Start recording changes made to the database until it is closed, then write a compact
|
||||
// delta of those changes to outputUrl (empty disables). Returns true if recording is
|
||||
// active. Only the SQLite backend supports it (session extension + database version
|
||||
// >= 0.24); other backends return false.
|
||||
// NOTE: recorded changes are held in RAM until the database is closed, so only enable
|
||||
// this when the expected set of changes is small.
|
||||
virtual bool trackDatabaseChanges(const std::string & outputUrl) {(void)outputUrl; return false;}
|
||||
|
||||
void beginTransaction() const;
|
||||
void commit() const;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
typedef struct sqlite3_stmt sqlite3_stmt;
|
||||
typedef struct sqlite3 sqlite3;
|
||||
typedef struct sqlite3_session sqlite3_session;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -49,6 +50,26 @@ public:
|
||||
void setCacheSize(unsigned int cacheSize);
|
||||
void setSynchronous(int synchronous);
|
||||
void setTempStore(int tempStore);
|
||||
// Start recording changes made to the database from now until it is closed, then write
|
||||
// a compact patchset delta to outputUrl (empty disables). Can be called before the
|
||||
// connection is opened or on an already-open connection (e.g. after init(), so the
|
||||
// baseline is the current content). Returns true if recording is active. Only effective
|
||||
// if the build/runtime SQLite has the session extension and the database is version >= 0.24.
|
||||
// NOTE: the SQLite session extension holds ALL recorded changes in RAM until the database
|
||||
// is closed (there is no incremental spill to disk), so only enable this when the expected
|
||||
// set of changes is small (e.g. appending a few sessions), not for rewriting a whole map.
|
||||
virtual bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
|
||||
// Apply a change delta previously written by setTrackChangesOutput() onto the database
|
||||
// at databasePath (which must be the same database, at the same state, the delta was
|
||||
// generated from). The file is decompressed (same codec as the other rtabmap blobs) then
|
||||
// applied with the SQLite session extension. Returns true on success; on failure returns
|
||||
// false and, if errorMsg is not null, sets a human-readable message. Requires a SQLite
|
||||
// library built with the session extension (both at build and runtime).
|
||||
static bool applyChangesFromFile(
|
||||
const std::string & databasePath,
|
||||
const std::string & patchsetPath,
|
||||
std::string * errorMsg = 0);
|
||||
|
||||
protected:
|
||||
virtual bool connectDatabaseQuery(const std::string & url, bool overwritten = false, bool readOnly = false);
|
||||
@@ -197,6 +218,7 @@ private:
|
||||
void loadWordIdsQuery(std::list<Signature *> & signatures) const;
|
||||
void loadLinksQuery(std::list<Signature *> & signatures) const;
|
||||
int loadOrSaveDb(sqlite3 *pInMemory, const std::string & fileName, int isSave) const;
|
||||
void startChangeTracking(); // attach the change-tracking session on the open connection
|
||||
|
||||
protected:
|
||||
sqlite3 * _ppDb;
|
||||
@@ -209,6 +231,12 @@ private:
|
||||
int _journalMode;
|
||||
int _synchronous;
|
||||
int _tempStore;
|
||||
|
||||
// DB change tracking (SQLite session extension). Members are always present to keep
|
||||
// the class layout stable regardless of RTABMAP_WITH_SQLITE3_SESSION; the session is
|
||||
// only created/used when the feature is compiled in and enabled.
|
||||
sqlite3_session * _session;
|
||||
std::string _trackChangesOutput;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ public:
|
||||
int getDatabaseMemoryUsed() const; // in bytes
|
||||
std::string getDatabaseVersion() const;
|
||||
std::string getDatabaseUrl() const;
|
||||
// Record changes made to the database until it is closed, then write a compact delta
|
||||
// to outputUrl (empty disables). Returns true if recording started. See DBDriver.
|
||||
bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
double getDbSavingTime() const;
|
||||
int getMapId(int id, bool lookInDatabase = false) const;
|
||||
Transform getOdomPose(int signatureId, bool lookInDatabase = false) const;
|
||||
|
||||
@@ -146,6 +146,13 @@ public:
|
||||
Transform getPose(int locationId) const;
|
||||
Transform getMapCorrection() const {return _mapCorrection;}
|
||||
const Memory * getMemory() const {return _memory;}
|
||||
// Record changes made to the working database from now until it is closed, then write a
|
||||
// compact delta to outputUrl (empty disables). Call after init(), so the delta reflects
|
||||
// only what is added/modified afterwards. Returns true if recording started (requires the
|
||||
// SQLite session extension and a database version >= 0.24). See DBDriver.
|
||||
// NOTE: recorded changes are held in RAM until the database is closed, so only enable this
|
||||
// when the expected set of changes is small (e.g. appending a few sessions).
|
||||
bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
float getGoalReachedRadius() const {return _goalReachedRadius;}
|
||||
float getLocalRadius() const {return _localRadius;}
|
||||
const Transform & getLastLocalizationPose() const {return _lastLocalizationPose;}
|
||||
|
||||
Reference in New Issue
Block a user