Unable to compile subscriber PointCloud<PointT>
Hi,
I have a node written by someone else that I do not want to modify. The node publish a pcl::PointCloud<pointxyzrgb>
I just want to take the cloud, process it and publish a new cloud of the same type. I tried the simplest code possible, but it does not compile. Here there is the code (note that I commented out many things to make the example as simple as possible):
#include <ros ros.h="">
// PCL specific includes
#include <pcl_conversions pcl_conversions.h="">
#include <pcl point_cloud.h="">
#include <pcl point_types.h="">
#include <std_msgs string.h="">
#include <sstream>
#include <iostream>
using namespace std;
ros::Publisher pub;
//bool firstone = true;
//int banana = 0;
//pcl::PointCloud<pcl::pointxyzrgb> firstCloud;
//pcl::PointCloud<pcl::pointxyzrgb> secondCloud;
void cloud_cb(const pcl::PointCloud<pcl::pointxyzrgb>::ConstPtr& input) {
// if (firstone) {
// firstCloud = (*input);
// firstone = false;
// } else {
// secondCloud = (*input);
// firstone = true;
// }
//
// std_msgs::String msg;
// std::stringstream ss;
//
// ss << banana << " " << "Width: " << (*input).width << "Height: " << (*input).height << endl;
// banana++;
//
// msg.data = ss.str();
//
// pub.publish(msg);
}
int main(int argc, char** argv) {
ros::Rate rate(10);
// Initialize ROS
ros::init(argc, argv, "hyq_registration");
ros::NodeHandle nh;
// Create a ROS subscriber for the input point cloud
ros::Subscriber sub = nh.subscribe("triclops/point_cloud_topic", 1, cloud_cb);
// Create a ROS publisher for the output point cloud
pub = nh.advertise <std_msgs::string> ("output", 1);
ros::spin();
}
catkin_make
shoots this:
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/mcamurri/hyq-ws/src/hyq_registration/src/hyq_registration.cpp:1:
/opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum<m>::value() [with M = pcl::PointCloud<pcl::pointxyzrgb>]’:
/opt/ros/hydro/include/ros/message_traits.h:228:103: instantiated from ‘const char* ros::message_traits::md5sum() [with M = pcl::PointCloud<pcl::pointxyzrgb>]’
/opt/ros/hydro/include/ros/subscribe_options.h:110:5: instantiated from ‘void ros::SubscribeOptions::init(const string&, uint32_t, const boost::function<void(const boost::shared_ptr<const="" m="">&)>&, const boost::function<boost::shared_ptr<t>()>&) [with M = pcl::PointCloud<pcl::pointxyzrgb>, std::string = std::basic_string<char>, uint32_t = unsigned int]’
/opt/ros/hydro/include/ros/node_handle.h:666:5: instantiated from ‘ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (*)(const boost::shared_ptr<const m="">&), const ros::TransportHints&) [with M = pcl::PointCloud<pcl::pointxyzrgb>, std::string = std::basic_string<char>, uint32_t = unsigned int]’
/home/mcamurri/hyq-ws/src/hyq_registration/src/hyq_registration.cpp:49:81: instantiated from here
/opt/ros/hydro/include/ros/message_traits.h:121:37: error: ‘__s_getMD5Sum’ is not a member of ‘pcl::PointCloud<pcl::pointxyzrgb>’
/opt/ros/hydro/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType<m>::value() [with M = pcl::PointCloud<pcl::pointxyzrgb>]’:
/opt/ros/hydro/include/ros/message_traits.h:237:105 ...