Struct VoxelGrid

Struct Documentation

struct VoxelGrid

A 3D grid of data.

Public Functions

FoxgloveError encode(uint8_t *ptr, size_t len, size_t *encoded_len)

Encoded the VoxelGrid as protobuf to the provided buffer.

On success, writes the serialized length to *encoded_len. If the provided buffer has insufficient capacity, writes the required capacity to *encoded_len and returns FoxgloveError::BufferTooShort. If the message cannot be encoded, writes the reason to stderr and returns FoxgloveError::EncodeError.

Parameters:
  • ptr – the destination buffer. must point to at least len valid bytes.

  • len – the length of the destination buffer.

  • encoded_len – where the serialized length or required capacity will be written to.

Public Members

std::optional<Timestamp> timestamp

Timestamp of grid.

std::string frame_id

Frame of reference.

std::optional<Pose> pose

Origin of grid’s corner relative to frame of reference.

uint32_t row_count = 0

Number of grid rows.

uint32_t column_count = 0

Number of grid columns.

std::optional<Vector3> cell_size

Size of single grid cell along x, y, and z axes, relative to pose

uint32_t slice_stride = 0

Number of bytes between depth slices in data

uint32_t row_stride = 0

Number of bytes between rows in data

uint32_t cell_stride = 0

Number of bytes between cells within a row in data

std::vector<PackedElementField> fields

Fields in data. red, green, blue, and alpha are optional for customizing the grid’s color.

std::vector<std::byte> data

Grid cell data, interpreted using fields, in depth-major, row-major (Z-Y-X) order.

For the data element starting at byte offset i, the coordinates of its corner closest to the origin will be:

z = i / slice_stride * cell_size.z

y = (i % slice_stride) / row_stride * cell_size.y

x = (i % row_stride) / cell_stride * cell_size.x

Public Static Functions

static Schema schema()

Get the VoxelGrid schema.

The schema data returned is statically allocated.