Class IndexedPcapReader
Defined in File indexed_pcap_reader.h
Inheritance Relationships
Base Type
public ouster::sdk::pcap::PcapReader(Class PcapReader)
Class Documentation
-
class IndexedPcapReader : public ouster::sdk::pcap::PcapReader
A PcapReader that allows seeking to the start of a lidar frame.
The index must be computed by iterating through all packets and calling
update_index_for_current_packet()for each one.Public Functions
-
IndexedPcapReader(const std::string &pcap_filename, const std::vector<std::string> &metadata_filenames)
- Parameters:
pcap_filename[in] - A file path of the pcap to read
metadata_filenames[in] - A vector of sensor metadata file paths
pcap_filename[in] – A file path of the pcap to read
metadata_filenames[in] – A vector of sensor metadata filepaths
-
IndexedPcapReader(const std::string &pcap_filename, const std::vector<ouster::sdk::core::SensorInfo> &sensor_infos)
- Parameters:
pcap_filename[in] – A file path of the pcap to read
sensor_infos[in] – A vector of sensor info structures for each sensors
-
void build_index()
This method constructs the index.
Call this method before requesting the index information using get_index()
-
const PcapIndex &get_index() const
Get index for the underlying pcap.
- Returns:
returns a PcapIndex object
-
nonstd::optional<size_t> sensor_idx_for_current_packet(bool soft_id_check = false) const
Attempts to match the current packet to one of the sensor info objects and returns the appropriate packet format if there is one.
- Parameters:
soft_id_check[in] – if id mismatches should be ignored
- Returns:
An optional sensor index for the current packet
-
std::pair<IdxErrorType, nonstd::optional<size_t>> check_sensor_idx_for_current_packet(bool soft_id_check) const
Attempts to match the current packet to one of the sensor info objects and returns the appropriate packet format if there is one.
- Parameters:
soft_id_check[in] – if id mismatches should be ignored
- Returns:
An optional packet format for the current packet
-
nonstd::optional<uint16_t> current_frame_id() const
- Returns:
the current packet’s frame_id if the packet is associated with a sensor (and its corresponding packet format)
-
int update_index_for_current_packet()
Updates the frame index for the current packet.
- Returns:
the progress of indexing as an int from [0, 100]
-
const std::vector<ouster::sdk::core::SensorInfo> &sensor_info() const
Get the SensorInfo for each sensor in this pcap.
- Returns:
the SensorInfo for each sensor in this pcap
Public Static Functions
-
static bool frame_id_rolled_over(uint16_t previous, uint16_t current)
Return true if the frame_id from the packet stream has rolled over, hopefully avoiding spurious result that could occur from out of order or dropped packets.
- Parameters:
previous[in] – The previous frame id.
current[in] – The current frame id.
- Returns:
true if the frame id has rolled over.
-
IndexedPcapReader(const std::string &pcap_filename, const std::vector<std::string> &metadata_filenames)