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

Publishing Point Cloud pcl::PointXYZ

asked 2014-07-23 14:45:22 -0600

mattc12345 gravatar image

updated 2014-07-23 16:15:09 -0600

Hi,

I'm already using a variable of the type pcl::PointCloud<pcl::pointxyz>::Ptr called grasp_points that I'd like to publish. I tried to follow this example: answers.ros.org/question/35368/pointcloud-library-publishing/

Here's what I have for code:

typedef pcl::PointCloud<pcl::PointXYZ> PCLCloud;
ros::Publisher graspub = n.advertise<PCLCloud> ("grasp_points", 100);
ros::Rate loop_rate(10);
graspub.publish(grasp_points);

I also initialize ROS and the node n, and the code compiles fine. I can tell that the delay is working. But when I check rostopic list, only rosout and rosout_agg are listed. There must be something I didn't include in my code. Does anyone know what it is? Thanks!

EDIT: It might be a problem with the type. grasp_points is acutally a pcl::PointCloud<pcl::pointxyz>::Ptr {aka boost::shared_ptr<pcl::pointcloud<pcl::pointxyz> >}

I also have a variables of the types std::vector<pcl::pointxyz> and pcl::visualization::PointCloudColorHandlerCustom<pcl::pointxyz>. Would I be able to publish either of those?

EDIT 2: Okay, I found the data stored as floats, so I can just publish those.

edit retag flag offensive close merge delete

Comments

what is data type of grasp_points ?

bvbdort gravatar image bvbdort  ( 2014-07-23 16:40:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-23 21:05:09 -0600

sai gravatar image

updated 2014-07-23 21:06:53 -0600

You should probably use

 typedef pcl::PointCloud<pcl::PointXYZ> PCLCloud;
 graspub.publish(*grasp_points);
 ros::Publisher graspub = n.advertise<PCLCloud> ("grasp_points", 100);
 ros::Rate loop_rate(10);

Check the * added to the grasp_points and the order of the lines.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-07-23 14:45:22 -0600

Seen: 2,034 times

Last updated: Jul 23 '14