pcap_scan_source.h

Class

class PcapScanSource : public ouster::core::ScanSource, private ouster::impl::ScanSourceBuilder<ouster::core::IoType::PCAP, PcapScanSource>

ScanSource that produces LidarScans from a given PCAP file.

Public Functions

PcapScanSource(const std::string &n, const std::function<void(PcapScanSourceOptions&)> &options = {})

open_source compatible constructor

Parameters:
  • n – [in] sensor hostnames to connect to

  • options – [in] scan source options

PcapScanSource(const std::string &source, PcapScanSourceOptions options)

open_source compatible constructor

Parameters:
  • source – [in] sensor hostnames to connect to, for multiple comma separate

  • options – [in] scan source options

virtual ouster::core::ScanIterator begin() const override

Provides each scan from all sensors in time order

Returns:

start iterator for all sensors

virtual ouster::core::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 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 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::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

uint64_t id_error_count() const

Return the number of id errors that occurred while building scans

Returns:

count of id errors

uint64_t size_error_count() const

Return the number of size errors that occurred while building scans

Returns:

count of size errors

Structs

struct PcapScanSourceOptions : private ouster::ScanSourceOptions

Options for the PcapScanSource.

Public Functions

void check(const char *source_type) const

Check if any parameters are unused

Parameters:

source_type – [in] name of source type

Throws:

std::runtime_error – if any parameters are unused

Public Members

impl::Parameter<std::vector<Eigen::Matrix<double, 4, 4, Eigen::RowMajor>>> extrinsics

list of extrinsics matrices to apply to the sensor with the same index, overrides any extrinsics loaded from file

impl::Parameter<std::string> extrinsics_file

file to load extrinsics from

impl::Parameter<nonstd::optional<std::vector<std::string>>> field_names

list of fields to decode into LidarScans, if not set decodes all fields, if an empty array decodes no fields

impl::Parameter<bool> index

if true, ensure that this file is indexed, indexing in place if necessary

impl::Parameter<std::vector<std::string>> meta

optional list of metadata files to load with some formats, if not provided files are attempted to be found automatically

impl::Parameter<bool> raw_fields

If true, batch raw_fields into each scan.

impl::Parameter<bool> raw_headers

If true, batch raw_headers into each scan.

impl::Parameter<std::vector<ouster::sensor::sensor_info>> sensor_info

Override sensor info. If provided used instead of talking to the sensor.

impl::Parameter<bool> soft_id_check

If true, accept packets/scans that don’t match the init_id/sn of the metadata