ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Publishing cloud message of pcl::PointXYZ type

asked 2012-02-11 08:50:53 -0500

alfa_80 gravatar image

updated 2012-02-11 14:26:57 -0500

I received a very long error when I try to publish a point cloud of type pcl::PointXYZ. I suspect there is no way to publish it using that pcl type, and that I've to convert to ros PointCloud2. Is that the case.

The defined publisher:

point_cloud_pcl_publisher_ = n.advertise<pcl::PointXYZ> ("/cloud_pcl", 100);

Thanks in advance.

EDIT

I declared the publisher as below:

pcl::PointCloud<pcl::PointXYZ> cloud_pcl;

In the header:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
#include <fstream>
#include <sensor_msgs/LaserScan.h>
#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/PointCloud2.h>
#include <tf/transform_listener.h>
#include <boost/algorithm/string.hpp>
#include "tf/tf.h"
#include "tf/transform_datatypes.h"
#include <tf/transform_broadcaster.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl_ros/point_cloud.h>

The error message:

/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum<m>::value() [with M = pcl::PointXYZ]’: /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:228: instantiated from ‘const char* ros::message_traits::md5sum() [with M = pcl::PointXYZ]’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/advertise_options.h:92: instantiated from ‘void ros::AdvertiseOptions::init(const std::string&, uint32_t, const ros::SubscriberStatusCallback&, const ros::SubscriberStatusCallback&) [with M = pcl::PointXYZ]’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/node_handle.h:239: instantiated from ‘ros::Publisher ros::NodeHandle::advertise(const std::string&, uint32_t, bool) [with M = pcl::PointXYZ]’ /home/shah/code/ros_workspace/point_cloud_drone/src/pointcloud_builder_node.cpp:192: instantiated from here /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:121: error: ‘__s_getMD5Sum’ is not a member of ‘pcl::PointXYZ’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType<m>::value() [with M = pcl::PointXYZ]’:

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2012-02-11 18:39:21 -0500

tfoote gravatar image

You need to advertise the PointCloud templated on the Point type, not just the point type.

Something like:

point_cloud_pcl_publisher_ = n.advertise<pcl::PointCloud<pcl::PointXYZ> > ("/cloud_pcl", 100);
edit flag offensive delete link more

Comments

Thanks a lot tfoote, could you provide the link so that I or others won't repeat this kind of mistake.
alfa_80 gravatar image alfa_80  ( 2012-02-11 18:42:21 -0500 )edit
Sorry, no need for the link, it's actually there in my declaration, the type itself..what a silly mistake.
alfa_80 gravatar image alfa_80  ( 2012-02-11 18:44:44 -0500 )edit

Is it enough if I import PointXYZ and publish using that datatype in python? Does the conversion take place implicitly?

gaussian gravatar image gaussian  ( 2015-02-01 05:28:00 -0500 )edit

Yes, it's enough. It takes place implicitly.

alfa_80 gravatar image alfa_80  ( 2015-02-08 10:02:01 -0500 )edit
1

answered 2012-02-11 09:20:26 -0500

Make sure you have this in your code:

#include <pcl_ros/point_cloud.h>

And the dependency to pcl_ros in your manifest.

edit flag offensive delete link more

Comments

Yes, those 2 were already there. However, it still complaints.
alfa_80 gravatar image alfa_80  ( 2012-02-11 13:06:36 -0500 )edit
Could you post a little more code? The headers you include, and the error itself?
Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2012-02-11 13:26:15 -0500 )edit

Question Tools

Stats

Asked: 2012-02-11 08:50:53 -0500

Seen: 3,148 times

Last updated: Feb 11 '12