Ask Your Question
0

Trying to understand PointCloud2 msg

asked 2017-10-16 13:33:59 -0500

krishna43 gravatar image

Hello,

Can someone please post a clear explanation of how to understand pointcloud2 message? I want to get x,y,z point from the message and I found a solution to do that, but I am not able to understand why there are so many numbers in data field?

Can someone please explain?

Thanks.

edit retag flag offensive close merge delete

Comments

What is the solution that you found? I think that people may have a hard time explaining it if they don't know what it is...

jayess gravatar imagejayess ( 2017-10-16 13:59:13 -0500 )edit

https://answers.ros.org/question/2027...

look at that question. that helped me. @jayess

krishna43 gravatar imagekrishna43 ( 2017-10-18 15:45:36 -0500 )edit

So, do you not need an explanation any more?

jayess gravatar imagejayess ( 2017-10-18 15:53:26 -0500 )edit

@jayess I need an explanation of PointCloud2 data format. I got the result i want by blindly copying the code snippet, but i don't know what it means.

krishna43 gravatar imagekrishna43 ( 2017-10-18 15:55:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-11-04 11:41:00 -0500

Ed Venator gravatar image

The data field of a PointCloud2 message contains the list of points encoded as a byte stream, where each point is a struct. The format of the points in an individual PointCloud2 message is defined by the fields, which is a list of sensor_msgs/PointField objects. In order to turn the data back into individual points, it has to be deserialized. The PointCloud library has defined methods that do this automatically (in Python, you'd use pc2.read_points.) Under the hood, these methods use memory reinterpretation to transform the byte stream to a list of points (e.g. Python's struct.unpack() or reinterpret casting in C++).

The advantage of the byte stream representation is that it's a compact way to transport the data that is extremely flexible, allowing any arbitrary struct to be used for the points. The disadvantage is that the message unreadable without deserialization.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2017-10-16 13:33:59 -0500

Seen: 3,001 times

Last updated: Nov 04 '17