rospoint-cloudslidarlidar-data

What are the contents of PointCloud2?


What does the contents of PointCloud2 means in ROS?

  1. fields.offset?
  2. fields.datatype?
  3. fields.count?
  4. point_step?
  5. 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, ...

  1. Why height in Velodyne-HDL64e LiDAR is equal to one? I expected it to be 64.

  2. Finally, for example, what is 171 value in data? is Y or is a range (for which one of the beams)?


Solution

  • 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.

    1. 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.

    2. and 3.: fields.datatype and fields.count: See this

    3. point.step is number of bytes or data entries for one point

    4. row_step: See your own link, so it is "number of points per row * point_step"

    5. Probably your scanner publishes line after line? I'm actually not sure of this one.

    6. 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.