ouster.sdk.pcap

Module contents

Copyright (c) 2021, Ouster, Inc. All rights reserved.

Pcap tools to record/read/write Ouster sensor data.

ouster.sdk.pcap.packet_iter

ichunked_before(it, pred)[source]

Return the given stream chunked by the predicate.

Each sub-iterator will be fully consumed when the next chunk is requested. No caching of unused items is performed, so client code should evaluate sub-iterators (e.g. into lists) to avoid dropping items.

This should behave same as more_itertools.split_before, except that chunks aren’t eagerly evaluated into lists. This makes it safe to use on streams where it’s possible that pred never evaluates to true.

Return type:

Iterator[Iterator[TypeVar(T)]]

class RecordingPacketSource(source, prefix_path, *, sensor_idx=-1, n_seconds=0.0, n_frames, chunk_size=0, src_ip='127.0.0.1', dst_ip='127.0.0.1', lidar_port=-1, imu_port=-1, use_sll_encapsulation=False, overwrite=True)[source]

Bases: object

ouster.sdk.pcap.pcap

Copyright (c) 2021, Ouster, Inc. All rights reserved.

record(packets, pcap_path, *, src_ip='127.0.0.1', dst_ip='127.0.0.1', lidar_port=7502, imu_port=7503, use_sll_encapsulation=False)[source]

Record a sequence of sensor packets to a pcap file.

Parameters:
  • packets (Iterable[Packet]) – A (finite!) sequence of packets

  • pcap_path (str) – Path of the output pcap file

  • src_ip (str) – Source IP to use for all packets

  • dst_ip (str) – Destination IP to use for all packets

  • lidar_port (int) – Src/dst port to use for lidar packets

  • imu_port (int) – Src/dst port to use for imu packets

  • use_sll_encapsulation (bool) – Use sll encapsulation

Return type:

int

Returns:

Number of packets captured

PcapPacketSource

class PcapPacketSource(self: ouster.sdk._bindings.client.PacketSource)

PcapPacketSource produces packets from a given PCAP file.

Parameters:
  • file (str) – The path to the PCAP file.

  • kwargs (dict) – Additional options for configuring the packet source.

id_error_count

The number of packets with ID errors.

Type:

int

size_error_count

The number of packets with size errors.

Type:

int

__annotations__ = {}
__init__(self: ouster.sdk._bindings.client.PacketSource) None
__module__ = 'ouster.sdk._bindings.pcap'
property id_error_count
property size_error_count

PcapScanSource

class PcapScanSource(self: ouster.sdk._bindings.client.ScanSource)

PcapScanSource is a class for producing LidarScans from a given PCAP file.

__annotations__ = {}
__init__(self: ouster.sdk._bindings.client.ScanSource) None
__iter__(self: ouster.sdk._bindings.client.ScanSource) ouster.sdk._bindings.client.scan_iterator
__module__ = 'ouster.sdk._bindings.pcap'
property id_error_count
property size_error_count

PcapDuplicatePortException

class PcapDuplicatePortException
__module__ = 'ouster.sdk._bindings.pcap'
__weakref__

list of weak references to the object (if defined)

PacketInfo

class PacketInfo
__annotations__ = {}
__init__()
__module__ = 'ouster.sdk._bindings.pcap'
__repr__()

Return repr(self).

property dst_ip
property dst_port
property encapsulation_protocol
property file_offset
property fragments_in_packet
property ip_version
property network_protocol
property payload_size
property src_ip
property src_port
property timestamp