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

Interpreting stored cloud file from PointCloud2 data type

asked 2012-01-31 23:31:43 -0500

alfa_80 gravatar image

updated 2012-02-01 00:08:13 -0500

I am having a problem in interpreting a point cloud data stored in PointCloud2 of data type. The file is generated by "rostopic echo.." my cloud topic. My goal is to find corresponding x, y and z values, in terms of coordinates so that I can use them in plotting with MatLab or Octave. I am aware of this link, but, I still cannot see the use of it.

The fields in the stored file looks like this:

%time,field.header.seq,field.header.stamp,field.header.frame_id,field.height,field.width,field.fields0.name,field.fields0.offset,field.fields0.datatype,field.fields0.count,field.fields1.name,field.fields1.offset "and so on"

Or, is it wise to convert from PointCloud2 first into another format before I can plot it. If so, in what format, it serves the best for this purpose? Or any other smarter way of doing it.

Thanks in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-07-11 05:54:09 -0500

tbernhard gravatar image

updated 2012-07-11 08:27:30 -0500

There is probably a more direct method, but I've used PCL's .pcd format to accomplish this.

EDIT: Dan Lazewatsky pointed out pointcloud_to_pcd, which converts a ROS PointCloud2 msg to a .pcd file. See his comment for the docs.

Once you have it as a .pcd, it should be fairly easy to parse. After the header the points are listed one per line: x y z rgb. Note that PCL packs the RBG (and alpha, if you're using it) channels into a single float.

Related docs and tutorials: pcl::fromROSmsg | writing to a .pcd file | .pcd file format

edit flag offensive delete link more

Comments

pointcloud_to_pcd in pcl_ros does exactly that: http://www.ros.org/wiki/pcl_ros#pointcloud_to_pcd

Dan Lazewatsky gravatar image Dan Lazewatsky  ( 2012-07-11 06:57:27 -0500 )edit

Thanks, hadn't come across that. good to know

tbernhard gravatar image tbernhard  ( 2012-07-11 08:28:16 -0500 )edit
1

answered 2016-06-10 15:02:52 -0500

Wilianson gravatar image

Hi, I had a similar problem, maybe this answer can be useful for you this link

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-01-31 23:31:43 -0500

Seen: 2,709 times

Last updated: Jun 10 '16