MainWindow: updated default 2d scan with normals color for map and odom

This commit is contained in:
matlabbe
2018-02-23 11:13:26 -05:00
parent e1a0fc42ea
commit 215eff3212

View File

@@ -1116,7 +1116,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
{
pcl::PointCloud<pcl::PointNormal>::Ptr cloud;
cloud = util3d::laserScanToPointCloudNormal(odom.info().localScanMap, odom.info().localScanMap.localTransform());
bool scanUpdated = _cloudViewer->getAddedClouds().contains("scanMapOdom");
bool scanAdded = _cloudViewer->getAddedClouds().contains("scanMapOdom");
if(!_cloudViewer->addCloud("scanMapOdom", cloud, _odometryCorrection, Qt::blue))
{
UERROR("Adding scanMapOdom to viewer failed!");
@@ -1124,7 +1124,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
else
{
_cloudViewer->setCloudVisibility("scanMapOdom", true);
_cloudViewer->setCloudColorIndex("scanMapOdom", !scanUpdated && _preferencesDialog->getScanColorScheme(1)==0?2:_preferencesDialog->getScanColorScheme(1));
_cloudViewer->setCloudColorIndex("scanMapOdom", scanAdded && _preferencesDialog->getScanColorScheme(1)==0 && odom.info().localScanMap.is2d()?2:_preferencesDialog->getScanColorScheme(1));
_cloudViewer->setCloudOpacity("scanMapOdom", _preferencesDialog->getScanOpacity(1));
_cloudViewer->setCloudPointSize("scanMapOdom", _preferencesDialog->getScanPointSize(1));
}
@@ -1153,7 +1153,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
cloud = util3d::voxelize(cloud, _preferencesDialog->getCloudVoxelSizeScan(1));
}
bool scanUpdated = _cloudViewer->getAddedClouds().contains("scanOdom");
bool scanAdded = !_cloudViewer->getAddedClouds().contains("scanOdom");
if(!_cloudViewer->addCloud("scanOdom", cloud, _odometryCorrection, Qt::magenta))
{
UERROR("Adding scanOdom to viewer failed!");
@@ -1161,7 +1161,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
else
{
_cloudViewer->setCloudVisibility("scanOdom", true);
_cloudViewer->setCloudColorIndex("scanOdom", !scanUpdated && _preferencesDialog->getScanColorScheme(1)==0?2:_preferencesDialog->getScanColorScheme(1));
_cloudViewer->setCloudColorIndex("scanOdom", scanAdded && _preferencesDialog->getScanColorScheme(1)==0 && scan.is2d()?2:_preferencesDialog->getScanColorScheme(1));
_cloudViewer->setCloudOpacity("scanOdom", _preferencesDialog->getScanOpacity(1));
_cloudViewer->setCloudPointSize("scanOdom", _preferencesDialog->getScanPointSize(1));
scanUpdated = true;
@@ -3353,7 +3353,7 @@ void MainWindow::createAndAddScanToMap(int nodeId, const Transform & pose, int m
_createdScans.insert(std::make_pair(nodeId, scan)); // keep scan in scan frame
}
_cloudViewer->setCloudColorIndex(scanName, _preferencesDialog->getScanColorScheme(0));
_cloudViewer->setCloudColorIndex(scanName, _preferencesDialog->getScanColorScheme(0)==0 && scan.is2d()?2:_preferencesDialog->getScanColorScheme(0));
_cloudViewer->setCloudOpacity(scanName, _preferencesDialog->getScanOpacity(0));
_cloudViewer->setCloudPointSize(scanName, _preferencesDialog->getScanPointSize(0));
}