Struct Packet

Inheritance Relationships

Derived Types

Struct Documentation

struct Packet

Encapsulate a packet buffer and attributes associated with it.

Subclassed by ouster::sdk::core::ImuPacket, ouster::sdk::core::LidarPacket, ouster::sdk::core::ZonePacket

Public Functions

inline PacketType type() const

Returns the type of the packet.

Returns:

the packet type

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.

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.

inline auto packet_type() const

Read the packet type from the packet header.

Returns:

packet type

inline auto frame_id() const

Read the frame id from the packet header.

Returns:

frame id

inline auto init_id() const

Read the init id from the packet header.

Returns:

init id

inline auto prod_sn() const

Read the product serial number from the packet header.

Returns:

product serial number

inline auto alert_flags() const

Read the alert flags from the packet header.

Returns:

alert flags

inline auto countdown_thermal_shutdown() const

Read the thermal shutdown countdown from the packet header.

Returns:

thermal shutdown countdown

inline auto countdown_shot_limiting() const

Read the shot limiting countdown from the packet header.

Returns:

shot limiting countdown

inline auto thermal_shutdown() const

Read the thermal shutdown state from the packet header.

Returns:

thermal shutdown state

inline auto shot_limiting() const

Read the shot limiting state from the packet header.

Returns:

shot limiting state

inline auto crc() const

Return the CRC contained in the packet footer if present.

Returns:

crc contained in the packet if present

inline auto calculate_crc() const

Calculate the CRC for the given packet data.

Returns:

calculated crc of the packet

template<typename Type>
inline Type &as()

Attempt to cast the packet to the desired concrete PacketType.

Throws:

runtime_error – if packet is not that of that type

Template Parameters:

Type – Type of packet to cast to. Either LidarPacker or ImuPacket.

Returns:

reference to the packet as the desired type

template<typename Type>
inline const Type &as() const

Attempt to cast the packet to the desired concrete PacketType. Const overload.

Throws:

runtime_error – if packet is not that of that type

Template Parameters:

Type – Type of packet to cast to. Either LidarPacker or ImuPacket.

Returns:

reference to the packet as the desired type

Public Members

uint64_t host_timestamp

Timestamp in nanoseconds of packet capture.

std::vector<uint8_t> buf

Packet data.

std::shared_ptr<PacketFormat> format

PacketFormat associated with this packet.