scan_source.h

Class

class ScanSource

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

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

Public Functions

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

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<ouster::sensor::sensor_info>> &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 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 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 std::vector<std::shared_ptr<LidarScan>> operator[](int index) const

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

Returns:

scan at given index

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

Get only a single sensor’s stream from this source

Parameters:

sensor_idx – <[in] index of sensor

Template Parameters:

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

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

Parameters:

sensor_idx – <[in] index of sensor

Template Parameters:

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

Returns:

singled scan source

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

Slice a scan source

Parameters:

l – <[in] slice

Template Parameters:

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

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

Structs

struct Slice

Describes a slice into an array-like datastructure.

Public Members

int start = 0

start index of the slice

int end = std::numeric_limits<int>::max()

end index of the slice

int step = 1

step size when iterating through the slice