Struct LidarPacket

Inheritance Relationships

Base Type

Struct Documentation

struct LidarPacket : public ouster::sdk::core::Packet

Encapsulate a lidar packet buffer and attributes associated with it.

Public Functions

OUSTER_DIAGNOSTIC_POP LidarPacket()

Construct a new empty Lidar Packet.

LidarPacket(int size)

Construct a new Lidar packet with a pre-allocated size.

Parameters:

size[in] size in bytes to allocate

PacketValidationFailure validate(const SensorInfo &info, const PacketFormat &format) const

Validates that the packet matches the expected format and metadata.

Parameters:
  • info[in] expected sensor_metadata

  • format[in] expected PacketFormat

Returns:

a PacketValdationFailure with either NONE or a failure reason.

PacketValidationFailure validate(const SensorInfo &info) const

Validates that the packet matches the expected format and metadata.

Parameters:

info[in] expected sensor_metadata

Returns:

a PacketValdationFailure with either NONE or a failure reason.

inline auto nth_col(int n) const

Get pointer to the nth column in the packet.

Parameters:

n[in] which column

Returns:

pointer to the nth column in this packet

inline auto nth_px(int n, const uint8_t *col_buf) const

Get pointer to the nth pixel of a column buffer.

Parameters:
  • n[in] which pixel

  • col_buf[in] pointer to column data

Returns:

pointer to the nth pixel of a column buffer

inline auto col_timestamp(const uint8_t *col_buf) const

Read column timestamp from a column buffer.

Parameters:

col_buf[in] pointer to column data

Returns:

column timestamp

inline auto col_measurement_id(const uint8_t *col_buf) const

Read column measurement id from a column buffer.

Parameters:

col_buf[in] pointer to column data

Returns:

column measurement id

inline auto col_status(const uint8_t *col_buf) const

Read column status from a column buffer.

Parameters:

col_buf[in] pointer to column data

Returns:

column status

template<typename T>
inline void col_field(const uint8_t *col_buf, const std::string &f, T *dst, int dst_stride = 1) const

Copy the specified channel field out of a packet measurement block.

Template Parameters:

T – T should be a numeric type large enough to store values of the specified field. Otherwise, data will be truncated.

Parameters:
  • col_buf[in] a measurement block pointer returned by nth_col().

  • f[in] the channel field to copy.

  • dst[out] destination array of size pixels_per_column * dst_stride.

  • dst_stride[in] stride for writing to the destination array.

inline auto footer() const

Get a pointer to the packet footer.

Returns:

pointer to packet footer of lidar buffer, can be nullptr if packet format doesn’t have packet footer.

inline auto block_parsable() const

Returns maximum available size of parsing block usable with block_field.

Returns:

if packet format does not allow for block parsing, returns 0

template<typename T, int BlockDim>
inline void block_field(Eigen::Ref<img_t<T>> field, const std::string &f) const

Copy the specified channel field out of a packet measurement block.

Faster traversal than col_field, but has to copy the entire packet all at once.

Parameters:
  • field[out] destination eigen array

  • f[in] the channel field to copy

Template Parameters:

T – T should be a numeric type large enough to store values of the specified field. Otherwise, data will be truncated.

Public Static Attributes

static const PacketType MY_TYPE = PacketType::Lidar

PacketType enum for this packet type.

static OUSTER_DIAGNOSTIC_PUSH OUSTER_DIAGNOSTIC_IGNORE_UNUSED const PacketType my_type   = PacketType::Lidar

Deprecated:

Use MY_TYPE instead. This will be removed in a future release.