scan_source_utils.h

Class

class AnyPacketSource : public ouster::core::PacketSource

Wraps a shared pointer to a ScanSource to allow easy use of it by value.

Public Functions

AnyPacketSource(std::unique_ptr<PacketSource> source)

Construct an AnyPacketSource from a provided source, taking ownership of it

Parameters:

source – [in] the source to wrap and take ownership of

virtual PacketIterator begin() const override

Get begin iterator for container. Provides each scan from all sensors in time order

Returns:

iterator to first item in source

virtual PacketIterator end() const override

Get end iterator for source.

Returns:

iterator to end of source

virtual const std::vector<std::shared_ptr<ouster::sensor::sensor_info>> &sensor_info() const override

Get the sensor_info for each sensor in the source

Returns:

info about each sensor

virtual bool is_live() const override

Indicates if the source is streaming from a device, such as a sensor

Returns:

if live or not

std::shared_ptr<PacketSource> child() const

Get the PacketSource wrapped by this PacketSource

Returns:

wrapped PacketSource

class AnyScanSource : public ouster::core::ScanSource

Wraps a shared pointer to a ScanSource to allow easy use of it by value.

Public Functions

AnyScanSource(std::unique_ptr<ScanSource> source)

Construct an AnyScanSource from a provided source, taking ownership of it

Parameters:

source – [in] the source to wrap and take ownership of

virtual ScanIterator begin() const override

Provides each scan from all sensors in time order

Returns:

start iterator for all sensors

virtual ScanIterator begin(int idx) const override

Provides scans from a single sensor in time order If idx < 0 provides scans from all sensors

Parameters:

sensor_index – [in] sensor index

Throws:

std::runtime_error – if sensor_idx >= number of sensors

Returns:

start iterator for the sensor with the given index

virtual ScanIterator end() const override

Return the end iterator

Returns:

end iterator

virtual const std::vector<std::shared_ptr<ouster::sensor::sensor_info>> &sensor_info() const override

Get the sensor info for each sensor in this dataset

Returns:

sensor info for each sensor

virtual bool is_live() const override

Indicates if the source is streaming from a device, such as a sensor

Returns:

if live or not

virtual bool is_indexed() const override

Indicates if the source contains an index for fast random access

Returns:

if indexed or not

virtual size_t size() const override

The length of the source from begin to end. For example: If uncollated this is the total number of scans in the source, if collated this is the number of scan collations.

Throws:

std::runtime_error – if unindexed

Returns:

length of the source

virtual const std::vector<std::vector<std::pair<uint64_t, uint64_t>>> &individual_index() const override

timestamp based index of all scans in the file for each sensor, each pair is timestamp followed by global scan index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<std::pair<uint64_t, uint64_t>> &full_index() const override

timestamp based index of all scans in the file, each pair is timestamp followed by sensor index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<size_t> &scans_num() const override

Get the scan count for each sensor in the file

Throws:

std::runtime_error – if unindexed

Returns:

scan count for each sensor in the file

std::shared_ptr<ScanSource> child() const

Get the ScanSource wrapped by this ScanSource

Returns:

wrapped ScanSource

class Collator : public ouster::core::ScanSource

ScanSource that collates a given ScanSource.

Public Functions

Collator(std::unique_ptr<ScanSource> source, uint64_t dt_ns = 210000000)

Collate the provided source with the provided cut interval.

Parameters:
  • source – [in] source to collate

  • dt_ns – [in] interval in nanoseconds after which to cut collated scans

Collator(const ScanSource &source, uint64_t dt_ns = 210000000)

Collate the provided source with the provided cut interval.

Parameters:
  • source[in] source to collate

  • dt_ns[in] interval in nanoseconds after which to cut collated scans

Collator(ScanSource &&source, uint64_t dt_ns = 210000000)

Collate the provided source with the provided cut interval.

Parameters:
  • source[in] source to collate

  • dt_ns[in] interval in nanoseconds after which to cut collated scans

virtual ScanIterator begin() const override

Provides each scan from all sensors in time order

Returns:

start iterator for all sensors

virtual ScanIterator begin(int sensor_index) const override

Provides scans from a single sensor in time order If idx < 0 provides scans from all sensors

Parameters:

sensor_index – [in] sensor index

Throws:

std::runtime_error – if sensor_idx >= number of sensors

Returns:

start iterator for the sensor with the given index

virtual const std::vector<std::shared_ptr<ouster::sensor::sensor_info>> &sensor_info() const override

Get the sensor info for each sensor in this dataset

Returns:

sensor info for each sensor

virtual bool is_live() const override

Indicates if the source is streaming from a device, such as a sensor

Returns:

if live or not

virtual bool is_indexed() const override

Indicates if the source contains an index for fast random access

Returns:

if indexed or not

virtual const std::vector<std::pair<uint64_t, uint64_t>> &full_index() const override

timestamp based index of all scans in the file, each pair is timestamp followed by sensor index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<std::vector<std::pair<uint64_t, uint64_t>>> &individual_index() const override

timestamp based index of all scans in the file for each sensor, each pair is timestamp followed by global scan index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<size_t> &scans_num() const override

Get the scan count for each sensor in the file

Throws:

std::runtime_error – if unindexed

Returns:

scan count for each sensor in the file

class Singler : public ouster::core::ScanSource

ScanSource that iterates over a single stream in a ScanSource.

Public Functions

Singler(const ScanSource &source, size_t idx)

Single the provided source, getting the sensor with the provided index.

Parameters:
  • source – [in] source to single

  • idx – [in] index of sensor to single out

Singler(ScanSource &&source, size_t idx)

Single the provided source, getting the sensor with the provided index.

Parameters:
  • source[in] source to single

  • idx[in] index of sensor to single out

Singler(std::unique_ptr<ScanSource> source, size_t idx)

Single the provided source, getting the sensor with the provided index.

Parameters:
  • source[in] source to single

  • idx[in] index of sensor to single out

virtual ScanIterator begin() const override

Provides each scan from all sensors in time order

Returns:

start iterator for all sensors

virtual ScanIterator begin(int idx) const override

Provides scans from a single sensor in time order If idx < 0 provides scans from all sensors

Parameters:

sensor_index – [in] sensor index

Throws:

std::runtime_error – if sensor_idx >= number of sensors

Returns:

start iterator for the sensor with the given index

virtual ScanIterator end() const override

Return the end iterator

Returns:

end iterator

virtual bool is_live() const override

Indicates if the source is streaming from a device, such as a sensor

Returns:

if live or not

virtual bool is_indexed() const override

Indicates if the source contains an index for fast random access

Returns:

if indexed or not

virtual const std::vector<size_t> &scans_num() const override

Get the scan count for each sensor in the file

Throws:

std::runtime_error – if unindexed

Returns:

scan count for each sensor in the file

virtual const std::vector<std::shared_ptr<ouster::sensor::sensor_info>> &sensor_info() const override

Get the sensor info for each sensor in this dataset

Returns:

sensor info for each sensor

virtual const std::vector<std::pair<uint64_t, uint64_t>> &full_index() const override

timestamp based index of all scans in the file, each pair is timestamp followed by sensor index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<std::vector<std::pair<uint64_t, uint64_t>>> &individual_index() const override

timestamp based index of all scans in the file for each sensor, each pair is timestamp followed by global scan index

Throws:

std::runtime_error – if unindexed

Returns:

index

class Slicer : public ouster::core::ScanSource

ScanSource that slices a given ScanSource.

Public Functions

Slicer(const ScanSource &source, int start, int end, int step)

Slice the provided source with the provided bounds.

Parameters:
  • source – [in] source to slice

  • start – [in] start index of slice

  • end – [in] end index of slice

  • step – [in] step size of slice

Slicer(ScanSource &&source, int start, int end, int step)

Slice the provided source with the provided bounds.

Parameters:
  • source[in] source to slice

  • start[in] start index of slice

  • end[in] end index of slice

  • step[in] step size of slice

virtual ScanIterator begin() const override

Provides each scan from all sensors in time order

Returns:

start iterator for all sensors

virtual ScanIterator begin(int idx) const override

Provides scans from a single sensor in time order If idx < 0 provides scans from all sensors

Parameters:

sensor_index – [in] sensor index

Throws:

std::runtime_error – if sensor_idx >= number of sensors

Returns:

start iterator for the sensor with the given index

virtual bool is_live() const override

Indicates if the source is streaming from a device, such as a sensor

Returns:

if live or not

virtual bool is_indexed() const override

Indicates if the source contains an index for fast random access

Returns:

if indexed or not

virtual const std::vector<size_t> &scans_num() const override

Get the scan count for each sensor in the file

Throws:

std::runtime_error – if unindexed

Returns:

scan count for each sensor in the file

virtual const std::vector<std::shared_ptr<ouster::sensor::sensor_info>> &sensor_info() const override

Get the sensor info for each sensor in this dataset

Returns:

sensor info for each sensor

virtual const std::vector<std::pair<uint64_t, uint64_t>> &full_index() const override

timestamp based index of all scans in the file, each pair is timestamp followed by sensor index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<std::vector<std::pair<uint64_t, uint64_t>>> &individual_index() const override

timestamp based index of all scans in the file for each sensor, each pair is timestamp followed by global scan index

Throws:

std::runtime_error – if unindexed

Returns:

index

Functions

Collator ouster::core::collate(const ScanSource &source)

Build a scan source that collates the provided source

Returns:

scan source collating the provided source

Collator ouster::core::collate(ScanSource &&source)

Build a scan source that collates the provided source

Returns:

scan source collating the provided source