sensor_scan_source.h
Class
-
class SensorScanSource : public ouster::core::ScanSource, private ouster::impl::ScanSourceBuilderMulti<ouster::core::IoType::SENSOR, SensorScanSource>
Provides a simple API for configuring sensors and retreiving LidarScans from them
Public Functions
-
SensorScanSource(const std::string &source, SensorScanSourceOptions options)
Construct the SensorScanSource.
- Parameters:
source – [in] sensor hostname to connect to
options – [in] scan source options
-
SensorScanSource(const std::vector<std::string> &source, SensorScanSourceOptions options)
Construct the SensorScanSource.
- Parameters:
source – [in] sensor hostnames to connect to
options – [in] scan source options
-
SensorScanSource(const std::string &source, const std::function<void(SensorScanSourceOptions&)> &options = {})
construct the SensorScanSource
- Parameters:
source – [in] sensor hostname to connect to
options – [in] scan source options
-
SensorScanSource(const std::vector<std::string> &source, const std::function<void(SensorScanSourceOptions&)> &options = {})
construct the SensorScanSource
- Parameters:
source – [in] sensor hostnames to connect
options – [in] scan source options
-
SensorScanSource(const std::vector<Sensor> &sensors, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)
Construct a SensorScanSource 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 scans to queue
soft_id_check – [in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
SensorScanSource(const std::vector<Sensor> &sensors, const std::vector<ouster::sensor::sensor_info> &infos, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)
Construct a SensorScanSource 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 scans to queue
soft_id_check – [in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
SensorScanSource(const std::vector<Sensor> &sensors, const std::vector<ouster::sensor::sensor_info> &infos, const std::vector<LidarScanFieldTypes> &fields, double config_timeout = 45, unsigned int queue_size = 2, bool soft_id_check = false)
Construct a SensorScanSource 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 LidarScans 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 scans to queue
soft_id_check – [in] if true, allow accepting packets with mismatched sensor serial numbers and init_ids
-
void flush()
Flush any buffered scans.
-
inline uint64_t dropped_scans()
Get the number of scans that were dropped due to buffer overflow.
- Returns:
the number of dropped scans
-
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<LidarScan>> get_scan(double timeout_sec = 0.0)
Retrieves a scan 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 scan
- Returns:
the resulting lidar scan with the idx of the producing sensor if no result, the returned scan 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::sensor::sensor_info>> &sensor_info() const override
Get the sensor info for each sensor in this dataset
- Returns:
sensor info for each sensor
-
virtual core::ScanIterator begin() const override
Provides each scan from all sensors in time order
- Returns:
start iterator for all sensors
-
virtual core::ScanIterator begin(int sensor_index) const override
Provides scans from a single sensor in time order If idx < 0 provides scans from all sensors
- Parameters:
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
-
SensorScanSource(const std::string &source, SensorScanSourceOptions options)
Structs
-
struct SensorScanSourceOptions : private ouster::ScanSourceOptions
Options for theSensorScanSource.
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> config_timeout
timeout in seconds 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<std::vector<std::string>>> field_names
list of fields to decode into LidarScans, if not set decodes all fields, if an empty array decodes no fields
-
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<unsigned int> queue_size
maximum number of scans to queue, useful for limiting buffer bloat
-
impl::Parameter<bool> raw_fields
If true, batch raw_fields into each scan.
-
impl::Parameter<bool> raw_headers
If true, batch raw_headers into each scan.
-
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<bool> soft_id_check
If true, accept packets/scans that don’t match the init_id/sn of the metadata
-
impl::Parameter<float> timeout
timeout for each sensor in seconds only applies to iterators, not get_scan
-
void check(const char *source_type) const