mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
Fixed build with pcl 1.11 (#550). Fixed pcl 1.11 warnings (boost->std).
This commit is contained in:
@@ -69,10 +69,17 @@ public:
|
||||
const Transform & localTransform = Transform::getIdentity());
|
||||
virtual ~CameraOpenni();
|
||||
#ifdef RTABMAP_OPENNI
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
void image_cb (
|
||||
const std::shared_ptr<openni_wrapper::Image>& rgb,
|
||||
const std::shared_ptr<openni_wrapper::DepthImage>& depth,
|
||||
float constant);
|
||||
#else
|
||||
void image_cb (
|
||||
const boost::shared_ptr<openni_wrapper::Image>& rgb,
|
||||
const boost::shared_ptr<openni_wrapper::DepthImage>& depth,
|
||||
float constant);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
|
||||
|
||||
@@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <pcl/search/kdtree.h>
|
||||
#include <pcl/common/eigen.h>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/point_tests.h>
|
||||
#include <set>
|
||||
#include <queue>
|
||||
#include <fstream>
|
||||
|
||||
@@ -76,10 +76,17 @@ CameraOpenni::~CameraOpenni()
|
||||
#endif
|
||||
}
|
||||
#ifdef RTABMAP_OPENNI
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
void CameraOpenni::image_cb (
|
||||
const std::shared_ptr<openni_wrapper::Image>& rgb,
|
||||
const std::shared_ptr<openni_wrapper::DepthImage>& depth,
|
||||
float constant)
|
||||
#else
|
||||
void CameraOpenni::image_cb (
|
||||
const boost::shared_ptr<openni_wrapper::Image>& rgb,
|
||||
const boost::shared_ptr<openni_wrapper::DepthImage>& depth,
|
||||
float constant)
|
||||
#endif
|
||||
{
|
||||
UScopeMutex s(dataMutex_);
|
||||
|
||||
@@ -123,10 +130,17 @@ bool CameraOpenni::init(const std::string & calibrationFolder, const std::string
|
||||
interface_ = new pcl::OpenNIGrabber(deviceId_);
|
||||
}
|
||||
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
std::function<void (
|
||||
const std::shared_ptr<openni_wrapper::Image>&,
|
||||
const std::shared_ptr<openni_wrapper::DepthImage>&,
|
||||
float)> f = std::bind (&CameraOpenni::image_cb, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
#else
|
||||
boost::function<void (
|
||||
const boost::shared_ptr<openni_wrapper::Image>&,
|
||||
const boost::shared_ptr<openni_wrapper::DepthImage>&,
|
||||
float)> f = boost::bind (&CameraOpenni::image_cb, this, _1, _2, _3);
|
||||
#endif
|
||||
connection_ = interface_->registerCallback (f);
|
||||
|
||||
interface_->start ();
|
||||
|
||||
@@ -33,6 +33,7 @@ RTAB-Map integration: Mathieu Labbe
|
||||
#include <rtabmap/core/util3d.h>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <pcl/common/point_tests.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
|
||||
@@ -1271,7 +1271,11 @@ LaserScan laserScanFromPointCloud(const pcl::PCLPointCloud2 & cloud, bool filter
|
||||
}
|
||||
//determine the output type
|
||||
int fieldStates[8] = {0}; // x,y,z,normal_x,normal_y,normal_z,rgb,intensity
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
std::uint32_t fieldOffsets[8] = {0};
|
||||
#else
|
||||
pcl::uint32_t fieldOffsets[8] = {0};
|
||||
#endif
|
||||
for(unsigned int i=0; i<cloud.fields.size(); ++i)
|
||||
{
|
||||
if(cloud.fields[i].name.compare("x") == 0)
|
||||
@@ -1436,9 +1440,15 @@ LaserScan laserScanFromPointCloud(const pcl::PCLPointCloud2 & cloud, bool filter
|
||||
}
|
||||
else // XYZRGB
|
||||
{
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
std::uint8_t b=*(msg_data + fieldOffsets[6]);
|
||||
std::uint8_t g=*(msg_data + fieldOffsets[6]+1);
|
||||
std::uint8_t r=*(msg_data + fieldOffsets[6]+2);
|
||||
#else
|
||||
pcl::uint8_t b=*(msg_data + fieldOffsets[6]);
|
||||
pcl::uint8_t g=*(msg_data + fieldOffsets[6]+1);
|
||||
pcl::uint8_t r=*(msg_data + fieldOffsets[6]+2);
|
||||
#endif
|
||||
int * ptrInt = (int*)ptr;
|
||||
ptrInt[3] = int(b) | (int(g) << 8) | (int(r) << 16);
|
||||
}
|
||||
@@ -1481,9 +1491,15 @@ LaserScan laserScanFromPointCloud(const pcl::PCLPointCloud2 & cloud, bool filter
|
||||
}
|
||||
else // XYZRGBNormal
|
||||
{
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
std::uint8_t b=*(msg_data + fieldOffsets[6]);
|
||||
std::uint8_t g=*(msg_data + fieldOffsets[6]+1);
|
||||
std::uint8_t r=*(msg_data + fieldOffsets[6]+2);
|
||||
#else
|
||||
pcl::uint8_t b=*(msg_data + fieldOffsets[6]);
|
||||
pcl::uint8_t g=*(msg_data + fieldOffsets[6]+1);
|
||||
pcl::uint8_t r=*(msg_data + fieldOffsets[6]+2);
|
||||
#endif
|
||||
int * ptrInt = (int*)ptr;
|
||||
ptrInt[3] = int(b) | (int(g) << 8) | (int(r) << 16);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/core/EpipolarGeometry.h>
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
#include <pcl/search/kdtree.h>
|
||||
#include <pcl/common/point_tests.h>
|
||||
|
||||
namespace rtabmap
|
||||
{
|
||||
|
||||
@@ -41,6 +41,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/UMath.h>
|
||||
#include <rtabmap/utilite/UStl.h>
|
||||
|
||||
#include <pcl/common/point_tests.h>
|
||||
|
||||
#include <opencv2/video/tracking.hpp>
|
||||
|
||||
namespace rtabmap
|
||||
|
||||
@@ -1007,7 +1007,11 @@ pcl::TextureMesh::Ptr concatenateTextureMeshes(const std::list<pcl::TextureMesh:
|
||||
// append point cloud
|
||||
int polygonStep = output->cloud.height * output->cloud.width;
|
||||
pcl::PCLPointCloud2 tmp;
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 11, 0)
|
||||
pcl::concatenate(output->cloud, iter->get()->cloud, tmp);
|
||||
#else
|
||||
pcl::concatenatePointCloud(output->cloud, iter->get()->cloud, tmp);
|
||||
#endif
|
||||
output->cloud = tmp;
|
||||
|
||||
UASSERT((*iter)->tex_polygons.size() == (*iter)->tex_coordinates.size() &&
|
||||
@@ -3202,12 +3206,18 @@ pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr mls(
|
||||
mls.setComputeNormals (true);
|
||||
if(polygonialOrder > 0)
|
||||
{
|
||||
#if PCL_VERSION_COMPARE(<, 1, 11, 0)
|
||||
mls.setPolynomialFit (true);
|
||||
#endif
|
||||
mls.setPolynomialOrder(polygonialOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if PCL_VERSION_COMPARE(<, 1, 11, 0)
|
||||
mls.setPolynomialFit (false);
|
||||
#else
|
||||
mls.setPolynomialOrder(1);
|
||||
#endif
|
||||
}
|
||||
UASSERT(upsamplingMethod >= mls.NONE &&
|
||||
upsamplingMethod <= mls.VOXEL_GRID_DILATION);
|
||||
|
||||
Reference in New Issue
Block a user