basics.h

General

using ouster::osf::ts_t = std::chrono::nanoseconds

Common timestamp for all time in ouster::osf. Nanoseconds were chosen due to the data coming off of the sensor.

enum ouster::osf::OSF_VERSION

Enumerator for the OSF Version. This will change whenever the underlying flatbuffer structures change.

Values:

enumerator V_INVALID

Invalid OSF Version.

enumerator V_1_0

Original version of the OSF (2019/9/16)

enumerator V_1_1

Add gps/imu/car trajectory to the OSF (2019/11/14)

enumerator V_1_2

Change gps_waypoint type to Table in order to support Python language generator

enumerator V_1_3

Add extension for Message in osfChunk and for Session in osfSession (2020/03/18)

enumerator V_1_4

Gen2/128 support (2020/08/11)

enumerator V_2_0

Second Generation OSF v2.

static constexpr uint32_t ouster::osf::FLATBUFFERS_PREFIX_LENGTH = 4

Standard Flatbuffers prefix size

Todo:

[pb]: Rename this beast?

std::string ouster::osf::to_string(const HEADER_STATUS status)

To String Functionality For HEADER_STATUS

Parameters:

status[in] The data to get the string representation format

Returns:

The string representation

Buffer Operations

uint32_t ouster::osf::get_prefixed_size(const uint8_t *buf)

Reads the prefix size of the Flatbuffers buffer. First 4 bytes.

Parameters:

buf[in] Pointer to Flatbuffers buffer stared with prefixed size

Returns:

the size recovered from the stored prefix size

uint32_t ouster::osf::get_block_size(const uint8_t *buf)

Calculates the full size of the block (prefixed_size + size + CRC32).

Parameters:

buf[in] Pointer to Flatbuffers buffer stared with prefixed size

Returns:

the calculated size of the block

bool ouster::osf::check_prefixed_size_block_crc(const uint8_t *buf, const uint32_t max_size = std::numeric_limits<uint32_t>::max())

Check the prefixed size buffer CRC32 fields.

Parameters:
  • buf[in] Structured as size prefixed Flatbuffer buffer, i.e. first 4 bytes is the size of the buffer (excluding 4 bytes of the size), and the 4 bytes that follows right after the 4 + [prefixed_size] is the CRC32 bytes.

  • max_size[in] Total number of bytes that can be accessed in the buffer, as a safety precaution if buffer is not well formed, or if first prefixed size bytes are broken.

Returns:

true if CRC field is correct, false otherwise

std::string ouster::osf::to_string(const uint8_t *buf, const size_t count, const size_t max_show_count = 0)

Debug method to get hex buf values in string

Parameters:
  • buf[in] The buffer to dump to string.

  • count[in] The size of the buffer.

  • max_show_count[in] The number of bytes to dump. This arg is optional.

Returns:

The string representation

Batching

std::function<void(const osf::ts_t, const uint8_t*)> make_build_ls(const ouster::sensor::sensor_info &info, const LidarScanFieldTypes &ls_field_types, std::function<void(const ts_t, const ouster::LidarScan&)> handler)

Makes the closure to batch lidar_packets and emit LidarScan object. Result returned through callback handler(ts, LidarScan). LidarScan uses user modified field types

The above make_build_ls() function overload. In this function, LidarScan uses default field types by the profile

Param info:

[in] The sensor metadata to use.

Param ls_field_types:

[in] The field types to use.

Param handler:

[in] The callback to use on the results.

Return:

Closure to batch and emit LidarScan objects.

Param info:

[in] The sensor metadata to use.

Param handler:

[in] The callback to use on the results.

Return:

Closure to batch and emit LidarScan objects.

ChunksLayout

std::string ouster::osf::to_string(ChunksLayout chunks_layout)

To String Functionality For ChunksLayout

Parameters:

chunks_layout[in] The data to get the string representation format

Returns:

The string representation

ChunksLayout ouster::osf::chunks_layout_of_string(const std::string &s)

From String Conversion Functionality To ChunksLayout

Parameters:

s[in] The String Representation of ChunksLayout

Returns:

The corrosponding ChunksLayout object

enum ouster::osf::ChunksLayout

Chunking strategies. Refer to RFC0018 for more details.

Values:

enumerator LAYOUT_STANDARD

not used currently

enumerator LAYOUT_STREAMING

default layout (the only one for a user)