Class FrameBatcher

Nested Relationships

Nested Types

Class Documentation

class FrameBatcher

Parse lidar packets into a LidarFrame.

Make a function that batches a single frame (revolution) of data to a LidarFrame.

Public Functions

explicit FrameBatcher(const SensorInfo &info)

Create a batcher given information about the frame and packet format.

Parameters:

info[in] sensor metadata returned from the client.

explicit FrameBatcher(const std::shared_ptr<SensorInfo> &info)

Create a batcher given information about the frame and packet format.

Parameters:

info[in] sensor metadata returned from the client.

FrameBatcher(const FrameBatcher&) = delete
FrameBatcher &operator=(const FrameBatcher&) = delete
FrameBatcher(FrameBatcher&&) = default

Move constructor.

FrameBatcher &operator=(FrameBatcher&&) = delete

Move assignment operator.

bool operator()(const Packet &packet, LidarFrame &lidar_frame)

Add a packet to the frame.

This will ignore legacy IMU packets.

Deprecated:

Use FrameBatcher batch(Packet, LidarFrame) instead. The last supported version for this will be 1.0.0 .

Parameters:
  • packet[in] an ouster data packet.

  • lidar_frame[in] lidar frame to populate.

Returns:

true when the provided lidar frame is ready to use.

bool batch(const Packet &packet, LidarFrame &lidar_frame)

Add a packet to the frame.

This will ignore legacy IMU packets.

Parameters:
  • packet[in] an ouster data packet.

  • lidar_frame[in] lidar frame to populate.

Throws:
  • std::invalid_argument – if the provided frame is a different resolution or if the number of columns per packet in the provided frame is different than the sensor info the batcher was initialized with.

  • std::runtime_error – if the batcher would produce a frame id that is not strictly greater than the previous frame id for the same sensor init id when using a FUSA packet header type.

Returns:

true when the provided lidar frame is ready to use.

void reset()

Reset the batcher and clear any cached packets.

size_t batched_packets() const

Get the number of packets batched into the frame so far.

Returns 0 if a frame was just released from operator().

Returns:

the number of packets batched into the frame so far

size_t dropped_packets() const

Get the number of packets dropped by the batcher.

A dropped packet is a packet that was not included in a frame released from operator() due to arriving after a new frame started or arriving too late to be included in a frame before it was released.

Returns:

the number of packets dropped by the batcher

void set_max_cache_size(size_t max_cache_size)

Set the maximum number of packets to hold in the cache before a new packet triggers the batcher finalizes the current frame.

Parameters:

max_cache_size[in] the maximum number of packets to hold in the cache (minimum is 1)

size_t get_max_cache_size() const

Get the maximum number of packets to hold in the cache before a new packet triggers the batcher finalizes the current frame.

Returns:

the maximum number of packets.

Public Members

PacketFormat pf

The packet format object used for decoding.