sensor_packet_source.h
Class
-
class ClientError : public std::runtime_error
Subclassed by ouster::sensor::ClientOverflow, ouster::sensor::ClientTimeout
-
class ClientEvent
Public Types
-
enum EventType
Types of events that can occur.
Values:
-
enumerator Error
An error occurred in the SensorClient, it may no longer function.
-
enumerator Exit
The client has been closed and will not return any more packets.
-
enumerator PollTimeout
get_packet has timed out waiting for an event/packet
-
enumerator Packet
An packet from a sensor.
-
enumerator Error
-
enum EventType
-
class ClientOverflow : public ouster::sensor::ClientError
-
class ClientTimeout : public ouster::sensor::ClientError
-
class Sensor
Class that indicates a sensor and its desired configuration.
Public Functions
-
Sensor(const std::string &hostname, const sensor_config &config)
Construct a sensor descriptor with the given hostname and desired config.
- Parameters:
hostname – [in] sensor hostname
config – [in] desired sensor configuration
-
sensor_info fetch_metadata(int timeout = 10) const
Queries the sensor metadata.
- Parameters:
timeout – [in] timeout for the request in seconds
- Returns:
the parsed sensor_info object containing the metadata.
-
std::shared_ptr<ouster::sensor::util::SensorHttp> http_client() const
Get a SensorHttp client for this sensor.
- Returns:
the SensorHttp client
-
inline const sensor_config &desired_config() const
Get the desired config of this sensor.
- Returns:
the desired config
-
inline const std::string &hostname() const
Get the hostname of this sensor.
- Returns:
the sensor hostname
-
Sensor(const std::string &hostname, const sensor_config &config)
-
class SensorPacketSource : public ouster::core::PacketSource, private ouster::impl::PacketSourceBuilderMulti<ouster::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::sensor::sensor_info> &infos, double config_timeout_sec = 45, double buffer_time_sec = 0)
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.
-
~SensorPacketSource()
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::sensor::sensor_info>> &sensor_info() const override
Get the sensor_info for each sensor in the source
- Returns:
info about each sensor
-
SensorPacketSource(const std::string &sensor, SensorPacketSourceOptions options)
Structs
-
struct Addr4
-
struct Addr6
-
struct BufferEvent
-
struct InternalEvent
-
struct SensorPacketSourceOptions : private ouster::PacketSourceOptions
SensorScanSource specific configuration options.
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<float> buffer_time_sec
If > 0.0 buffer packets for this long internally Useful if you may not be retrieving packets from the source consistently
-
impl::Parameter<float> config_timeout
timeout for http endpoints while configuring the sensor
-
impl::Parameter<bool> do_not_reinitialize
If true, do not change any settings on the sensor or reinitialize it.
-
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<uint16_t>> imu_port
if set, the imu udp port to use with the sensor
-
impl::Parameter<nonstd::optional<uint16_t>> lidar_port
if set, the lidar udp port to use with the sensor
-
impl::Parameter<bool> no_auto_udp_dest
If true, do not change the udp_dest configuration option on the sensor.
-
impl::Parameter<std::vector<ouster::sensor::sensor_config>> sensor_config
Configuration to apply to the sensors.
-
impl::Parameter<std::vector<ouster::sensor::sensor_info>> sensor_info
Override sensor info. If provided used instead of talking to the sensor.
-
impl::Parameter<float> timeout
timeout for receiving packets from the sensor
-
void check(const char *source_type) const