-Added the grid map in the 3D map view (pcl::TextureMesh, available only when pcl>=1.7.2). Refactored how 2d maps are created.

-Fixed export grid map on Mac OS X.


git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1623 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-07-29 21:48:37 +00:00
parent a81f5785a2
commit 69ad085f88
16 changed files with 517 additions and 249 deletions

View File

@@ -20,6 +20,8 @@
#include <QtCore/QSet>
#include <QtCore/qnamespace.h>
#include <opencv2/opencv.hpp>
#include <pcl/visualization/mouse_event.h>
#include <pcl/PCLPointCloud2.h>
@@ -92,6 +94,14 @@ public:
const pcl::PolygonMesh::Ptr & mesh,
const Transform & pose = Transform::getIdentity());
bool addOccupancyGridMap(
const cv::Mat & map8U,
float resolution, // cell size
float xMin,
float yMin,
float opacity);
void removeOccupancyGridMap();
void updateCameraPosition(
const Transform & pose);
@@ -111,6 +121,7 @@ public:
void setCameraFree();
void setCameraLockZ(bool enabled = true);
void setGridShown(bool shown);
void setWorkingDirectory(const QString & path) {_workingDirectory = path;}
public slots:
void render();
@@ -150,6 +161,7 @@ private:
Transform _lastPose;
std::list<std::string> _gridLines;
QSet<Qt::Key> _keysPressed;
QString _workingDirectory;
};
} /* namespace rtabmap */

View File

@@ -30,6 +30,8 @@
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <set>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <rtabmap/core/Link.h>
@@ -92,7 +94,7 @@ private:
std::list<std::map<int, rtabmap::Transform> > graphes_;
std::map<int, rtabmap::Transform> poses_;
std::multimap<int, rtabmap::Link> links_;
QMap<int, std::vector<unsigned char> > scans_;
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > scans_;
};
#endif /* DATABASEVIEWER_H_ */

View File

@@ -176,7 +176,7 @@ signals:
private:
void update3DMapVisibility(bool cloudsShown, bool scansShown);
void updateMapCloud(const std::map<int, Transform> & poses, const Transform & pose);
void updateMapCloud(const std::map<int, Transform> & poses, const Transform & pose, const std::multimap<int, Link> & constraints);
void createAndAddCloudToMap(int nodeId, const Transform & pose);
void createAndAddScanToMap(int nodeId, const Transform & pose);
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
@@ -248,6 +248,7 @@ private:
QMap<int, Transform> _localTransformsMap;
std::map<int, Transform> _currentPosesMap;
QMap<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr > _createdClouds;
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > _createdScans;
Transform _odometryCorrection;
Transform _lastOdomPose;
bool _lastOdometryProcessed;

View File

@@ -134,6 +134,11 @@ public:
double getCloudFilteringRadius() const;
double getCloudFilteringAngle() const;
bool getGridMapShown() const;
double getGridMapResolution() const;
bool getGridMapFillEmptySpace() const;
double getGridMapOpacity() const;
QString getWorkingDirectory() const;
QString getDatabasePath() const;

View File

@@ -65,6 +65,9 @@ inline QImage uCvMat2QImage(const cv::Mat & image, bool isBgr = true)
{
// mono grayscale
qtemp = QImage(image.data, image.cols, image.rows, image.cols, QImage::Format_Indexed8).copy();
QVector<QRgb> my_table;
for(int i = 0; i < 256; i++) my_table.push_back(qRgb(i,i,i));
qtemp.setColorTable(my_table);
}
else
{