What does the contents of PointCloud2 means in ROS?
fields.offset
?fields.datatype
?fields.count
?point_step
?row_step
?Its documentation is poor
Here is a published PointCloud2 message by Velodyne LiDAR:
header:
seq: 1071
stamp:
secs: 1521699326
nsecs: 676390000
frame_id: "velodyne"
height: 1
width: 66811
fields:
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
datatype: 7
count: 1
-
name: "z"
offset: 8
datatype: 7
count: 1
-
name: "intensity"
offset: 16
datatype: 7
count: 1
-
name: "ring"
offset: 20
datatype: 4
count: 1
is_bigendian: False
point_step: 32
row_step: 2137952
data: [235, 171, 54, 190, 53, 107, 250, ...
Why height in Velodyne-HDL64e LiDAR is equal to one? I expected it to be 64.
Finally, for example, what is 171 value in data
? is Y
or is a range (for which one of the beams)?
Maybe I'm a bit late, but for anybody having the same Problem:
For question 1.-3. see this. Also what you need to have in mind, is that the data is stored as uint8, but your points should be in float32, if I see it correctly. Therefore each value (x,y,z,intensity, etc.) or "field" is stored as multiple uint8 bytes. So you need 4 data entries to represent the x value of one point. The total length of one point in bytes is stored as "point_step", answering your fourth question.
The Field Offset is the number of bytes from the start of the point to the byte, in which this field begins to be stored. So every point has the first 4 bytes for x, then with an offset of 4 start the bytes for y etc.
and 3.: fields.datatype and fields.count: See this
point.step is number of bytes or data entries for one point
row_step: See your own link, so it is "number of points per row * point_step"
Probably your scanner publishes line after line? I'm actually not sure of this one.
No, the first 4 entries represent the x value, so 235, 171, 190, 53 equals: 11101011 10101011 10111110 00110101 and this represents a float32 value. The 171 has no direct information about the x, y or z value of the point.