Class SensorPacketSource
Defined in File sensor_packet_source.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Types
public ouster::sdk::core::PacketSource(Class PacketSource)private ouster::sdk::impl::PacketSourceBuilderMulti< ouster::sdk::core::IoType::SENSOR, SensorPacketSource >
Class Documentation
-
class SensorPacketSource : public ouster::sdk::core::PacketSource, private ouster::sdk::impl::PacketSourceBuilderMulti<ouster::sdk::core::IoType::SENSOR, SensorPacketSource>
An interface to configure and retrieve packets from one or multiple lidars.
Public Functions
-
SensorPacketSource(const std::string &sensor, SensorPacketSourceOptions options)
Construct a sensor packet source for a single sensor.
- Parameters:
sensor[in] sensor hostname
options[in] source options
-
SensorPacketSource(const std::vector<std::string> &sources, SensorPacketSourceOptions options)
Construct a sensor packet source for a multiple sensors.
- Parameters:
sources[in] sensor hostnames
options[in] source options
-
SensorPacketSource(const std::string &source, const std::function<void(SensorPacketSourceOptions&)> &options = {})
Construct a sensor packet source for a single sensor.
- Parameters:
source[in] sensor hostname
options[in] source options
-
SensorPacketSource(const std::vector<std::string> &source, const std::function<void(SensorPacketSourceOptions&)> &options = {})
Construct a sensor packet source for multiple sensors.
- Parameters:
source[in] sensor hostnames
options[in] source options
-
SensorPacketSource(const std::vector<Sensor> &sensors, double config_timeout_sec = 45, double buffer_time_sec = 0)
Build a sensor client to retrieve packets for the provided sensors.
Configures the sensors if necessary according to their desired configs.
- Parameters:
sensors[in] sensors to connect to
config_timeout_sec[in] timeout for sensor config
buffer_time_sec[in] time in seconds to buffer packets for. If zero no buffering is performed outside of the OS.
-
SensorPacketSource(const std::vector<Sensor> &sensors, const std::vector<ouster::sdk::core::SensorInfo> &infos, double config_timeout_sec = 45, double buffer_time_sec = 0, bool reuse_ports = false)
Build a sensor client to retrieve packets for the provided sensors.
If provided, uses the provided metadata for each sensor rather configuring and retrieving them from each sensor.
- Parameters:
sensors[in] sensors to connect to
infos[in] metadata for each sensor, if present used instead of configuring each sensor
config_timeout_sec[in] timeout for sensor config
buffer_time_sec[in] time in seconds to buffer packets for. If zero no buffering is performed outside of the OS.
reuse_ports[in] If true bind ports with port reuse enabled
-
~SensorPacketSource() override
Destruct the sensor client.
-
ClientEvent get_packet(double timeout_sec)
Retrieve a packet from the sensor with a given timeout.
timeout_sec of 0 = return immediately, timeout_sec < 0 = wait forever Important: may return a timeout event if the underlying condition var experiences a spurious wakeup.
- Parameters:
timeout_sec[in] timeout in seconds to wait for a packet
- Returns:
a ClientEvent representing the result of the call
-
uint64_t dropped_packets()
Get the number of packets dropped due to buffer overflow.
- Returns:
the number of dropped packets
-
void flush()
Flush the internal packet buffer (if enabled)
-
size_t buffer_size()
Get the number of packets in the internal buffer.
- Returns:
the number of packets in the internal buffer
-
virtual core::PacketIterator begin() const override
Get begin iterator for container.
Provides each scan from all sensors in time order
- Returns:
iterator to first item in source
-
virtual bool is_live() const override
Indicates if the source is streaming from a device, such as a sensor.
- Returns:
if live or not
-
virtual const std::vector<std::shared_ptr<ouster::sdk::core::SensorInfo>> &sensor_info() const override
Get the SensorInfo for each sensor in the source.
- Returns:
info about each sensor
Friends
- friend class SensorPacketIteratorImpl
- friend class SensorScanSource
-
SensorPacketSource(const std::string &sensor, SensorPacketSourceOptions options)