point_cloud point position data

Hi, I’m writing a node to take data from our Livox lidar (a point cloud) and unpack it, work some math to generate a simulated flatscan (a 2D set of angles and ranges) for use with Isaac’s implementation of Cartographer which appears to take only a flatscan as of 2019.2.

In order to do this, I’m attempting to unpack the point “positions” data from the point_cloud proto, but I am having some difficulty.

For reference, as point_cloud and sample_cloud protos don’t appear to be defined in the current documentation, here are the protos in question:

# A message about a cloud of points.
struct PointCloudProto {
  # The positions of the points
  positions @0:  SampleCloudProto;
  # Optional data about the normals at each point. Must match the number of positions.
  normals @1: SampleCloudProto;
  # The colors at each position. This is optional, but if present must have the same length as `positions`.
  colors @2: SampleCloudProto;
  # The intensity at each position, used for example by LIDAR sensors. This is optional, but if present must
  # have the same length as `positions`.
  intensities @3: SampleCloudProto;

# a collection of data samples where each sample has N data channels of the
# the same data type, e.g., a Set of 3D points or a RGB color map for a set of points
struct SampleCloudProto {
  # The type of data stored in the sample cloud
  elementType @0: ElementType;
  # the number of data channels per sample
  channels @1: UInt16;
  # the number of data samples
  sampleCount @2: UInt64;
  # specifies the memory layout used for storage.
  storageOrder @3: StorageOrder;
  # Index of buffer which contains the sample cloud data
  dataBufferIndex @4: UInt16;

I’m attempting to pull actual coordinate data out of the positions SampleCloudProto, but I can only seem to access its sub-members:

  • elementType (= Float32)
  • channels (= 3)
  • sampleCount (= 1000)
  • storageOrder (= interleaved)
  • dataBufferIndex (= 0)

The values in parentheses are the only data I seem to be able to get out of this proto. I’m sure I’m missing something simple, but can anyone give me an idea of how to retrieve actual point position data from the PointCloudProto or SampleCloud within? I’m currently working in python but interested in any implementation/examples, I can work in C++ as well.

Thank you,

Hi Travis,
Did you end up solving this issue?

The “dataBufferIndex” is an index, not the actual data. You should use the SampleCloudProto’s FromProto method (have look at messages/sample_cloud.hpp). The last parameter of this method is of type SampleCloudBase (defined in engine/core/sample_cloud/sample_cloud.hpp) and it is where you can “put your points” and access them (like a normal array).

Can you share the part of the code where you are accessing the data so I can check what are you missing?

Hello Travis is this still an open issue?

I am attempting to do the same thing, retrieve the position data on the python side. Is there a way to do this without the C++ implementation? And if not, would you be willing to provide an example of how you would implement it with the FromProto method?

Thank you,