perception_pcl icon indicating copy to clipboard operation
perception_pcl copied to clipboard

Using pcl_ros::transformPointCloud<pointT> with own pointT: Linker Error

Open Scyten opened this issue 3 years ago • 4 comments

Hi Community, I have an issue using this function

template<typename PointT >
bool pcl_ros::transformPointCloud (const std::string &target_frame, const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const tf::TransformListener &tf_listener)

If I use it with a "standard" pointT-type it works fine. If I use my own datatype it compiles, but I get undefined reference to the function above (pcl_ros::transformPointCloud) while linking.

PCL requires #define PCL_NO_PRECOMPILE to work with new point types (https://pointclouds.org/documentation/tutorials/adding_custom_ptype.html)

My pointT is

struct mmWaveCloudType
{
    PCL_ADD_POINT4D;
    union
    {
        struct
        {
            float intensity;
            float velocity;
        };
        float data_c[4];
    };
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGN_ALIGN16;

POINT_CLOUD_REGISTER_POINT_STRUCT (mmWaveCloudType,
                                    (float, x, x)
                                    (float, y, y)
                                    (float, z, z)
                                    (float, intensity, intensity)
                                    (float, velocity, velocity))

Is this define used by ros_pcl? Has someone tested new pointTypes with ros_pcl?

Scyten avatar May 05 '22 07:05 Scyten

Have you tried including pcl_ros/impl/transforms.hpp? That's where the implementation is

mvieth avatar May 06 '22 14:05 mvieth

I had included this file, but it does not changed anything. Same error. My work arround: I copied the function into my file and this works. Normaly this should not be necessary. :)

Scyten avatar May 06 '22 14:05 Scyten

Ok, I tried again, now it compiles. I was sure that I have tested it. Thank you!

Why isn´t pcl_ros/transforms.h enough?

Scyten avatar May 06 '22 14:05 Scyten

@Scyten pcl_ros/transforms.h only contains the declaration of the templated function. pcl_ros/impl/transforms.hpp contains the implementation. If the implementation is available to your compiler, it can instantiate it with any point type.

mvieth avatar May 07 '22 13:05 mvieth