mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-09 04:50:20 +08:00
Tango: fixed database saved in memory option when disabled (now disabled by default)
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
|
||||
#######################
|
||||
SET(RTABMAP_MAJOR_VERSION 0)
|
||||
SET(RTABMAP_MINOR_VERSION 14)
|
||||
SET(RTABMAP_PATCH_VERSION 1)
|
||||
SET(RTABMAP_PATCH_VERSION 2)
|
||||
SET(RTABMAP_VERSION
|
||||
${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_VERSION})
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- BEGIN_INCLUDE(manifest) -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.introlab.rtabmap"
|
||||
android:versionCode="61"
|
||||
android:versionCode="62"
|
||||
android:versionName="@RTABMAP_VERSION@">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
@@ -429,7 +429,9 @@ void CameraTango::close()
|
||||
{
|
||||
TangoConfig_free(tango_config_);
|
||||
tango_config_ = nullptr;
|
||||
LOGI("TangoService_disconnect()");
|
||||
TangoService_disconnect();
|
||||
LOGI("TangoService_disconnect() done.");
|
||||
}
|
||||
previousPose_.setNull();
|
||||
previousStamp_ = 0.0;
|
||||
|
||||
@@ -93,7 +93,6 @@ rtabmap::ParametersMap RTABMapApp::getRtabmapParameters()
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kKpParallelized(), std::string("false")));
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kKpMaxDepth(), std::string("10"))); // to avoid extracting features in invalid depth (as we compute transformation directly from the words)
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kRGBDOptimizeFromGraphEnd(), std::string("true")));
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kDbSqlite3InMemory(), std::string("true")));
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kVisMinInliers(), std::string("25")));
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kVisEstimationType(), std::string("0"))); // 0=3D-3D 1=PnP
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kRGBDOptimizeMaxError(), std::string("0.1")));
|
||||
@@ -185,8 +184,9 @@ RTABMapApp::RTABMapApp() :
|
||||
lastDrawnCloudsCount_(0),
|
||||
renderingTime_(0.0f),
|
||||
lastPostRenderEventTime_(0.0),
|
||||
processMemoryUsedBytes(0),
|
||||
processGPUMemoryUsedBytes(0),
|
||||
processMemoryUsedBytes_(0),
|
||||
processGPUMemoryUsedBytes_(0),
|
||||
databaseInMemory_(false),
|
||||
visualizingMesh_(false),
|
||||
exportedMeshUpdated_(false),
|
||||
optMesh_(new pcl::TextureMesh),
|
||||
@@ -238,8 +238,8 @@ void RTABMapApp::onCreate(JNIEnv* env, jobject caller_activity)
|
||||
lastDrawnCloudsCount_ = 0;
|
||||
renderingTime_ = 0.0f;
|
||||
lastPostRenderEventTime_ = 0.0;
|
||||
processMemoryUsedBytes = 0;
|
||||
processGPUMemoryUsedBytes = 0;
|
||||
processMemoryUsedBytes_ = 0;
|
||||
processGPUMemoryUsedBytes_ = 0;
|
||||
bufferedStatsData_.clear();
|
||||
progressionStatus_.setJavaObjects(jvm, RTABMapActivity);
|
||||
main_scene_.setBackgroundColor(backgroundColor_, backgroundColor_, backgroundColor_);
|
||||
@@ -379,6 +379,7 @@ int RTABMapApp::openDatabase(const std::string & databasePath, bool databaseInMe
|
||||
parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kDbSqlite3InMemory(), uBool2Str(databaseInMemory)));
|
||||
LOGI("Initializing database...");
|
||||
rtabmap_->init(parameters, databasePath);
|
||||
databaseInMemory_ = databaseInMemory;
|
||||
rtabmapThread_ = new rtabmap::RtabmapThread(rtabmap_);
|
||||
if(parameters.find(rtabmap::Parameters::kRtabmapDetectionRate()) != parameters.end())
|
||||
{
|
||||
@@ -483,14 +484,12 @@ int RTABMapApp::openDatabase(const std::string & databasePath, bool databaseInMe
|
||||
status=-2;
|
||||
}
|
||||
const rtabmap::Signature & s = signatures.at(id);
|
||||
processMemoryUsedBytes += data.imageCompressed().total();
|
||||
processMemoryUsedBytes += data.depthOrRightCompressed().total();
|
||||
processMemoryUsedBytes += data.laserScanCompressed().total();
|
||||
processMemoryUsedBytes += s.getWords().size()*4*8;
|
||||
processMemoryUsedBytes += s.getWords3().size()*4*4;
|
||||
if(!s.getWordsDescriptors().empty())
|
||||
processMemoryUsedBytes_ += s.getMemoryUsed(databaseInMemory_);
|
||||
if(databaseInMemory_)
|
||||
{
|
||||
processMemoryUsedBytes +=s.getWordsDescriptors().size()*(4+s.getWordsDescriptors().begin()->second.total());
|
||||
processMemoryUsedBytes_ -= s.sensorData().imageRaw().total() * s.sensorData().imageRaw().elemSize();
|
||||
processMemoryUsedBytes_ -= s.sensorData().depthOrRightRaw().total() * s.sensorData().depthOrRightRaw().elemSize();
|
||||
processMemoryUsedBytes_ -= s.sensorData().laserScanRaw().total() * s.sensorData().laserScanRaw().elemSize();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1162,8 +1161,8 @@ int RTABMapApp::Render()
|
||||
lastDrawnCloudsCount_ = 0;
|
||||
renderingTime_ = 0.0f;
|
||||
lastPostRenderEventTime_ = 0.0;
|
||||
processMemoryUsedBytes = 0;
|
||||
processGPUMemoryUsedBytes = 0;
|
||||
processMemoryUsedBytes_ = 0;
|
||||
processGPUMemoryUsedBytes_ = 0;
|
||||
bufferedStatsData_.clear();
|
||||
}
|
||||
|
||||
@@ -1177,7 +1176,7 @@ int RTABMapApp::Render()
|
||||
if(added.size() != meshes)
|
||||
{
|
||||
LOGI("added (%d) != meshes (%d)", (int)added.size(), meshes);
|
||||
processGPUMemoryUsedBytes = 0;
|
||||
processGPUMemoryUsedBytes_= 0;
|
||||
boost::mutex::scoped_lock lockRtabmap(rtabmapMutex_);
|
||||
UASSERT(rtabmap_!=0);
|
||||
for(std::map<int, Mesh>::iterator iter=createdMeshes_.begin(); iter!=createdMeshes_.end(); ++iter)
|
||||
@@ -1212,14 +1211,23 @@ int RTABMapApp::Render()
|
||||
main_scene_.addMesh(iter->first, iter->second, opengl_world_T_rtabmap_world*iter->second.pose);
|
||||
main_scene_.setCloudVisible(iter->first, iter->second.visible);
|
||||
|
||||
long estimateGPUMem = 0;
|
||||
estimateGPUMem += iter->second.cloud->size()*16; // 3*float + 1 float rgb
|
||||
estimateGPUMem += iter->second.indices->size()*4; // int
|
||||
estimateGPUMem += iter->second.polygons.size()*4*3; // 3 indices per polygon
|
||||
estimateGPUMem += iter->second.polygonsLowRes.size()*4*3; // 3 indices per polygon
|
||||
|
||||
processGPUMemoryUsedBytes += estimateGPUMem + (iter->second.texture.empty()?0:iter->second.polygons.size()*3*8+iter->second.texture.total());
|
||||
long processCPUMemoryUsed = 0;
|
||||
processCPUMemoryUsed += iter->second.cloud->size()*4*4; // 3*float + 1 float rgb
|
||||
processCPUMemoryUsed += iter->second.indices->size()*4; // int
|
||||
processCPUMemoryUsed += iter->second.polygons.size()*4*3; // 3 indices per polygon
|
||||
processCPUMemoryUsed += iter->second.polygonsLowRes.size()*4*3; // 3 indices per polygon
|
||||
|
||||
processGPUMemoryUsedBytes_ += iter->second.cloud->size()*4; // organized indices to dense
|
||||
processGPUMemoryUsedBytes_ += processCPUMemoryUsed; // mostly copy all data
|
||||
processGPUMemoryUsedBytes_ += iter->second.polygons.size()*4*2*3; // 2 int indices per line (3 lines per polygon)
|
||||
processGPUMemoryUsedBytes_ += iter->second.polygonsLowRes.size()*4*2*3; // 2 int indices per line (3 lines per polygon)
|
||||
processGPUMemoryUsedBytes_ += (iter->second.cloud->width/2*iter->second.cloud->height/2)*4; // low dec
|
||||
processGPUMemoryUsedBytes_ += (iter->second.cloud->width/4*iter->second.cloud->height/4)*4; // low low dec
|
||||
if(!iter->second.texture.empty())
|
||||
{
|
||||
processGPUMemoryUsedBytes_ += iter->second.texture.total()*sizeof(float); // single float rgb per pixel
|
||||
processGPUMemoryUsedBytes_ += iter->second.cloud->size()*4*2; // 2*float, texCoords
|
||||
}
|
||||
iter->second.texture = cv::Mat(); // don't keep textures in memory
|
||||
}
|
||||
}
|
||||
@@ -1244,7 +1252,7 @@ int RTABMapApp::Render()
|
||||
|
||||
// update buffered signatures
|
||||
std::map<int, rtabmap::SensorData> bufferedSensorData;
|
||||
if(!trajectoryMode_ && !dataRecorderMode_)
|
||||
if(!dataRecorderMode_)
|
||||
{
|
||||
for(std::list<rtabmap::RtabmapEvent*>::iterator iter=rtabmapEvents.begin(); iter!=rtabmapEvents.end(); ++iter)
|
||||
{
|
||||
@@ -1256,29 +1264,27 @@ int RTABMapApp::Render()
|
||||
int rehearsalMerged = (int)uValue(stats.data(), rtabmap::Statistics::kMemoryRehearsal_merged(), 0.0f);
|
||||
if(smallMovement == 0 && rehearsalMerged == 0 && fastMovement == 0)
|
||||
{
|
||||
for(std::map<int, rtabmap::Signature>::const_iterator jter=stats.getSignatures().begin(); jter!=stats.getSignatures().end(); ++jter)
|
||||
if(stats.getSignatures().size())
|
||||
{
|
||||
bool dataDetected = false;
|
||||
if(!jter->second.sensorData().imageRaw().empty() &&
|
||||
!jter->second.sensorData().depthRaw().empty())
|
||||
int id = stats.getSignatures().rbegin()->first;
|
||||
const rtabmap::Signature & s = stats.getSignatures().rbegin()->second;
|
||||
|
||||
if(!localizationMode_)
|
||||
{
|
||||
if(!localizationMode_)
|
||||
if(!trajectoryMode_ &&
|
||||
!s.sensorData().imageRaw().empty() &&
|
||||
!s.sensorData().depthRaw().empty())
|
||||
{
|
||||
uInsert(bufferedSensorData, std::make_pair(jter->first, jter->second.sensorData()));
|
||||
uInsert(rawPoses_, std::make_pair(jter->first, jter->second.getPose()));
|
||||
dataDetected = true;
|
||||
uInsert(bufferedSensorData, std::make_pair(id, s.sensorData()));
|
||||
}
|
||||
}
|
||||
if(dataDetected)
|
||||
{
|
||||
processMemoryUsedBytes += jter->second.sensorData().imageCompressed().total();
|
||||
processMemoryUsedBytes += jter->second.sensorData().depthOrRightCompressed().total();
|
||||
processMemoryUsedBytes += jter->second.sensorData().laserScanCompressed().total();
|
||||
processMemoryUsedBytes += jter->second.getWords().size()*4*8;
|
||||
processMemoryUsedBytes += jter->second.getWords3().size()*4*4;
|
||||
if(!jter->second.getWordsDescriptors().empty())
|
||||
|
||||
uInsert(rawPoses_, std::make_pair(id, s.getPose()));
|
||||
processMemoryUsedBytes_ += s.getMemoryUsed(databaseInMemory_);
|
||||
if(databaseInMemory_)
|
||||
{
|
||||
processMemoryUsedBytes += jter->second.getWordsDescriptors().size()*(4+jter->second.getWordsDescriptors().begin()->second.total());
|
||||
processMemoryUsedBytes_ -= s.sensorData().imageRaw().total() * s.sensorData().imageRaw().elemSize();
|
||||
processMemoryUsedBytes_ -= s.sensorData().depthOrRightRaw().total() * s.sensorData().depthOrRightRaw().elemSize();
|
||||
processMemoryUsedBytes_ -= s.sensorData().laserScanRaw().total() * s.sensorData().laserScanRaw().elemSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1308,6 +1314,7 @@ int RTABMapApp::Render()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RENDERING_PERFORMANCE
|
||||
LOGW("Looking fo data to load (%d) %fs", bufferedSensorData.size(), time.ticks());
|
||||
#endif
|
||||
@@ -1443,13 +1450,24 @@ int RTABMapApp::Render()
|
||||
#ifdef DEBUG_RENDERING_PERFORMANCE
|
||||
LOGW("Adding mesh to scene: %fs", time.ticks());
|
||||
#endif
|
||||
long estimateCPUMem = 0;
|
||||
estimateCPUMem += mesh.cloud->size()*16; // 3*float + 1 float rgb
|
||||
estimateCPUMem += mesh.indices->size()*4; // int
|
||||
estimateCPUMem += mesh.polygons.size()*4*3; // 3 indices per polygon
|
||||
long processCPUMemoryUsed = 0;
|
||||
processCPUMemoryUsed += mesh.cloud->size()*4*4; // 3*float + 1 float rgb
|
||||
processCPUMemoryUsed += mesh.indices->size()*4; // int
|
||||
processCPUMemoryUsed += mesh.polygons.size()*4*3; // 3 indices per polygon
|
||||
processCPUMemoryUsed += mesh.polygonsLowRes.size()*4*3; // 3 indices per polygon
|
||||
processMemoryUsedBytes_ += processCPUMemoryUsed;
|
||||
|
||||
processMemoryUsedBytes += estimateCPUMem;
|
||||
processGPUMemoryUsedBytes += estimateCPUMem + (mesh.texture.empty()?0:mesh.polygons.size()*3*8+mesh.texture.total());
|
||||
processGPUMemoryUsedBytes_ += mesh.cloud->size()*4; // organized indices to dense
|
||||
processGPUMemoryUsedBytes_ += processCPUMemoryUsed; // mostly copy all data
|
||||
processGPUMemoryUsedBytes_ += mesh.polygons.size()*4*2*3; // 2 int indices per line (3 lines per polygon)
|
||||
processGPUMemoryUsedBytes_ += mesh.polygonsLowRes.size()*4*2*3; // 2 int indices per line (3 lines per polygon)
|
||||
processGPUMemoryUsedBytes_ += (mesh.cloud->width/2*mesh.cloud->height/2)*4; // low dec
|
||||
processGPUMemoryUsedBytes_ += (mesh.cloud->width/4*mesh.cloud->height/4)*4; // low low dec
|
||||
if(!mesh.texture.empty())
|
||||
{
|
||||
processGPUMemoryUsedBytes_ += mesh.texture.total()*sizeof(float); // single float rgb per pixel
|
||||
processGPUMemoryUsedBytes_ += mesh.cloud->size()*4*2; // 2*float, texCoords
|
||||
}
|
||||
mesh.texture = cv::Mat(); // don't keep textures in memory
|
||||
}
|
||||
}
|
||||
@@ -1718,7 +1736,7 @@ void RTABMapApp::setPausedMapping(bool paused)
|
||||
if(paused_)
|
||||
{
|
||||
LOGW("Pause!");
|
||||
camera_->kill();
|
||||
camera_->join(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3253,7 +3271,7 @@ bool RTABMapApp::handleEvent(UEvent * event)
|
||||
updateTime,
|
||||
loopClosureId,
|
||||
highestHypId,
|
||||
(int)((processMemoryUsedBytes+processGPUMemoryUsedBytes)/(1024*1024)),
|
||||
(int)((processMemoryUsedBytes_+processGPUMemoryUsedBytes_+databaseMemoryUsed)/(1024*1024)),
|
||||
databaseMemoryUsed,
|
||||
inliers,
|
||||
matches,
|
||||
|
||||
@@ -228,9 +228,10 @@ class RTABMapApp : public UEventsHandler {
|
||||
int lastDrawnCloudsCount_;
|
||||
float renderingTime_;
|
||||
double lastPostRenderEventTime_;
|
||||
long processMemoryUsedBytes;
|
||||
long processGPUMemoryUsedBytes;
|
||||
long processMemoryUsedBytes_;
|
||||
long processGPUMemoryUsedBytes_;
|
||||
std::map<std::string, float> bufferedStatsData_;
|
||||
bool databaseInMemory_;
|
||||
|
||||
bool visualizingMesh_;
|
||||
bool exportedMeshUpdated_;
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<string name="pref_key_gps_saved">pref_key_gps_saved</string>
|
||||
<string name="pref_default_gps_saved">false</string>
|
||||
<string name="pref_key_db_in_memory">pref_key_db_in_memory</string>
|
||||
<string name="pref_default_db_in_memory">true</string>
|
||||
<string name="pref_default_db_in_memory">false</string>
|
||||
|
||||
<string name="pref_key_cloud_voxel">pref_key_cloud_voxel</string>
|
||||
<string name="pref_default_cloud_voxel">0.01</string>
|
||||
|
||||
@@ -237,7 +237,9 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
|
||||
private AlertDialog mMemoryWarningDialog = null;
|
||||
|
||||
private String[] mStatusTexts = new String[16];
|
||||
private final int STATUS_TEXTS_SIZE = 18;
|
||||
private final int STATUS_TEXTS_POSE_INDEX = 5;
|
||||
private String[] mStatusTexts = new String[STATUS_TEXTS_SIZE];
|
||||
|
||||
GestureDetector mGesDetect = null;
|
||||
|
||||
@@ -998,11 +1000,11 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
}
|
||||
else if((mItemStatusVisibility.isChecked() || mState == State.STATE_VISUALIZING_WHILE_LOADING))
|
||||
{
|
||||
mRenderer.updateTexts(Arrays.copyOfRange(mStatusTexts, 0, 4));
|
||||
mRenderer.updateTexts(Arrays.copyOfRange(mStatusTexts, 0, STATUS_TEXTS_POSE_INDEX-1));
|
||||
}
|
||||
else if(mItemDebugVisibility.isChecked())
|
||||
{
|
||||
mRenderer.updateTexts(Arrays.copyOfRange(mStatusTexts, 5, mStatusTexts.length));
|
||||
mRenderer.updateTexts(Arrays.copyOfRange(mStatusTexts, STATUS_TEXTS_POSE_INDEX-1, mStatusTexts.length));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1165,7 +1167,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
{
|
||||
if(!DISABLE_LOG) Log.i(TAG, String.format("updateStatsCallback()"));
|
||||
|
||||
final String[] statusTexts = new String[19];
|
||||
final String[] statusTexts = new String[STATUS_TEXTS_SIZE];
|
||||
if(mButtonPause!=null && !mButtonPause.isChecked())
|
||||
{
|
||||
String updateValue = mUpdateRate.compareTo("0")==0?"Max":mUpdateRate;
|
||||
@@ -1175,16 +1177,13 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
{
|
||||
statusTexts[0] = mStatusTexts[0];
|
||||
}
|
||||
|
||||
// getNativeHeapAllocatedSize() is too slow, so we need to use the estimate.
|
||||
// Multiply by 3/2 to match getNativeHeapAllocatedSize()
|
||||
final int adjustedMemoryUsed = (processMemoryUsed*3)/2;
|
||||
|
||||
|
||||
if(mButtonPause!=null)
|
||||
{
|
||||
if(!mButtonPause.isChecked())
|
||||
{
|
||||
statusTexts[1] = getString(R.string.memory)+adjustedMemoryUsed;
|
||||
// getNativeHeapAllocatedSize() is too slow, so we need to use the estimate.
|
||||
statusTexts[1] = getString(R.string.memory)+processMemoryUsed;
|
||||
}
|
||||
else if(mState == State.STATE_PROCESSING)
|
||||
{
|
||||
@@ -1238,10 +1237,9 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
String formattedDate = new SimpleDateFormat("HH:mm:ss.SSS").format(new Date());
|
||||
statusTexts[4] = getString(R.string.time)+formattedDate;
|
||||
|
||||
int index = 5;
|
||||
int index = STATUS_TEXTS_POSE_INDEX;
|
||||
statusTexts[index++] = getString(R.string.nodes)+nodes+" (" + nodesDrawn + " shown)";
|
||||
statusTexts[index++] = getString(R.string.words)+words;
|
||||
statusTexts[index++] = getString(R.string.database_size)+databaseMemoryUsed;
|
||||
statusTexts[index++] = getString(R.string.points)+points;
|
||||
statusTexts[index++] = getString(R.string.polygons)+polygons;
|
||||
statusTexts[index++] = getString(R.string.update_time)+(int)(updateTime) + " / " + (mTimeThr.compareTo("0")==0?"No Limit":mTimeThr);
|
||||
@@ -1256,7 +1254,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
updateStatsUI(adjustedMemoryUsed, loopClosureId, inliers, matches, rejected, optimizationMaxError, fastMovement!=0, statusTexts);
|
||||
updateStatsUI(processMemoryUsed, loopClosureId, inliers, matches, rejected, optimizationMaxError, fastMovement!=0, statusTexts);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1920,11 +1918,10 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
{
|
||||
mTotalLoopClosures = 0;
|
||||
|
||||
int index = 4;
|
||||
int index = STATUS_TEXTS_POSE_INDEX;
|
||||
mMapNodes = 0;
|
||||
mStatusTexts[index++] = getString(R.string.nodes)+0;
|
||||
mStatusTexts[index++] = getString(R.string.words)+0;
|
||||
mStatusTexts[index++] = getString(R.string.database_size)+0;
|
||||
mStatusTexts[index++] = getString(R.string.points)+0;
|
||||
mStatusTexts[index++] = getString(R.string.polygons)+0;
|
||||
mStatusTexts[index++] = getString(R.string.update_time)+0;
|
||||
@@ -1934,13 +1931,14 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
mStatusTexts[index++] = getString(R.string.inliers)+0;
|
||||
mStatusTexts[index++] = getString(R.string.hypothesis)+0;
|
||||
mStatusTexts[index++] = getString(R.string.fps)+0;
|
||||
mStatusTexts[index++] = getString(R.string.distance)+0;
|
||||
mStatusTexts[index++] = String.format("Pose (x,y,z): 0 0 0");
|
||||
updateStatusTexts();
|
||||
|
||||
mOpenedDatabasePath = "";
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean databaseInMemory = sharedPref.getBoolean(getString(R.string.pref_key_db_in_memory), Boolean.parseBoolean(getString(R.string.pref_default_db_in_memory)));
|
||||
String tmpDatabase = mWorkingDirectory+RTABMAP_TMP_DB;
|
||||
(new File(tmpDatabase)).delete();
|
||||
RTABMapLib.openDatabase(tmpDatabase, databaseInMemory, false);
|
||||
|
||||
mMapIsEmpty = true;
|
||||
@@ -1959,11 +1957,10 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// reset
|
||||
mTotalLoopClosures = 0;
|
||||
int index = 4;
|
||||
int index = STATUS_TEXTS_POSE_INDEX;
|
||||
mMapNodes = 0;
|
||||
mStatusTexts[index++] = getString(R.string.nodes)+0;
|
||||
mStatusTexts[index++] = getString(R.string.words)+0;
|
||||
mStatusTexts[index++] = getString(R.string.database_size)+0;
|
||||
mStatusTexts[index++] = getString(R.string.points)+0;
|
||||
mStatusTexts[index++] = getString(R.string.polygons)+0;
|
||||
mStatusTexts[index++] = getString(R.string.update_time)+0;
|
||||
@@ -1973,6 +1970,8 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
mStatusTexts[index++] = getString(R.string.inliers)+0;
|
||||
mStatusTexts[index++] = getString(R.string.hypothesis)+0;
|
||||
mStatusTexts[index++] = getString(R.string.fps)+0;
|
||||
mStatusTexts[index++] = getString(R.string.distance)+0;
|
||||
mStatusTexts[index++] = String.format("Pose (x,y,z): 0 0 0");
|
||||
updateStatusTexts();
|
||||
|
||||
mItemDataRecorderMode.setChecked(!dataRecorderOldState);
|
||||
@@ -1982,7 +1981,6 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
boolean databaseInMemory = sharedPref.getBoolean(getString(R.string.pref_key_db_in_memory), Boolean.parseBoolean(getString(R.string.pref_default_db_in_memory)));
|
||||
String tmpDatabase = mWorkingDirectory+RTABMAP_TMP_DB;
|
||||
(new File(tmpDatabase)).delete();
|
||||
RTABMapLib.openDatabase(tmpDatabase, databaseInMemory, false);
|
||||
|
||||
mItemOpen.setEnabled(!mItemDataRecorderMode.isChecked() && mButtonPause.isChecked());
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
virtual ~DBDriver();
|
||||
|
||||
virtual void parseParameters(const ParametersMap & parameters);
|
||||
virtual bool isInMemory() const {return _url.empty();}
|
||||
const std::string & getUrl() const {return _url;}
|
||||
|
||||
void beginTransaction() const;
|
||||
|
||||
@@ -134,6 +134,7 @@ public:
|
||||
const std::map<int, Transform> & optimizedPoses,
|
||||
int maxGraphDepth) const;
|
||||
void deleteLocation(int locationId, std::list<int> * deletedWords = 0);
|
||||
void saveLocationData(int locationId);
|
||||
void removeLink(int idA, int idB);
|
||||
void removeRawData(int id, bool image = true, bool scan = true, bool userData = true);
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@ public:
|
||||
const GPS & gps() const {return gps_;}
|
||||
|
||||
long getMemoryUsed() const; // Return memory usage in Bytes
|
||||
void clearCompressedData() {_imageCompressed=cv::Mat(); _depthOrRightCompressed=cv::Mat(); _laserScanCompressed=cv::Mat(); _userDataCompressed=cv::Mat();}
|
||||
|
||||
private:
|
||||
int _id;
|
||||
|
||||
@@ -134,6 +134,8 @@ public:
|
||||
SensorData & sensorData() {return _sensorData;}
|
||||
const SensorData & sensorData() const {return _sensorData;}
|
||||
|
||||
long getMemoryUsed(bool withSensorData=true) const; // Return memory usage in Bytes
|
||||
|
||||
private:
|
||||
int _id;
|
||||
int _mapId;
|
||||
|
||||
@@ -187,6 +187,7 @@ void DBDriverSqlite3::setTempStore(int tempStore)
|
||||
|
||||
void DBDriverSqlite3::setDbInMemory(bool dbInMemory)
|
||||
{
|
||||
UDEBUG("dbInMemory=%d", dbInMemory?1:0);
|
||||
if(dbInMemory != _dbInMemory)
|
||||
{
|
||||
if(this->isConnected())
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
virtual ~DBDriverSqlite3();
|
||||
|
||||
virtual void parseParameters(const ParametersMap & parameters);
|
||||
virtual bool isInMemory() const {return getUrl().empty() || _dbInMemory;}
|
||||
void setDbInMemory(bool dbInMemory);
|
||||
void setJournalMode(int journalMode);
|
||||
void setCacheSize(unsigned int cacheSize);
|
||||
|
||||
@@ -439,7 +439,7 @@ void FlannIndex::knnSearch(
|
||||
indices.create(query.rows, knn, CV_32S);
|
||||
dists.create(query.rows, knn, featuresType_ == CV_8UC1?CV_32S:CV_32F);
|
||||
|
||||
rtflann::Matrix<int> indicesF((int*)indices.data, indices.rows, indices.cols);
|
||||
rtflann::Matrix<size_t> indicesF((size_t*)indices.data, indices.rows, indices.cols);
|
||||
|
||||
rtflann::SearchParams params = rtflann::SearchParams(checks, eps, sorted);
|
||||
|
||||
|
||||
+31
-2
@@ -316,6 +316,15 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
||||
UWARN("_vwd->getUnusedWordsSize() must be empty... size=%d", _vwd->getUnusedWordsSize());
|
||||
}
|
||||
UDEBUG("Total word references added = %d", _vwd->getTotalActiveReferences());
|
||||
|
||||
if(_lastSignature == 0)
|
||||
{
|
||||
// Memory is empty, save parameters
|
||||
ParametersMap parameters = Parameters::getDefaultParameters();
|
||||
uInsert(parameters, parameters_);
|
||||
UDEBUG("");
|
||||
_dbDriver->addInfoAfterRun(0, 0, 0, 0, 0, parameters);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1275,6 +1284,7 @@ int Memory::getDatabaseMemoryUsed() const
|
||||
{
|
||||
memoryUsed = _dbDriver->getMemoryUsed()/(1024*1024); //Byte to MB
|
||||
}
|
||||
|
||||
return memoryUsed;
|
||||
}
|
||||
|
||||
@@ -2124,6 +2134,25 @@ void Memory::deleteLocation(int locationId, std::list<int> * deletedWords)
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::saveLocationData(int locationId)
|
||||
{
|
||||
UDEBUG("Saving location data %d", locationId);
|
||||
Signature * location = _getSignature(locationId);
|
||||
if( location &&
|
||||
_dbDriver &&
|
||||
!_dbDriver->isInMemory() && // don't push in database if it is also in memory.
|
||||
location->id()>0 &&
|
||||
(_incrementalMemory && !location->isSaved()))
|
||||
{
|
||||
Signature * cpy = new Signature();
|
||||
*cpy = *location;
|
||||
_dbDriver->asyncSave(cpy);
|
||||
|
||||
location->setSaved(true);
|
||||
location->sensorData().clearCompressedData();
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::removeLink(int oldId, int newId)
|
||||
{
|
||||
//this method assumes receiving oldId < newId, if not switch them
|
||||
@@ -2370,7 +2399,7 @@ Transform Memory::computeIcpTransform(
|
||||
|
||||
if(depthsToLoad.size())
|
||||
{
|
||||
_dbDriver->loadNodeData(depthsToLoad);
|
||||
_dbDriver->loadNodeData(depthsToLoad, false, true, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2437,7 +2466,7 @@ Transform Memory::computeIcpTransformMulti(
|
||||
}
|
||||
if(depthToLoad.size() && _dbDriver)
|
||||
{
|
||||
_dbDriver->loadNodeData(depthToLoad);
|
||||
_dbDriver->loadNodeData(depthToLoad, false, true, false, false);
|
||||
}
|
||||
|
||||
Signature * fromS = _getSignature(fromId);
|
||||
|
||||
@@ -2505,6 +2505,10 @@ bool Rtabmap::process(
|
||||
signaturesRemoved.push_back(signature->id());
|
||||
_memory->deleteLocation(signature->id());
|
||||
}
|
||||
else
|
||||
{
|
||||
_memory->saveLocationData(signature->id());
|
||||
}
|
||||
}
|
||||
|
||||
// Pass this point signature should not be used, since it could have been transferred...
|
||||
|
||||
@@ -787,7 +787,10 @@ long SensorData::getMemoryUsed() const // Return memory usage in Bytes
|
||||
_groundCellsCompressed.total()*_groundCellsCompressed.elemSize() +
|
||||
_groundCellsRaw.total()*_groundCellsRaw.elemSize() +
|
||||
_obstacleCellsCompressed.total()*_obstacleCellsCompressed.elemSize() +
|
||||
_obstacleCellsRaw.total()*_obstacleCellsRaw.elemSize();
|
||||
_obstacleCellsRaw.total()*_obstacleCellsRaw.elemSize()+
|
||||
_keypoints.size() * sizeof(float) * 7 +
|
||||
_keypoints3D.size() * sizeof(float)*3 +
|
||||
_descriptors.total()*_descriptors.elemSize();
|
||||
}
|
||||
|
||||
} // namespace rtabmap
|
||||
|
||||
@@ -292,4 +292,20 @@ cv::Mat Signature::getPoseCovariance() const
|
||||
return covariance;
|
||||
}
|
||||
|
||||
long Signature::getMemoryUsed(bool withSensorData) const // Return memory usage in Bytes
|
||||
{
|
||||
long total = _words.size() * sizeof(float) * 8 +
|
||||
_words3.size() * sizeof(float) * 4;
|
||||
if(!_wordsDescriptors.empty())
|
||||
{
|
||||
total += _wordsDescriptors.size() * sizeof(int);
|
||||
total += _wordsDescriptors.size() * _wordsDescriptors.begin()->second.total() * _wordsDescriptors.begin()->second.elemSize();
|
||||
}
|
||||
if(withSensorData)
|
||||
{
|
||||
total+=_sensorData.getMemoryUsed();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
} //namespace rtabmap
|
||||
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int knnSearch(const Matrix<ElementType>& queries,
|
||||
/*int knnSearch(const Matrix<ElementType>& queries,
|
||||
Matrix<int>& indices,
|
||||
Matrix<DistanceType>& dists,
|
||||
size_t knn,
|
||||
@@ -391,7 +391,7 @@ public:
|
||||
}
|
||||
delete[] indices_.ptr();
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>rtabmap</name>
|
||||
<version>0.14.1</version>
|
||||
<version>0.14.2</version>
|
||||
<description>RTAB-Map's standalone library. RTAB-Map is a RGB-D SLAM approach with real-time constraints.</description>
|
||||
<maintainer email="matlabbe@gmail.com">Mathieu Labbe</maintainer>
|
||||
<author>Mathieu Labbe</author>
|
||||
|
||||
Reference in New Issue
Block a user