Hi, I'm trying get NARF keypoints using depth images from a kinect with the following code but I keep getting the errors at the bottom of the post when I try to compile, the problem seems to occur when I try to publish the keypoints, I just need to publish the keypoints so I can see them in Rviz. Could anyone shed some light onto what I'm doing wrong?
typedef pcl::PointCloudpcl::PointCloud<int > PointCloud;
ros::Publisher pub;
pcl::PointCloud keypointsout;
float angularresolution;
float supportsize =0.2f;
void depthimagecb(const sensormsgs::ImageConstPtr &depthmsg)
{
const uint16t* depthImage = reinterpretcast<const uint16t*>(&depth_msg->data[0]);
pcl::RangeImagePlanar range_image_;
pcl::RangeImageBorderExtractor range_image_border_extractor_;
// convert the depth-image to a pcl::rangeImage
angular_resolution_ = (float)(-1);
range_image_.setDepthImage(depthImage,depth_msg->width, depth_msg->height, (depth_msg->width)/2, (depth_msg->height)/2, 600.0, 600.0, angular_resolution_);
range_image_.setUnseenToMaxRange();
pcl::NarfKeypoint keypoint_det;
keypoint_det.getParameters ().support_size = support_size_;
keypoint_det.setRangeImageBorderExtractor (&range_image_border_extractor_);
keypoint_det.setRangeImage (&range_image_);
keypoint_det.compute (keypointsout);
pub.publish (keypointsout);
}
int
main (int argc, char** argv)
{
// Initialize ROS
ros::init (argc, argv, "keypointsplanar");
ros::NodeHandle nh2;
//pub = nh2.advertise< PointCloud > ("keypointsout", 1);
ros::Subscriber sub2 = nh1.subscribe ("/camera/depth/image", 1, depthimage_cb);
pub = nh2.advertisepcl::PointCloud<int keypointsout> ("keypointsout", 1);
// Spin
ros::spin ();
}
ERRORS:
from /home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:1:
/opt/ros/fuerte/include/ros/messagetraits.h: In static member function ‘static const char* ros::messagetraits::MD5Sum::value(const M&) [with M = pcl::PointCloud]’:
/opt/ros/fuerte/include/ros/messagetraits.h:255:104: instantiated from ‘const char* ros::messagetraits::md5sum(const M&) [with M = pcl::PointCloud]’
/opt/ros/fuerte/include/ros/publisher.h:112:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::PointCloud]’
/home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:49:30: instantiated from here
/opt/ros/fuerte/include/ros/messagetraits.h:126:34: error: ‘const class pcl::PointCloud’ has no member named ‘getMD5Sum’
/opt/ros/fuerte/include/ros/messagetraits.h: In static member function ‘static const char* ros::messagetraits::DataType::value(const M&) [with M = pcl::PointCloud]’:
/opt/ros/fuerte/include/ros/messagetraits.h:264:106: instantiated from ‘const char* ros::messagetraits::datatype(const M&) [with M = pcl::PointCloud]’
/opt/ros/fuerte/include/ros/publisher.h:112:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::PointCloud]’
/home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:49:30: instantiated from here
/opt/ros/fuerte/include/ros/messagetraits.h:143:36: error: ‘const class pcl::PointCloud’ has no member named ‘getDataType’
In file included from /opt/ros/fuerte/include/ros/publisher.h:34:0,
from /opt/ros/fuerte/include/ros/nodehandle.h:32,
from /opt/ros/fuerte/include/ros/ros.h:45,
from /home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:1:
/opt/ros/fuerte/include/ros/serialization.h: In static member function ‘static uint32t ros::serialization::Serializer::serializedLength(typename boost::calltraits::paramtype) [with T = pcl::PointCloud, uint32t = unsigned int, typename boost::calltraits::paramtype = const pcl::PointCloud&]’:
/opt/ros/fuerte/include/ros/serialization.h:170:43: instantiated from ‘uint32t ros::serialization::serializationLength(const T&) [with T = pcl::PointCloud, uint32t = unsigned int]’
/opt/ros/fuerte/include/ros/serialization.h:805:45: instantiated from ‘ros::SerializedMessage ros::serialization::serializeMessage(const M&) [with M = pcl::PointCloud]’
/opt/ros/fuerte/include/ros/publisher.h:118:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::PointCloud]’
/home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:49:30: instantiated from here
/opt/ros/fuerte/include/ros/serialization.h:142:34: error: ‘const class pcl::PointCloud’ has no member named ‘serializationLength’
/opt/ros/fuerte/include/ros/serialization.h: In static member function ‘static void ros::serialization::Serializer::write(Stream&, typename boost::calltraits::paramtype) [with Stream = ros::serialization::OStream, T = pcl::PointCloud, typename boost::calltraits::paramtype = const pcl::PointCloud&]’:
/opt/ros/fuerte/include/ros/serialization.h:152:3: instantiated from ‘void ros::serialization::serialize(Stream&, const T&) [with T = pcl::PointCloud, Stream = ros::serialization::OStream]’
/opt/ros/fuerte/include/ros/serialization.h:812:3: instantiated from ‘ros::SerializedMessage ros::serialization::serializeMessage(const M&) [with M = pcl::PointCloud]’
/opt/ros/fuerte/include/ros/publisher.h:118:7: instantiated from ‘void ros::Publisher::publish(const M&) const [with M = pcl::PointCloud]’
/home/jumpei/fuerteworkspace/tesis/src/keypointsplanar.cpp:49:30: instantiated from here
/opt/ros/fuerte/include/ros/serialization.h:125:5: error: ‘const class pcl::PointCloud’ has no member named ‘serialize’
/opt/ros/fuerte/include/ros/messagetraits.h: In static member function ‘static const char* ros::messagetraits::MD5Sum::value(const M&) [with M = pcl::PointCloud]’:
/opt/ros/fuerte/include/ros/messagetraits.h:127:3: warning: control reaches end of non-void function [-Wreturn-type]
/opt/ros/fuerte/include/ros/messagetraits.h: In static member function ‘static const char* ros::messagetraits::DataType::value(const M&) [with M = pcl::PointCloud]’:
/opt/ros/fuerte/include/ros/messagetraits.h:144:3: warning: control reaches end of non-void function [-Wreturn-type]
/opt/ros/fuerte/include/ros/serialization.h: In static member function ‘static uint32t ros::serialization::Serializer::serializedLength(typename boost::calltraits::paramtype) [with T = pcl::PointCloud, uint32t = unsigned int, typename boost::calltraits::paramtype = const pcl::PointCloud&]’:
/opt/ros/fuerte/include/ros/serialization.h:143:3: warning: control reaches end of non-void function [-Wreturn-type]
make[3]: *** [CMakeFiles/keypointsplanar.dir/src/keypointsplanar.o] Error 1
make[3]: Leaving directory `/home/jumpei/fuerteworkspace/tesis/build'
make[2]: *** [CMakeFiles/keypointsplanar.dir/all] Error 2
make[2]: Leaving directory `/home/jumpei/fuerte_workspace/tesis/build'
make[1]: *** [all] Error 2
Comments