Module ouster.sdk.pcap
ouster.sdk.pcap
- class PcapPacketSource
Bases:
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
- property id_error_count
- property size_error_count
- class PcapScanSource
Bases:
ScanSource
PcapScanSource is a class for producing LidarScans from a given PCAP file.
- property id_error_count
- property size_error_count
- exception PcapDuplicatePortException
Bases:
Exception
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 packetspcap_path (
str
) – Path of the output pcap filesrc_ip (
str
) – Source IP to use for all packetsdst_ip (
str
) – Destination IP to use for all packetslidar_port (
int
) – Src/dst port to use for lidar packetsimu_port (
int
) – Src/dst port to use for imu packetsuse_sll_encapsulation (
bool
) – Use sll encapsulation
- Return type:
int
- Returns:
Number of packets captured
- _replay(pcap_path, info, dst_ip, dst_lidar_port, dst_imu_port, address=None)[source]
Replay UDP packets out over the network.
- Parameters:
pcap_path (
str
) – Path to the pcap file to replayinfo (
SensorInfo
) – The sensor metadatadst_ip (
str
) – IP to send packets todst_lidar_port (
int
) – Destination port for lidar packetsdst_imu_port (
int
) – Destination port for imu packetsaddress (
Optional
[Tuple
[str
,int
]]) – Address and port to bind to send packets from. Optional.
- Return type:
Iterator
[bool
]- Returns:
An iterator that reports whether packets were sent successfully as it’s consumed.