Class ScanSource

Inheritance Relationships

Derived Types

Class Documentation

class ScanSource

Provides a base API for classes that provide access to scans in a file.

Subclassed by ouster::sdk::core::AnyScanSource, ouster::sdk::core::Collator, ouster::sdk::core::MultiScanSource, ouster::sdk::core::Singler, ouster::sdk::core::Slicer, ouster::sdk::osf::OsfScanSource, ouster::sdk::pcap::PcapScanSource, ouster::sdk::sensor::SensorScanSource

Public Functions

virtual ~ScanSource() = default
virtual ScanIterator begin() const = 0

Provides each scan from all sensors in time order.

Returns:

start iterator for all sensors

virtual ScanIterator begin(int sensor_index) const = 0

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

Parameters:
  • sensor_index[in] sensor index

  • 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

Return the end iterator.

Returns:

end iterator

virtual const std::vector<std::shared_ptr<SensorInfo>> &sensor_info() const = 0

Get the sensor info for each sensor in this dataset.

Returns:

sensor info for each sensor

virtual bool is_live() const

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

Returns:

if live or not

virtual bool is_indexed() const

Indicates if the source contains an index for fast random access.

Returns:

if indexed or not

virtual size_t size_hint() const = 0

The approximate length of the source if unindexed, or the real size if indexed.

Live sources or sources with undefined length will return 0.

Returns:

approximate length of source

virtual size_t size() const

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<size_t> &scans_num() const

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 LidarScanSet operator[](int index) const

Returns the Nth scan in time order Supports negative indices for python-like indexing behavior.

Returns:

scan at given index

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

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

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 std::unique_ptr<ScanSource> move() = 0

move into a newly allocated item

Returns:

a unique pointer to a newly allocated ScanSource instance containing the moved-from state.

template<class T = Singler>
inline T single(int sensor_idx = 0) const &

Get only a single sensor’s stream from this source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

sensor_idx[in] Index of the sensor.

Returns:

singled scan source

template<class T = Singler>
inline T single(int sensor_idx = 0) &&

Get only a single sensor’s stream from this source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

sensor_idx[in] Index of the sensor.

Returns:

singled scan source

template<class T = Slicer>
inline T operator[](std::initializer_list<nonstd::optional<int>> l) const &

Slice a scan source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

l[in] slice

Returns:

sliced scan source

template<class T = Slicer>
inline T operator[](std::initializer_list<nonstd::optional<int>> l) &&

Returns the Nth scan in time order Supports negative indices for python-like indexing behavior.

Returns:

scan at given index