mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Tango: fixed export failing after saving the database
This commit is contained in:
@@ -2020,8 +2020,10 @@ void RTABMapApp::save(const std::string & databasePath)
|
||||
dataRecorderMode_ = dataRecorderModeBackup;
|
||||
}
|
||||
|
||||
std::map<int, rtabmap::Transform> poses = rtabmap_->getLocalOptimizedPoses();
|
||||
rtabmap_->close(true, databasePath);
|
||||
rtabmap_->init(getRtabmapParameters(), dataRecorderMode_?"":databasePath);
|
||||
rtabmap_->setOptimizedPoses(poses);
|
||||
if(dataRecorderMode_)
|
||||
{
|
||||
clearSceneOnNextRender_ = true;
|
||||
@@ -2057,6 +2059,13 @@ bool RTABMapApp::exportMesh(
|
||||
// make sure createdMeshes_ is not modified while exporting! We don't
|
||||
// lock the meshesMutex_ because we want to continue rendering.
|
||||
|
||||
std::map<int, rtabmap::Transform> poses = rtabmap_->getLocalOptimizedPoses();
|
||||
if(poses.empty())
|
||||
{
|
||||
UERROR("Empty optimized poses!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(blockRendering)
|
||||
{
|
||||
renderingMutex_.lock();
|
||||
@@ -2069,8 +2078,6 @@ bool RTABMapApp::exportMesh(
|
||||
|
||||
try
|
||||
{
|
||||
std::map<int, rtabmap::Transform> poses = rtabmap_->getLocalOptimizedPoses();
|
||||
|
||||
int totalSteps = 0;
|
||||
totalSteps+=poses.size(); // assemble
|
||||
if(meshing)
|
||||
@@ -2373,6 +2380,10 @@ bool RTABMapApp::exportMesh(
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Merged cloud too small (%d points) to create polygons!", (int)mergedClouds->size());
|
||||
}
|
||||
}
|
||||
else // organized meshes
|
||||
{
|
||||
@@ -2736,6 +2747,10 @@ bool RTABMapApp::exportMesh(
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Merged cloud is empty!");
|
||||
}
|
||||
}
|
||||
|
||||
progressionStatus_.finish();
|
||||
|
||||
@@ -2128,7 +2128,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
}
|
||||
else
|
||||
{
|
||||
updateState(State.STATE_IDLE);
|
||||
updateState(previousState);
|
||||
mToast.makeText(getActivity(), String.format("Exporting map failed!"), mToast.LENGTH_LONG).show();
|
||||
}
|
||||
mExportProgressDialog.dismiss();
|
||||
@@ -2159,6 +2159,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
mProgressDialog.setMessage(String.format("Please wait while saving \"%s\"...", newDatabasePathHuman));
|
||||
}
|
||||
mProgressDialog.show();
|
||||
final State previousState = mState;
|
||||
updateState(State.STATE_PROCESSING);
|
||||
Thread saveThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
@@ -2197,7 +2198,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
||||
mOpenedDatabasePath = newDatabasePath;
|
||||
}
|
||||
mProgressDialog.dismiss();
|
||||
updateState(State.STATE_IDLE);
|
||||
updateState(previousState);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user