Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Scyten opened this issue May 5, 2022 · 4 comments
Open

Comments

@Scyten
Copy link

Scyten commented May 5, 2022

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?

@mvieth
Copy link
Contributor

mvieth commented May 6, 2022

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

@Scyten
Copy link
Author

Scyten commented May 6, 2022

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
Copy link
Author

Scyten commented May 6, 2022

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?

@mvieth
Copy link
Contributor

mvieth commented May 7, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants