Skip to content

Commit

Permalink
reverted back to original ROS message structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jupidity committed Aug 8, 2017
1 parent d403e53 commit 047b652
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Author: Sean Cassero
#include <pcl/kdtree/kdtree.h>
#include <pcl/segmentation/extract_clusters.h>
#include <obj_recognition/SegmentedClustersArray.h>
#include <obj_recognition/ClusterData.h>


class segmentation {
Expand Down Expand Up @@ -160,6 +161,10 @@ void segmentation::cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud_msg)
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it)
{

// create a new clusterData message object
//obj_recognition::ClusterData clusterData;


// create a pcl object to hold the extracted cluster
pcl::PointCloud<pcl::PointXYZRGB> *cluster = new pcl::PointCloud<pcl::PointXYZRGB>;
pcl::PointCloud<pcl::PointXYZRGB>::Ptr clusterPtr (cluster);
Expand All @@ -169,16 +174,25 @@ void segmentation::cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud_msg)
for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
{
clusterPtr->points.push_back(xyzCloudPtrRansacFiltered->points[*pit]);

}


// log the position of the cluster
//clusterData.position[0] = (*cloudPtr).data[0];
//clusterData.position[1] = (*cloudPtr).points.back().y;
//clusterData.position[2] = (*cloudPtr).points.back().z;
//std::string info_string = string(cloudPtr->points.back().x);
//printf(clusterData.position[0]);

// convert to pcl::PCLPointCloud2
pcl::toPCLPointCloud2( *clusterPtr ,outputPCL);

// Convert to ROS data type
pcl_conversions::fromPCL(outputPCL, output);

// add the cluster to the array message
//clusterData.cluster = output;
CloudClusters.clusters.push_back(output);

}
Expand Down

0 comments on commit 047b652

Please sign in to comment.