Class SensorFrameSetSource¶
Defined in File sensor_frame_set_source.h
Inheritance Relationships¶
Base Types¶
public ouster::sdk::core::FrameSetSourceClass FrameSetSourceprivate ouster::sdk::impl::FrameSetSourceBuilder< ouster::sdk::core::IoType::SENSOR, SensorFrameSetSource >
Class Documentation¶
-
class SensorFrameSetSource : public ouster::sdk::core::FrameSetSource, private ouster::sdk::impl::FrameSetSourceBuilder<ouster::sdk::core::IoType::SENSOR, SensorFrameSetSource>¶
Provides a simple API for configuring sensors and retreiving LidarFrames from them.
Public Functions
-
SensorFrameSetSource(const std::string &source, SensorFrameSetSourceOptions options)¶
Construct the SensorFrameSetSource.
- Parameters:
source[in] sensor hostname to connect to
options[in] frame set source options
-
SensorFrameSetSource(const std::vector<std::string> &source, SensorFrameSetSourceOptions options)¶
Construct the SensorFrameSetSource.
- Parameters:
source[in] sensor hostnames to connect to
options[in] frame set source options
-
SensorFrameSetSource(const std::string &source, const std::function<void(SensorFrameSetSourceOptions&)> &options = {})¶
construct the SensorFrameSetSource
- Parameters:
source[in] sensor hostname to connect to
options[in] frame set source options
-
SensorFrameSetSource(const std::vector<std::string> &source, const std::function<void(SensorFrameSetSourceOptions&)> &options = {})¶
construct the SensorFrameSetSource
- Parameters:
source[in] sensor hostnames to connect
options[in] frame set source options
-
SensorFrameSetSource(const std::vector<Sensor> &sensors, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)¶
Construct a SensorFrameSetSource to connect to the listed sensors.
- Parameters:
sensors[in] sensors to connect to
config_timeout[in] timeout in seconds for configuring sensors
queue_size[in] maximum number of frames to queue
soft_id_check[in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
SensorFrameSetSource(const std::vector<Sensor> &sensors, const std::vector<ouster::sdk::core::SensorInfo> &infos, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)¶
Construct a SensorFrameSetSource to connect to the listed sensors If infos are provided, they are used instead of configuring the sensors and retrieving the sensor info from them.
- Parameters:
sensors[in] sensors to connect to
infos[in] metadata for each sensor, if present used instead of configuring each sensor
config_timeout[in] timeout for sensor config
queue_size[in] maximum number of frames to queue
soft_id_check[in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
SensorFrameSetSource(const std::vector<Sensor> &sensors, const std::vector<ouster::sdk::core::SensorInfo> &infos, const std::vector<ouster::sdk::core::LidarFrameFieldTypes> &fields, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)¶
Construct a SensorFrameSetSource to connect to the listed sensors If infos are provided, they are used instead of configuring the sensors and retrieving the sensor info from them.
- Parameters:
sensors[in] sensors to connect to
infos[in] metadata for each sensor, if present used instead of configuring each sensor
fields[in] fields to batch into LidarFrames for each lidar. If empty default fields for that profile are used.
config_timeout[in] timeout for sensor config
queue_size[in] maximum number of frames to queue
soft_id_check[in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
~SensorFrameSetSource() override¶
-
void flush()¶
Flush any buffered frames.
-
inline uint64_t dropped_frames()¶
Get the number of frames that were dropped due to buffer overflow.
- Returns:
the number of dropped frames
-
inline uint64_t dropped_scans()¶
- Deprecated:
Use dropped_frames() instead
- Deprecated:
Use “dropped_frames()” instead. The last supported version for this will be 1.0.0 .
- Returns:
the number of dropped frames
-
inline uint64_t id_error_count()¶
Get the number of packets that had an id verification error.
- Returns:
the number of errors
-
std::pair<int, std::unique_ptr<ouster::sdk::core::LidarFrame>> get_frame(double timeout_sec = 0.0)¶
Retrieves a frame from the queue or waits up to timeout_sec until one is available.
Important: may return a nullptr if the underlying condition var experiences a spurious wakeup.
- Parameters:
timeout_sec[in] timeout for retrieving a frame
- Returns:
the resulting lidar frame with the idx of the producing sensor if no result, the returned frame will be nullptr
-
std::pair<int, std::unique_ptr<ouster::sdk::core::LidarFrame>> get_scan(double timeout_sec = 0.0)¶
- Deprecated:
Use get_frame() instead
Important: may return a nullptr if the underlying condition var experiences a spurious wakeup.
- Deprecated:
Use “get_frame()” instead. The last supported version for this will be 1.0.0 .
- Parameters:
timeout_sec[in] timeout for retrieving a frame
- Returns:
the resulting lidar frame with the idx of the producing sensor if no result, the returned frame will be nullptr
-
inline virtual bool is_live() const override¶
Indicates if the source is streaming from a device, such as a sensor.
- Returns:
if live or not
-
inline virtual const std::vector<std::shared_ptr<ouster::sdk::core::SensorInfo>> &sensor_info() const override¶
Get the sensor info for each sensor in this dataset.
- Returns:
sensor info for each sensor
-
virtual ouster::sdk::core::FrameSetIterator begin() const override¶
Provides each frame from all sensors in time order.
- Returns:
start iterator for all sensors
-
virtual ouster::sdk::core::FrameSetIterator begin(int sensor_index) const override¶
Provides frames from a single sensor in time order If idx < 0 provides frames from all sensors.
- Parameters:
sensor_index[in] sensor index
sensor_index[in] sensor index
- Throws:
std::runtime_error – if sensor_idx >= number of sensors
- Returns:
start iterator for the sensor with the given index
-
virtual size_t size_hint() const override¶
The approximate length of the source if unindexed, or the real size if indexed.
Live sources or sources with undefined length will return 0.
- Returns:
approximate length of source
-
inline virtual std::unique_ptr<FrameSetSource> move() override¶
move into a newly allocated item
- Returns:
a unique pointer to a newly allocated
FrameSetSourceinstance containing the moved-from state.
-
const std::vector<SOCKET> &sockets() const¶
Get the sockets used in the client.
Useful for changing options.
- Returns:
list of socket handles
-
static std::unique_ptr<ouster::sdk::core::FrameSetSource> create(const std::vector<std::string> &sources, const FrameSetSourceOptions &options, bool collate, int sensor_idx = -1)¶
open_source compatible factory.
- Parameters:
sources[in] source filenames
options[in] source options
collate[in] whether to collate the source or not
sensor_idx[in] access specific sensor index in the osf
- Returns:
unique_ptr of FrameSetSource type
-
SensorFrameSetSource(const std::string &source, SensorFrameSetSourceOptions options)¶