mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Tango #57: Increased version to 0.11.3, updated Post-Processing actions, added mesh rendering actions, fixed point cloud rendering
This commit is contained in:
@@ -61,14 +61,24 @@ void DBDriver::parseParameters(const ParametersMap & parameters)
|
||||
{
|
||||
}
|
||||
|
||||
void DBDriver::closeConnection()
|
||||
void DBDriver::closeConnection(bool save)
|
||||
{
|
||||
UDEBUG("isRunning=%d", this->isRunning());
|
||||
this->join(true);
|
||||
UDEBUG("");
|
||||
this->emptyTrashes();
|
||||
if(save)
|
||||
{
|
||||
this->emptyTrashes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_trashesMutex.lock();
|
||||
_trashSignatures.clear();
|
||||
_trashVisualWords.clear();
|
||||
_trashesMutex.unlock();
|
||||
}
|
||||
_dbSafeAccessMutex.lock();
|
||||
this->disconnectDatabaseQuery();
|
||||
this->disconnectDatabaseQuery(save);
|
||||
_dbSafeAccessMutex.unlock();
|
||||
UDEBUG("");
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ bool DBDriverSqlite3::connectDatabaseQuery(const std::string & url, bool overwri
|
||||
|
||||
return true;
|
||||
}
|
||||
void DBDriverSqlite3::disconnectDatabaseQuery()
|
||||
void DBDriverSqlite3::disconnectDatabaseQuery(bool save)
|
||||
{
|
||||
UDEBUG("");
|
||||
if(_ppDb)
|
||||
@@ -398,7 +398,7 @@ void DBDriverSqlite3::disconnectDatabaseQuery()
|
||||
}
|
||||
}
|
||||
|
||||
if(_dbInMemory)
|
||||
if(save && _dbInMemory)
|
||||
{
|
||||
UTimer timer;
|
||||
timer.start();
|
||||
@@ -1049,8 +1049,6 @@ bool DBDriverSqlite3::getCalibrationQuery(
|
||||
const void * data = 0;
|
||||
int dataSize = 0;
|
||||
Transform localTransform;
|
||||
StereoCameraModel stereoModel;
|
||||
std::vector<CameraModel> models;
|
||||
|
||||
// Process the result if one
|
||||
rc = sqlite3_step(ppStmt);
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
void setTempStore(int tempStore);
|
||||
|
||||
private:
|
||||
virtual bool connectDatabaseQuery(const std::string & url, bool overwirtten = false);
|
||||
virtual void disconnectDatabaseQuery();
|
||||
virtual bool connectDatabaseQuery(const std::string & url, bool overwritten = false);
|
||||
virtual void disconnectDatabaseQuery(bool save = true);
|
||||
virtual bool isConnectedQuery() const;
|
||||
virtual long getMemoryUsedQuery() const; // In bytes
|
||||
virtual bool getDatabaseVersionQuery(std::string & version) const;
|
||||
|
||||
@@ -313,7 +313,7 @@ void Memory::close(bool databaseSaved, bool postInitClosingEvents)
|
||||
if(_dbDriver)
|
||||
{
|
||||
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(uFormat("Closing database \"%s\"...", _dbDriver->getUrl().c_str())));
|
||||
_dbDriver->closeConnection();
|
||||
_dbDriver->closeConnection(false);
|
||||
delete _dbDriver;
|
||||
_dbDriver = 0;
|
||||
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit("Closing database, done!"));
|
||||
@@ -2327,7 +2327,7 @@ Transform Memory::computeIcpTransformMulti(
|
||||
return t;
|
||||
}
|
||||
|
||||
bool Memory::addLink(const Link & link)
|
||||
bool Memory::addLink(const Link & link, bool addInDatabase)
|
||||
{
|
||||
UASSERT(link.type() > Link::kNeighbor && link.type() != Link::kUndef);
|
||||
|
||||
@@ -2378,9 +2378,8 @@ bool Memory::addLink(const Link & link)
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else if(!addInDatabase)
|
||||
{
|
||||
if(!fromS)
|
||||
{
|
||||
@@ -2390,8 +2389,27 @@ bool Memory::addLink(const Link & link)
|
||||
{
|
||||
UERROR("from=%d, to=%d, Signature %d not found in working/st memories", link.from(), link.to(), link.to());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
else if(fromS)
|
||||
{
|
||||
UDEBUG("Add link between %d and %d (db)", link.from(), link.to());
|
||||
fromS->addLink(link);
|
||||
_dbDriver->addLink(link.inverse());
|
||||
}
|
||||
else if(toS)
|
||||
{
|
||||
UDEBUG("Add link between %d (db) and %d", link.from(), link.to());
|
||||
_dbDriver->addLink(link);
|
||||
toS->addLink(link.inverse());
|
||||
}
|
||||
else
|
||||
{
|
||||
UDEBUG("Add link between %d (db) and %d (db)", link.from(), link.to());
|
||||
_dbDriver->addLink(link);
|
||||
_dbDriver->addLink(link.inverse());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Memory::updateLink(int fromId, int toId, const Transform & transform, float rotVariance, float transVariance)
|
||||
|
||||
@@ -612,6 +612,7 @@ std::map<int, Transform> OptimizerG2O::optimizeBA(
|
||||
else
|
||||
{
|
||||
UERROR("Missing calibration for node %d", iter->first);
|
||||
return optimizedPoses;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -699,6 +700,7 @@ std::map<int, Transform> OptimizerG2O::optimizeBA(
|
||||
{
|
||||
delete e;
|
||||
UERROR("Map: Failed adding constraint between %d and %d, skipping", id1, id2);
|
||||
return optimizedPoses;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3277,12 +3277,12 @@ int Rtabmap::detectMoreLoopClosures(float clusterRadius, float clusterAngle, int
|
||||
if(_graphOptimizer->iterations() <= 0)
|
||||
{
|
||||
UERROR("Cannot detect more loop closures if graph optimization iterations = 0");
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
if(!_rgbdSlamMode)
|
||||
{
|
||||
UERROR("Detecting more loop closures can be done only in RGBD-SLAM mode.");
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::list<Link> loopClosuresAdded;
|
||||
@@ -3317,21 +3317,11 @@ int Rtabmap::detectMoreLoopClosures(float clusterRadius, float clusterAngle, int
|
||||
to = iter->first;
|
||||
}
|
||||
|
||||
bool alreadyChecked = false;
|
||||
for(std::multimap<int, int>::iterator jter = checkedLoopClosures.lower_bound(from);
|
||||
!alreadyChecked && jter!=checkedLoopClosures.end() && jter->first == from;
|
||||
++jter)
|
||||
{
|
||||
if(to == jter->second)
|
||||
{
|
||||
alreadyChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!alreadyChecked)
|
||||
if(rtabmap::graph::findLink(checkedLoopClosures, from, to) == checkedLoopClosures.end())
|
||||
{
|
||||
// only add new links and one per cluster per iteration
|
||||
if(addedLinks.find(from) == addedLinks.end() &&
|
||||
addedLinks.find(to) == addedLinks.end() &&
|
||||
rtabmap::graph::findLink(links, from, to) == links.end())
|
||||
{
|
||||
checkedLoopClosures.insert(std::make_pair(from, to));
|
||||
@@ -3371,7 +3361,7 @@ int Rtabmap::detectMoreLoopClosures(float clusterRadius, float clusterAngle, int
|
||||
{
|
||||
UERROR("Optimization failed! Rejecting all loop closures...");
|
||||
loopClosuresAdded.clear();
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
UINFO("Optimizing graph with new links... done!");
|
||||
}
|
||||
@@ -3382,7 +3372,7 @@ int Rtabmap::detectMoreLoopClosures(float clusterRadius, float clusterAngle, int
|
||||
{
|
||||
for(std::list<Link>::iterator iter=loopClosuresAdded.begin(); iter!=loopClosuresAdded.end(); ++iter)
|
||||
{
|
||||
_memory->addLink(*iter);
|
||||
_memory->addLink(*iter, true);
|
||||
}
|
||||
}
|
||||
return (int)loopClosuresAdded.size();
|
||||
|
||||
Reference in New Issue
Block a user