Go to the documentation of this file.00001 #include "normal_descriptor_alg_node.h"
00002
00003 NormalDescriptorAlgNode::NormalDescriptorAlgNode(void)
00004 {
00005
00006
00007
00008
00009 this->descriptor_publisher_ = this->public_node_handle_.advertise<normal_descriptor_node::ndesc_pc>("ndesc", 1);
00010
00011 this->points_subscriber_ = this->public_node_handle_.subscribe("points", 1, &NormalDescriptorAlgNode::points_callback, this);
00012
00013
00014 this->point_desc_service_ = this->public_node_handle_.advertiseService("nornal_descriptor_service", &NormalDescriptorAlgNode::points_service_callback, this);
00015
00016
00017
00018
00019
00020
00021 }
00022
00023 NormalDescriptorAlgNode::~NormalDescriptorAlgNode(void)
00024 {
00025
00026 }
00027
00028 void NormalDescriptorAlgNode::mainNodeThread(void)
00029 {
00030
00031
00032
00033
00034
00035
00036
00037
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 void NormalDescriptorAlgNode::node_config_update(Config &config, uint32_t level)
00049 {
00050 ROS_INFO("Config update");
00051 }
00052
00053
00054 void NormalDescriptorAlgNode::compute_and_publish_descs(pcl::PointCloud<pcl::PointXYZ> &cloud, normal_descriptor_node::ndesc_pc &ndesc_pc_msg)
00055 {
00056
00057
00058 this->alg_.compute_ndescs_integral_spatial(cloud, ndesc_pc_msg);
00059
00060
00061
00062
00063
00064 ndesc_pc_msg.header = pcl_conversions::fromPCL(cloud.header);
00065
00066
00067
00068 }
00069
00070
00071 void NormalDescriptorAlgNode::points_callback(const sensor_msgs::PointCloud2::ConstPtr& msg)
00072 {
00073 ROS_INFO("Received pointcloud in subscriber");
00074 pcl::PointCloud<pcl::PointXYZ> cloud;
00075 pcl::fromROSMsg(*msg, cloud);
00076 normal_descriptor_node::ndesc_pc ndesc_pc_msg;
00077 this->compute_and_publish_descs(cloud, ndesc_pc_msg);
00078 this->descriptor_publisher_.publish(ndesc_pc_msg);
00079 }
00080
00081
00082 bool NormalDescriptorAlgNode::points_service_callback(normal_descriptor_node::ndesc_pc_service::Request &req, normal_descriptor_node::ndesc_pc_service::Response &res)
00083 {
00084
00085
00086 ROS_INFO("received ndesc_pc_service call");
00087 pcl::PointCloud<pcl::PointXYZ> cloud;
00088 pcl::fromROSMsg(req.cloth_cloud, cloud);
00089
00090 this->compute_and_publish_descs(cloud, res.ndesc_pc_msg);
00091 return true;
00092 }
00093
00094 void NormalDescriptorAlgNode::addNodeDiagnostics(void)
00095 {
00096 }
00097
00098
00099 int main(int argc,char *argv[])
00100 {
00101 return algorithm_base::main<NormalDescriptorAlgNode>(argc, argv, "normal_descriptor_node");
00102 }
00103