Issue with custom Point Type registering for concatenate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue with custom Point Type registering for concatenate

Matt.Roscoe
Hello there. I'm having an issue I don't seem to be able to resolve where I'm
getting the following errors:

error C2499: 'pcl::traits::datatype<PointT,Tag>' : a class cannot be its own
base class
error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
from 'boost::mpl::failed ************(__thiscall
pcl::traits::datatype<PointT,Tag>::POINT_TYPE_NOT_PROPERLY_REGISTERED::*
***********)(PointT &)' to 'boost::mpl::assert<false>::type'
error C2866: 'pcl::traits::datatype<PointT,Tag>::mpl_assertion_in_line_2' :
a const static data member of a managed type must be initialized at the
point of declaration
error C2039: 'type' : is not a member of 'pcl::traits::datatype<PointT,Tag>'
error C2146: syntax error : missing ';' before identifier 'OutT'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
error C2065: 'OutT' : undeclared identifier
error C2061: syntax error : identifier 'OutT'
error C2065: 'OutT' : undeclared identifier
error C2923: 'boost::is_same' : 'OutT' is not a valid template type argument
for parameter 'U'
error C2955: 'boost::is_same' : use of class template requires template
argument list
error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
from 'boost::mpl::failed ************(__thiscall
pcl::NdConcatenateFunctor<PointInT,PointOutT>::()::POINT_IN_AND_POINT_OUT_HAVE_DIFFERENT_TYPES_FOR_FIELD::*
***********)(Key,PointInT &,InT,PointOutT &)' to
'boost::mpl::assert<false>::type'
error C2499: 'pcl::traits::offset<PointT,Tag>' : a class cannot be its own
base class
error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
from 'boost::mpl::failed ************(__thiscall
pcl::traits::offset<PointT,Tag>::POINT_TYPE_NOT_PROPERLY_REGISTERED::*
***********)(PointT &)' to 'boost::mpl::assert<false>::type'
error C2866: 'pcl::traits::offset<PointT,Tag>::mpl_assertion_in_line_1' : a
const static data member of a managed type must be initialized at the point
of declaration
error C2039: 'value' : is not a member of 'pcl::traits::offset<PointT,Tag>'
error C2065: 'value' : undeclared identifier

From what I can decipher M my custom point type, aptly named MyPointType is
not being registered within PCL despite my having followed the example on
creating a custom point type.

Here is where my custom point type is declared and registered within it's
own .cpp file:

#define PCL_NO_PRECOMPILE
#include <pcl\point_types.h>
#include <pcl\point_cloud.h>
#include <pcl\octree\octree.h>
#include <pcl\octree\impl\octree_search.hpp>
#include <pcl\kdtree\kdtree_flann.h>
#include <pcl\kdtree\impl\kdtree_flann.hpp>
#include <pcl\features\normal_3d.h>
#include <pcl\features\impl\normal_3d.hpp>
#include <pcl\surface\gp3.h>
#include <pcl\surface\impl\gp3.hpp>

using namespace pcl;

struct MyPointType {
        PCL_ADD_POINT4D;                  // preferred way of adding a XYZ+padding
        int classNum;
        int scanAngle;
        int endOfLine;
        int returnNumber;
        int numberReturns;
        int shotNumber;
        int scannerNumber;
        float intensity;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW   // make sure our new allocators are
aligned
} EIGEN_ALIGN16;                    // enforce SSE padding for correct
memory alignment

POINT_CLOUD_REGISTER_POINT_STRUCT (MyPointType,           // here we assume
a XYZ + "test" (as fields)
        (float, x, x)
        (float, y, y)
        (float, z, z)
        (int, classNum, classNum)
        (int, scanAngle, scanAngle)
        (int, endOfLine, endOfLine)
        (int, returnNumber, returnNumber)
        (int, numberReturns, numberReturns)
        (int, shotNumber, shotNumber)
        (int, scannerNumber, scannerNumber)
        (float, intensity, intensity)
);


And here is the function in which I am using Fast Triangulation to create a
TIN after estimating normals on a point cloud of my custom point type:

//Fast triangulation of point cloud
void LasReader::FastTIN(pcl::PointCloud<MyPointType>::Ptr ptrSubPCLCloud,
vector<int> mainCloudIndex, float radius, float surfAngle, float minAngle,
float maxAngle, float distance, int classNum) {
        //Calculate normals for points
        clock_t start;
        double duration;
        cout << "Creating kdTree " << endl;
        start = clock();

        pcl::NormalEstimation<MyPointType, pcl::Normal> ne;
        pcl::PointCloud<pcl::Normal>::Ptr normals (new
pcl::PointCloud<pcl::Normal>);
        pcl::search::KdTree<MyPointType>::Ptr tree (new
pcl::search::KdTree<MyPointType>);
        tree->setInputCloud(ptrSubPCLCloud);

        duration = (clock() - start) / (double) CLOCKS_PER_SEC;
        cout << "kdTree Created! Duration: " << duration << endl;

        cout << "Calculating normals " << endl;
        start = clock();

        // Normal estimation*
        ne.setInputCloud(ptrSubPCLCloud);
        ne.setSearchMethod(tree);
        ne.setKSearch(12);
        Eigen::Vector4f centroid;
        pcl::compute3DCentroid(*ptrPCLCloud,centroid);
        ne.setViewPoint(centroid.x(),centroid.y(),zMax + 20.0);
        ne.compute(*normals);

        duration = (clock() - start) / (double) CLOCKS_PER_SEC;
        cout << "Normals Finished! Duration: " << duration << endl;

        // Concatenate the XYZ and normal fields*
        pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(new
pcl::PointCloud<pcl::PointNormal>);
        pcl::concatenateFields(*ptrSubPCLCloud, *normals, *cloud_with_normals);
        //* cloud_with_normals = cloud + normals

        // Create search tree*
        pcl::search::KdTree<pcl::PointNormal>::Ptr tree2 (new
pcl::search::KdTree<pcl::PointNormal>);
        tree2->setInputCloud(cloud_with_normals);

        // Initialize objects
        pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
        pcl::PolygonMesh triangles;

        // Set the maximum distance between connected points (maximum edge length)
        gp3.setSearchRadius(radius);

        // Set typical values for the parameters
        gp3.setMu(2.5);
        gp3.setMaximumNearestNeighbors(100);
        gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees
        gp3.setMinimumAngle(M_PI/18); // 10 degrees
        gp3.setMaximumAngle(2*M_PI/3); // 120 degrees
        gp3.setNormalConsistency(false);

        cout << "Creating TIN " << endl;
        start = clock();

        // Get result
        gp3.setInputCloud(cloud_with_normals);
        gp3.setSearchMethod(tree2);
        gp3.reconstruct(triangles);

        duration = (clock() - start) / (double) CLOCKS_PER_SEC;
        cout << "TIN Finished! Duration: " << duration << endl;
}

The errors only appeared once I began trying to use the concatenate function
to merge the normals cloud with my point cloud. I'm aware of the need to
include the template header implementation of the specific class/algorithm
in PCL that I want to use my custom class with but have been unable to
locate such a file for either concatenate or point_traits. I'm running PCL
1.8 and compiling with VC11 on VS2012 in 32bit. Let me know if anyone wants
more information, any help will be greatly appreciated as I've been stuck on
this for a bit now!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users