mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-08 04:20:20 +08:00
CloudViewer: fixed opengl not refreshed on update (VTK9). Fixed File Explorer hanging (Qt 5.12). Fixed backup database not deleted after a recovery.
This commit is contained in:
@@ -50,6 +50,10 @@ int main(int argc, char* argv[])
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
ULogger::setLevel(ULogger::kWarning);
|
||||
|
||||
#ifdef WIN32
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
#ifdef RTABMAP_PYTHON
|
||||
PythonInterface python; // Make sure we initialize python in main thread
|
||||
#endif
|
||||
|
||||
+36
-34
@@ -151,43 +151,45 @@ bool databaseRecovery(
|
||||
bool rgbdEnabled = Parameters::defaultRGBDEnabled();
|
||||
Parameters::parse(parameters, Parameters::kRGBDEnabled(), rgbdEnabled);
|
||||
bool odometryIgnored = !rgbdEnabled;
|
||||
DBReader dbReader(backupPath, 0, odometryIgnored);
|
||||
dbReader.init();
|
||||
|
||||
CameraInfo info;
|
||||
SensorData data = dbReader.takeImage(&info);
|
||||
int processed = 0;
|
||||
if(progressState)
|
||||
progressState->callback(uFormat("Recovering data of \"%s\"...", backupPath.c_str()));
|
||||
while(data.isValid() && (progressState==0 || !progressState->isCanceled()))
|
||||
{
|
||||
std::string status;
|
||||
if(!odometryIgnored && info.odomPose.isNull())
|
||||
{
|
||||
status = uFormat("Skipping node %d as it doesn't have odometry pose set.", data.id());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!odometryIgnored && !info.odomCovariance.empty() && info.odomCovariance.at<double>(0,0)>=9999)
|
||||
{
|
||||
status = uFormat("High variance detected, triggering a new map...");
|
||||
rtabmap.triggerNewMap();
|
||||
}
|
||||
if(!rtabmap.process(data, info.odomPose, info.odomCovariance, info.odomVelocity))
|
||||
{
|
||||
status = uFormat("Failed processing node %d.", data.id());
|
||||
}
|
||||
}
|
||||
if(status.empty())
|
||||
{
|
||||
if(progressState)
|
||||
progressState->callback(status);
|
||||
}
|
||||
DBReader dbReader(backupPath, 0, odometryIgnored);
|
||||
dbReader.init();
|
||||
|
||||
data = dbReader.takeImage(&info);
|
||||
CameraInfo info;
|
||||
SensorData data = dbReader.takeImage(&info);
|
||||
int processed = 0;
|
||||
if (progressState)
|
||||
progressState->callback(uFormat("Recovering data of \"%s\"...", backupPath.c_str()));
|
||||
while (data.isValid() && (progressState == 0 || !progressState->isCanceled()))
|
||||
{
|
||||
std::string status;
|
||||
if (!odometryIgnored && info.odomPose.isNull())
|
||||
{
|
||||
status = uFormat("Skipping node %d as it doesn't have odometry pose set.", data.id());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!odometryIgnored && !info.odomCovariance.empty() && info.odomCovariance.at<double>(0, 0) >= 9999)
|
||||
{
|
||||
status = uFormat("High variance detected, triggering a new map...");
|
||||
rtabmap.triggerNewMap();
|
||||
}
|
||||
if (!rtabmap.process(data, info.odomPose, info.odomCovariance, info.odomVelocity))
|
||||
{
|
||||
status = uFormat("Failed processing node %d.", data.id());
|
||||
}
|
||||
}
|
||||
if (status.empty())
|
||||
{
|
||||
if (progressState)
|
||||
progressState->callback(status);
|
||||
}
|
||||
|
||||
if(progressState)
|
||||
progressState->callback(uFormat("Processed %d/%d nodes...", ++processed, (int)ids.size()));
|
||||
data = dbReader.takeImage(&info);
|
||||
|
||||
if (progressState)
|
||||
progressState->callback(uFormat("Processed %d/%d nodes...", ++processed, (int)ids.size()));
|
||||
}
|
||||
}
|
||||
|
||||
if(progressState)
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void refreshView();
|
||||
|
||||
bool updateCloudPose(
|
||||
const std::string & id,
|
||||
const Transform & pose); //including mesh
|
||||
|
||||
@@ -181,7 +181,7 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
|
||||
(showScanCheckbox_->isEnabled() && showScanCheckbox_->isChecked()));
|
||||
if(cloudView_->isVisible())
|
||||
{
|
||||
cloudView_->update();
|
||||
cloudView_->refreshView();
|
||||
}
|
||||
if(cloudView_->getAddedClouds().contains("cloud"))
|
||||
{
|
||||
|
||||
+23
-14
@@ -521,7 +521,16 @@ void CloudViewer::loadSettings(QSettings & settings, const QString & group)
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
void CloudViewer::refreshView()
|
||||
{
|
||||
#if VTK_MAJOR_VERSION > 8
|
||||
this->renderWindow()->Render();
|
||||
#else
|
||||
this->update();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CloudViewer::updateCloudPose(
|
||||
@@ -2288,7 +2297,7 @@ void CloudViewer::clearTrajectory()
|
||||
{
|
||||
_trajectory->clear();
|
||||
_visualizer->removeShape("trajectory");
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
bool CloudViewer::isCameraAxisShown() const
|
||||
@@ -2306,7 +2315,7 @@ void CloudViewer::setCameraAxisShown(bool shown)
|
||||
{
|
||||
this->addOrUpdateCoordinate("reference", Transform::getIdentity(), 0.2);
|
||||
}
|
||||
this->update();
|
||||
this->refreshView();
|
||||
_aShowCameraAxis->setChecked(shown);
|
||||
}
|
||||
|
||||
@@ -2355,7 +2364,7 @@ void CloudViewer::setFrustumShown(bool shown)
|
||||
this->removeLine(*iter);
|
||||
}
|
||||
}
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
_aShowFrustum->setChecked(shown);
|
||||
}
|
||||
@@ -2375,7 +2384,7 @@ void CloudViewer::setFrustumColor(QColor value)
|
||||
{
|
||||
_visualizer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, value.redF(), value.greenF(), value.blueF(), iter.key());
|
||||
}
|
||||
this->update();
|
||||
this->refreshView();
|
||||
_frustumColor = value;
|
||||
}
|
||||
|
||||
@@ -2604,7 +2613,7 @@ void CloudViewer::setBackfaceCulling(bool enabled, bool frontfaceCulling)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
void CloudViewer::setPolygonPicking(bool enabled)
|
||||
@@ -2669,7 +2678,7 @@ void CloudViewer::setEDLShading(bool on)
|
||||
glrenderer->SetPass(NULL);
|
||||
}
|
||||
|
||||
this->update();
|
||||
this->refreshView();
|
||||
#else
|
||||
if(on)
|
||||
{
|
||||
@@ -2697,7 +2706,7 @@ void CloudViewer::setLighting(bool on)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
void CloudViewer::setShading(bool on)
|
||||
@@ -2719,7 +2728,7 @@ void CloudViewer::setShading(bool on)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
void CloudViewer::setEdgeVisibility(bool visible)
|
||||
@@ -2741,7 +2750,7 @@ void CloudViewer::setEdgeVisibility(bool visible)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
|
||||
void CloudViewer::setInteractorLayer(int layer)
|
||||
@@ -3164,7 +3173,7 @@ void CloudViewer::setCameraOrtho(bool enabled)
|
||||
if(interactor)
|
||||
{
|
||||
interactor->setOrthoMode(enabled);
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
_aCameraOrtho->setChecked(enabled);
|
||||
}
|
||||
@@ -3724,7 +3733,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
this->removeGrid();
|
||||
}
|
||||
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
else if(a == _aSetGridCellCount)
|
||||
{
|
||||
@@ -3747,7 +3756,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
else if(a == _aShowNormals)
|
||||
{
|
||||
this->setNormalsShown(_aShowNormals->isChecked());
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
else if(a == _aSetNormalsStep)
|
||||
{
|
||||
@@ -3791,7 +3800,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
if(color.isValid())
|
||||
{
|
||||
this->setDefaultBackgroundColor(color);
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
}
|
||||
else if(a == _aSetRenderingRate)
|
||||
@@ -3807,7 +3816,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
{
|
||||
if(_aLockViewZ->isChecked())
|
||||
{
|
||||
this->update();
|
||||
this->refreshView();
|
||||
}
|
||||
}
|
||||
else if(a == _aCameraOrtho)
|
||||
|
||||
@@ -1105,13 +1105,13 @@ bool DatabaseViewer::closeDatabase()
|
||||
sliderBValueChanged(0);
|
||||
|
||||
constraintsViewer_->clear();
|
||||
constraintsViewer_->update();
|
||||
constraintsViewer_->refreshView();
|
||||
|
||||
cloudViewer_->clear();
|
||||
cloudViewer_->update();
|
||||
cloudViewer_->refreshView();
|
||||
|
||||
occupancyGridViewer_->clear();
|
||||
occupancyGridViewer_->update();
|
||||
occupancyGridViewer_->refreshView();
|
||||
|
||||
ui_->graphViewer->clearAll();
|
||||
ui_->label_loopClosures->clear();
|
||||
@@ -1126,7 +1126,7 @@ bool DatabaseViewer::closeDatabase()
|
||||
|
||||
ui_->graphicsView_stereo->clear();
|
||||
stereoViewer_->clear();
|
||||
stereoViewer_->update();
|
||||
stereoViewer_->refreshView();
|
||||
|
||||
ui_->toolBox_statistics->clear();
|
||||
}
|
||||
@@ -5040,7 +5040,7 @@ void DatabaseViewer::update(int value,
|
||||
}
|
||||
cloudViewer_->updateCameraTargetPosition(pose);
|
||||
cloudViewer_->clearTrajectory();
|
||||
cloudViewer_->update();
|
||||
cloudViewer_->refreshView();
|
||||
}
|
||||
|
||||
if(signatures.size())
|
||||
@@ -5182,7 +5182,7 @@ void DatabaseViewer::update(int value,
|
||||
ui_->label_type_name->clear();
|
||||
ui_->checkBox_showOptimized->setEnabled(false);
|
||||
}
|
||||
constraintsViewer_->update();
|
||||
constraintsViewer_->refreshView();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5311,7 +5311,7 @@ void DatabaseViewer::updateStereo(const SensorData * data)
|
||||
|
||||
stereoViewer_->updateCameraTargetPosition(Transform::getIdentity());
|
||||
stereoViewer_->addCloud("stereo", cloud);
|
||||
stereoViewer_->update();
|
||||
stereoViewer_->refreshView();
|
||||
|
||||
ui_->label_stereo_inliers->setNum(inliers);
|
||||
ui_->label_stereo_flowOutliers->setNum(flowOutliers);
|
||||
@@ -6231,7 +6231,7 @@ void DatabaseViewer::updateConstraintView(
|
||||
|
||||
constraintsViewer_->clearTrajectory();
|
||||
|
||||
constraintsViewer_->update();
|
||||
constraintsViewer_->refreshView();
|
||||
}
|
||||
|
||||
// update buttons
|
||||
@@ -6561,7 +6561,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
|
||||
if(ui_->dockWidget_occupancyGridView->isVisible() && ui_->checkBox_grid_2d->isChecked())
|
||||
{
|
||||
occupancyGridViewer_->addOccupancyGridMap(map8U, cellSize, xMin, yMin, 1.0f);
|
||||
occupancyGridViewer_->update();
|
||||
occupancyGridViewer_->refreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6684,7 +6684,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
|
||||
occupancyGridViewer_->setCloudPointSize("emptyCellsXYZ", 5);
|
||||
occupancyGridViewer_->setCloudOpacity("emptyCellsXYZ", 0.5);
|
||||
}
|
||||
occupancyGridViewer_->update();
|
||||
occupancyGridViewer_->refreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7029,7 +7029,7 @@ void DatabaseViewer::updateGrid()
|
||||
{
|
||||
//just remove map in occupancy grid view
|
||||
occupancyGridViewer_->removeOccupancyGridMap();
|
||||
occupancyGridViewer_->update();
|
||||
occupancyGridViewer_->refreshView();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7139,7 +7139,7 @@ void DatabaseViewer::updateOctomapView()
|
||||
}
|
||||
}
|
||||
}
|
||||
occupancyGridViewer_->update();
|
||||
occupancyGridViewer_->refreshView();
|
||||
}
|
||||
if(ui_->dockWidget_view3d->isVisible() && ui_->checkBox_showGrid->isChecked())
|
||||
{
|
||||
@@ -8283,7 +8283,7 @@ void DatabaseViewer::updateLoopClosuresSlider(int from, int to)
|
||||
{
|
||||
ui_->horizontalSlider_loops->setEnabled(false);
|
||||
constraintsViewer_->removeAllClouds();
|
||||
constraintsViewer_->update();
|
||||
constraintsViewer_->refreshView();
|
||||
updateConstraintButtons();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1431,7 +1431,7 @@ void ExportCloudsDialog::viewClouds(
|
||||
_progressDialog->appendText(tr("Viewing the cloud %1 (%2 points)... done.").arg(iter->first).arg(iter->second->size()));
|
||||
}
|
||||
}
|
||||
viewer->update();
|
||||
viewer->refreshView();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ void LoopClosureViewer::updateView(const Transform & transform, const Parameters
|
||||
UERROR("loop transform is null !?!?");
|
||||
ui_->cloudViewerTransform->removeAllClouds();
|
||||
}
|
||||
ui_->cloudViewerTransform->update();
|
||||
ui_->cloudViewerTransform->refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1544,7 +1544,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
|
||||
_cloudViewer->updateCameraTargetPosition(_odometryCorrection*odom.pose());
|
||||
UDEBUG("Time Update Pose: %fs", time.ticks());
|
||||
}
|
||||
_cloudViewer->update();
|
||||
_cloudViewer->refreshView();
|
||||
|
||||
if(_ui->graphicsView_graphView->isVisible())
|
||||
{
|
||||
@@ -3275,7 +3275,7 @@ void MainWindow::updateMapCloud(
|
||||
}
|
||||
|
||||
UDEBUG("");
|
||||
_cloudViewer->update();
|
||||
_cloudViewer->refreshView();
|
||||
UDEBUG("");
|
||||
}
|
||||
|
||||
@@ -4189,7 +4189,7 @@ void MainWindow::updateNodeVisibility(int nodeId, bool visible)
|
||||
}
|
||||
}
|
||||
|
||||
_cloudViewer->update();
|
||||
_cloudViewer->refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ int main(int argc, char * argv[])
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
ULogger::setLevel(ULogger::kInfo);
|
||||
|
||||
#ifdef WIN32
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
#if VTK_MAJOR_VERSION >= 8
|
||||
vtkObject::GlobalWarningDisplayOff();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user