0
$\begingroup$

Rosanswers logo

I am following "How to use a pcl tutorial on ROS" under /pcl/Tutorials. I managed to build and run section 4.1 with no problems but when I build 4.2 I get the following error:

[ 50%] [100%] Built target example2 Building CXX object my_pcl_tutorial/CMakeFiles/example.dir/src/example.cpp.o In file included from /opt/ros/hydro/include/ros/serialization.h:37:0, from /opt/ros/hydro/include/ros/publisher.h:34, from /opt/ros/hydro/include/ros/node_handle.h:32, from /opt/ros/hydro/include/ros/ros.h:45, from /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:1: /opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum::value(const M&) [with M = pcl::ModelCoefficients]’: /opt/ros/hydro/include/ros/message_traits.h:255:104: instantiated from ‘const char* ros::message_traits::md5sum(const M&) [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/publisher.h:112:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::ModelCoefficients]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:49:28: instantiated from here /opt/ros/hydro/include/ros/message_traits.h:126:34: error: ‘const struct pcl::ModelCoefficients’ has no member named ‘__getMD5Sum’ /opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType::value(const M&) [with M = pcl::ModelCoefficients]’: /opt/ros/hydro/include/ros/message_traits.h:264:106: instantiated from ‘const char* ros::message_traits::datatype(const M&) [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/publisher.h:112:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::ModelCoefficients]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:49:28: instantiated from here /opt/ros/hydro/include/ros/message_traits.h:143:36: error: ‘const struct pcl::ModelCoefficients’ has no member named ‘__getDataType’ In file included from /opt/ros/hydro/include/ros/publisher.h:34:0, from /opt/ros/hydro/include/ros/node_handle.h:32, from /opt/ros/hydro/include/ros/ros.h:45, from /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:1: /opt/ros/hydro/include/ros/serialization.h: In static member function ‘static uint32_t ros::serialization::Serializer::serializedLength(typename boost::call_traits::param_type) [with T = pcl::ModelCoefficients, uint32_t = unsigned int, typename boost::call_traits::param_type = const pcl::ModelCoefficients&]’: /opt/ros/hydro/include/ros/serialization.h:170:43: instantiated from ‘uint32_t ros::serialization::serializationLength(const T&) [with T = pcl::ModelCoefficients, uint32_t = unsigned int]’ /opt/ros/hydro/include/ros/serialization.h:846:45: instantiated from ‘ros::SerializedMessage ros::serialization::serializeMessage(const M&) [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/publisher.h:118:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::ModelCoefficients]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:49:28: instantiated from here /opt/ros/hydro/include/ros/serialization.h:142:34: error: ‘const struct pcl::ModelCoefficients’ has no member named ‘serializationLength’ /opt/ros/hydro/include/ros/serialization.h: In static member function ‘static void ros::serialization::Serializer::write(Stream&, typename boost::call_traits::param_type) [with Stream = ros::serialization::OStream, T = pcl::ModelCoefficients, typename boost::call_traits::param_type = const pcl::ModelCoefficients&]’: /opt/ros/hydro/include/ros/serialization.h:152:3: instantiated from ‘void ros::serialization::serialize(Stream&, const T&) [with T = pcl::ModelCoefficients, Stream = ros::serialization::OStream]’ /opt/ros/hydro/include/ros/serialization.h:853:3: instantiated from ‘ros::SerializedMessage ros::serialization::serializeMessage(const M&) [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/publisher.h:118:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::ModelCoefficients]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:49:28: instantiated from here /opt/ros/hydro/include/ros/serialization.h:125:5: error: ‘const struct pcl::ModelCoefficients’ has no member named ‘serialize’ In file included from /opt/ros/hydro/include/ros/serialization.h:37:0, from /opt/ros/hydro/include/ros/publisher.h:34, from /opt/ros/hydro/include/ros/node_handle.h:32, from /opt/ros/hydro/include/ros/ros.h:45, from /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:1: /opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum::value() [with M = pcl::ModelCoefficients]’: /opt/ros/hydro/include/ros/message_traits.h:228:103: instantiated from ‘const char* ros::message_traits::md5sum() [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/advertise_options.h:92:5: instantiated from ‘void ros::AdvertiseOptions::init(const string&, uint32_t, const SubscriberStatusCallback&, const SubscriberStatusCallback&) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int, ros::SubscriberStatusCallback = boost::function<void(const ros::SingleSubscriberPublisher&)>]’ /opt/ros/hydro/include/ros/node_handle.h:239:7: instantiated from ‘ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, bool) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:69:58: instantiated from here /opt/ros/hydro/include/ros/message_traits.h:121:37: error: ‘__s_getMD5Sum’ is not a member of ‘pcl::ModelCoefficients’ /opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType::value() [with M = pcl::ModelCoefficients]’: /opt/ros/hydro/include/ros/message_traits.h:237:105: instantiated from ‘const char* ros::message_traits::datatype() [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/advertise_options.h:93:5: instantiated from ‘void ros::AdvertiseOptions::init(const string&, uint32_t, const SubscriberStatusCallback&, const SubscriberStatusCallback&) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int, ros::SubscriberStatusCallback = boost::function<void(const ros::SingleSubscriberPublisher&)>]’ /opt/ros/hydro/include/ros/node_handle.h:239:7: instantiated from ‘ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, bool) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:69:58: instantiated from here /opt/ros/hydro/include/ros/message_traits.h:138:39: error: ‘__s_getDataType’ is not a member of ‘pcl::ModelCoefficients’ /opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::Definition::value() [with M = pcl::ModelCoefficients]’: /opt/ros/hydro/include/ros/message_traits.h:246:107: instantiated from ‘const char* ros::message_traits::definition() [with M = pcl::ModelCoefficients]’ /opt/ros/hydro/include/ros/advertise_options.h:94:5: instantiated from ‘void ros::AdvertiseOptions::init(const string&, uint32_t, const SubscriberStatusCallback&, const SubscriberStatusCallback&) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int, ros::SubscriberStatusCallback = boost::function<void(const ros::SingleSubscriberPublisher&)>]’ /opt/ros/hydro/include/ros/node_handle.h:239:7: instantiated from ‘ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, bool) [with M = pcl::ModelCoefficients, std::string = std::basic_string, uint32_t = unsigned int]’ /home/ndivhuwo/Documents/cloud/src/my_pcl_tutorial/src/example.cpp:69:58: instantiated from here /opt/ros/hydro/include/ros/message_traits.h:155:48: error: ‘__s_getMessageDefinition’ is not a member of ‘pcl::ModelCoefficients’ make[2]: *** [my_pcl_tutorial/CMakeFiles/example.dir/src/example.cpp.o] Error 1 make[1]: *** [my_pcl_tutorial/CMakeFiles/example.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed

The line I think it's complaining about in the beginning looks like this:

// Publish the model coefficients

pub.publish (coefficients); where coefficients is pcl::ModelCoefficients coefficients;

I ran this code following documentation/tutorials/planar_segmentation under the pcl website and it worked and I didn't have to publish anything to a topic here but just printed to screen, this is why I think the problem is trying to publish a pcl::ModelCoefficients type or maybe I am just missing something. Any help will be appreciated. I am running ros hyrdo with pcl17 installed.


Originally posted by HiroCollins on ROS Answers with karma: 43 on 2013-10-22

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi, PCL is not integrated in ROS anymore. But there is package that allows you to perform conversions between ros and pcl messages. In order to publish pcl::ModelCoefficients you must do the following:

#include < pcl_conversions/pcl_conversions.h>

...

ros::Publisher pub;

// Create a ROS publisher for the output point cloud

pub = nh.advertise< pcl_msgs::ModelCoefficients> ("output", 1);

// ros message

pcl_msgs::ModelCoefficients ros_coefficients;

// pcl message

pcl::ModelCoefficients pcl_coefficients;

....

pcl_conversions::fromPCL(pcl_coefficients, ros_coefficients);

pub.publish(ros_coefficients);


Originally posted by sergifoix with karma: 36 on 2013-11-18

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Neil Traft on 2014-07-23:
Thanks for answering this question but not bothering to update the wiki, to ensure that people continue to have the most horrible experience trying to learn ROS.

Comment by dinosaur on 2015-06-04:
Another tutorial follower here. Now that I've made the changes, how do I get rviz to display the result?

Comment by Neil Traft on 2015-06-04:
Try this example. If you only want to see the planes/non-planes there is a way to copy just those points into a new point cloud but I forget how. Some other PCL tutorial might show it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.