mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Version 0.8.8: added "user_data" field in database. Added WifiMapping example. Fixed FATAL error when initializing rtabmap with no database.
This commit is contained in:
@@ -347,8 +347,12 @@ bool CloudViewer::addCloud(
|
||||
colorHandler.reset (new pcl::visualization::PointCloudColorHandlerRandom<pcl::PCLPointCloud2> (binaryCloud));
|
||||
if(_visualizer->addPointCloud (binaryCloud, colorHandler, origin, orientation, id))
|
||||
{
|
||||
// white
|
||||
colorHandler.reset (new pcl::visualization::PointCloudColorHandlerCustom<pcl::PCLPointCloud2> (binaryCloud, color.red(), color.green(), color.blue()));
|
||||
QColor c = Qt::gray;
|
||||
if(color.isValid())
|
||||
{
|
||||
c = color;
|
||||
}
|
||||
colorHandler.reset (new pcl::visualization::PointCloudColorHandlerCustom<pcl::PCLPointCloud2> (binaryCloud, c.red(), c.green(), c.blue()));
|
||||
_visualizer->addPointCloud (binaryCloud, colorHandler, origin, orientation, id);
|
||||
|
||||
// x,y,z
|
||||
@@ -367,6 +371,10 @@ bool CloudViewer::addCloud(
|
||||
|
||||
_visualizer->updateColorHandlerIndex(id, 5);
|
||||
}
|
||||
else if(color.isValid())
|
||||
{
|
||||
_visualizer->updateColorHandlerIndex(id, 1);
|
||||
}
|
||||
|
||||
_addedClouds.insert(id, pose);
|
||||
return true;
|
||||
|
||||
@@ -1037,7 +1037,8 @@ void DatabaseViewer::view3DMap()
|
||||
Transform odomPose;
|
||||
std::string label;
|
||||
double stamp;
|
||||
if(memory_->getNodeInfo(iter->first, odomPose, mapId, weight, label, stamp, true))
|
||||
std::vector<unsigned char> userData;
|
||||
if(memory_->getNodeInfo(iter->first, odomPose, mapId, weight, label, stamp, userData, true))
|
||||
{
|
||||
color = (Qt::GlobalColor)(mapId % 12 + 7 );
|
||||
}
|
||||
@@ -1391,7 +1392,8 @@ void DatabaseViewer::update(int value,
|
||||
int w;
|
||||
std::string l;
|
||||
double s;
|
||||
memory_->getNodeInfo(id, odomPose, mapId, w, l, s, true);
|
||||
std::vector<unsigned char> d;
|
||||
memory_->getNodeInfo(id, odomPose, mapId, w, l, s, d, true);
|
||||
|
||||
weight->setNum(data.getWeight());
|
||||
label->setText(data.getLabel().c_str());
|
||||
|
||||
@@ -1393,10 +1393,14 @@ void MainWindow::updateMapCloud(
|
||||
|
||||
// update 3D graphes (show all poses)
|
||||
_ui->widget_cloudViewer->removeAllGraphs();
|
||||
_ui->widget_cloudViewer->removeCloud("graph_nodes");
|
||||
if(_preferencesDialog->isGraphsShown() && _currentPosesMap.size())
|
||||
{
|
||||
// Find all graphs
|
||||
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > graphs;
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr graphNodes(new pcl::PointCloud<pcl::PointXYZ>);
|
||||
graphNodes->resize(_currentPosesMap.size());
|
||||
int oi = 0;
|
||||
for(std::map<int, Transform>::iterator iter=_currentPosesMap.begin(); iter!=_currentPosesMap.end(); ++iter)
|
||||
{
|
||||
int mapId = uValue(_currentMapIds, iter->first, -1);
|
||||
@@ -1405,7 +1409,9 @@ void MainWindow::updateMapCloud(
|
||||
{
|
||||
kter = graphs.insert(std::make_pair(mapId, pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>))).first;
|
||||
}
|
||||
kter->second->push_back(pcl::PointXYZ(iter->second.x(), iter->second.y(), iter->second.z()));
|
||||
pcl::PointXYZ pt(iter->second.x(), iter->second.y(), iter->second.z());
|
||||
kter->second->push_back(pt);
|
||||
(*graphNodes)[oi++] = pcl::PointXYZ(pt);
|
||||
}
|
||||
|
||||
// add graphs
|
||||
@@ -1418,6 +1424,10 @@ void MainWindow::updateMapCloud(
|
||||
}
|
||||
_ui->widget_cloudViewer->addOrUpdateGraph(uFormat("graph_%d", iter->first), iter->second, color);
|
||||
}
|
||||
|
||||
// add nodes
|
||||
_ui->widget_cloudViewer->addOrUpdateCloud("graph_nodes", graphNodes, Transform::getIdentity(), Qt::green);
|
||||
_ui->widget_cloudViewer->setCloudPointSize("graph_nodes", 5);
|
||||
}
|
||||
|
||||
// Update occupancy grid map in 3D map view and graph view
|
||||
|
||||
Reference in New Issue
Block a user