neka-nat/cupoch

[CreateFromPointCloud2Msg] Field name 'rgb' is necessary.

dHofmeister opened this issue · 1 comments

Dear Neka,

I am writing a ROS python node that reads pointcloud2 messages coming from a simulator. The simulator is running the velodyne pointcloud server:
https://bitbucket.org/DataspeedInc/velodyne_simulator.git

However, this velodyne sensor does not publish a RGB channel. The signature of this message is:

header: 
  seq: 432683
  stamp: 
    secs: 86581
    nsecs: 450000000
  frame_id: "lidar_link"
height: 1
width: 45
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: 12
    datatype: 7
    count: 1
  - 
    name: "ring"
    offset: 16
    datatype: 4
    count: 1
  - 
    name: "time"
    offset: 18
    datatype: 7
    count: 1
is_bigendian: False
point_step: 22
row_step: 990
data: [186, 54, 51, 191, 143, 84, 249, 181, 152, 20, 64, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 48, 53, 191, 128, 134, 3, 190, 114, 94, 69, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 204, 39, 191, 252, 231, 123, 190, 116, 24, 64, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 40, 60, 191, 193, 214, 224, 190, 116, 235, 106, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 82, 8, 191, 221, 51, 238, 190, 149, 4, 66, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 49, 196, 190, 146, 4, 246, 190, 65, 161, 40, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 135, 30, 44, 190, 208, 110, 4, 191, 211, 62, 21, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 20 .................. omitted ............., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 187, 221, 40, 191, 40, 239, 234, 53, 106, 253, 52, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
is_dense: True

I try to read this message in a python node as such:

def pointcloud_callback(self, msg: PointCloud2) -> None:
        cph_pointfields = []
        for field in msg.fields:
            cph_pointfields.append(cupoch.cupoch.io.PointField(field.name,
                                                   field.offset,
                                                   field.datatype,
                                                   field.count))

        info = cph.io.PointCloud2MsgInfo(msg.width,
                                         msg.height,
                                         cph_pointfields,
                                         msg.is_bigendian,
                                         msg.point_step,
                                         msg.row_step,
                                         msg.is_dense)

        self.pointcloud = cph.io.create_from_pointcloud2_msg(msg.data, info)

this last step: cph.io.create_from_pointcloud2_msg(msg.data, info) , will throw:

[error] [CreateFromPointCloud2Msg] Field name 'rgb' is necessary.

I tried simply renaming the 'time' pointfield to 'rgb' because it has the same signature (datatype 7, count 1), meaning that i expected the RGB data to be nonsense, but still working. But that leads to a segfault:

terminate called after throwing an instance of 'thrust::system::system_error'
  what():  parallel_for failed: cudaErrorMisalignedAddress: misaligned address

I wonder what I am doing wrong? Is it possible to not need a RGB channel? I will only use features that don't need RGB values. (ICP, downsampling, voxel creation... )

Thank you for your time

Hi,
Thank you for the reporting.
The conversion is now possible even without the RGB field.
Please try to use the latest master.