HAL Facilities API

class Metavision::I_Decoder : public Metavision::IV_InterfaceFacility

Interface for decoding events.

This class is meant to receive raw data from the camera, and dispatch parts of the buffer to instances of I_EventDecoder for specific event types.

Public Types

typedef std::function<void(timestamp base_time)> TimeStampCallback_t

Callback on timestamp

Public Functions

I_Decoder(Device &device, IV_Decoder &iv_decoder)

Constructor.

size_t decode(RawData *ev, RawData *evend)

Decodes raw data. Identifies the events in the buffer and dispatches it to the instance of I_EventDecoder corresponding to each event type.

Parameters
  • ev: Pointer on first event

  • evend: Pointer after the last event

timestamp get_last_timestamp() const

Gets the timestamp of the last event.

Return

Timestamp of the last event

class Metavision::I_DeviceControl : public Metavision::IV_InterfaceFacility

Device Control facility controls camera mode and allows to start, reset and stop it.

Public Types

enum SyncMode

Enumerate synchronization modes.

Values:

enumerator STANDALONE = 0
enumerator MASTER = 1
enumerator SLAVE = 2

Public Functions

I_DeviceControl(Device &device, IV_DeviceControl &iv_device_control)

Constructor.

~I_DeviceControl()

Destructor.

void reset()

Restarts the device and the connection with it.

void start()

Starts the generation of events from the camera side All triggers will be disabled at stop. User should re-enable required triggers before start.

void stop()

Stops the generation of events from the camera side.

bool set_mode_standalone()

Sets the camera in standalone mode.

The camera does not interact with other devices.

Return

true on success

bool set_mode_master()

Sets the camera as master.

The camera sends clock signal to another device

Return

true on success

bool set_mode_slave()

Sets the camera as slave.

The camera receives the clock from another device

Return

true on success

SyncMode get_mode()

Retrieves Synchronization mode.

Return

synchronization mode

bool is_streaming()

Checks if streaming started.

Return

True if streaming started, False otherwise

class I_Erc : public Metavision::IV_InterfaceFacility

Interface for Erc commands

template<typename EVENT>
class Metavision::I_EventDecoder : public Metavision::IV_InterfaceFacility

Class for decoding a specific type of event.

Template Parameters
  • EVENT: type of event decoded by the instance

Public Functions

I_EventDecoder(Device &device, IV_EventDecoder<Event> &iv_eventdecoder)

Constructor.

void set_add_decoded_event_callback(AddEventCallback_t cb, bool add = true)

Sets the functions to call to each decoded event.

Parameters
  • cb: Callback to add

  • add: If true, the callback will be added to the current ones already registered. If false, it will override the current registered callbacks

void set_add_decoded_vevent_callback(AddVEventCallback_t cb, bool add = true)

Sets the functions to call to each batch of decoded events.

Parameters
  • cb: Callback to add

  • add: If true, the callback will be added to the current ones already registered. If false, it will override the current registered callbacks

void set_end_decode_callback(EndDecodeCallback_t cb, bool add = true)

Sets the functions to call at the end of a batch of decoded events.

Parameters
  • cb: Callback to add

  • add: If true, the callback will be added to the current ones already registered. If false, it will override the current registered callbacks

void disconnect()

Disables all callbacks.

class Metavision::I_EventRateNoiseFilterModule : public Metavision::IV_InterfaceFacility

Interface for accessing the sensor level event rate based on noise filtering of a sensor.

This sensor level noise filter is based on the event rate only. If enabled, the sensor will transfer data if and only if the event rate is above a given event rate. It avoids streaming background noise information without relevant activity information.

Note

Only Gen3.1 sensors have this feature.

Public Functions

I_EventRateNoiseFilterModule(Device &device, IV_EventRateNoiseFilterModule &iv_event_rate_noise_filter)

Constructor.

void enable(bool enable_filter)

Enables/disables the noise filter.

Parameters
  • enable_filter: Whether to enable the noise filtering

bool set_event_rate_threshold(uint32_t threshold_Kev_s)

Sets the event rate threshold. Below this threshold, no events are streamed.

Return

True if the input value was correctly set (i.e. it falls in the range of acceptable values for the sensor)

Parameters
  • threshold_Kev_s: Event rate threshold in Kevt/s

uint32_t get_event_rate_threshold()

Gets the event rate threshold in Kevt/s below which no events are streamed.

Return

Event rate threshold in Kevt/s

class Metavision::I_EventsStream : public Metavision::IV_InterfaceFacility

Class for getting buffers from cameras or files.

Public Functions

I_EventsStream(Device &device, IV_EventsStream &pimpl)

Constructor.

void start()

Starts streaming events.

void stop()

Stops streaming events.

short poll_buffer()

Gets event buffer from the camera.

Return

Value that depends on the outcome of the function

  • 1 if there are events available

  • 0 if no events are available

  • -1 if an error occurred

short wait_next_buffer()

Gets event buffer from the camera and blocks waiting until a buffer is available.

Return

Value that depends on the outcome of the function

  • 1 if there are events available

  • -1 if an error occurred

I_EventsStream::RawData *get_latest_raw_data(long &n_rawbytes)

Gets latest raw data.

Gets raw data received since the last time this function was called.

Return

pointer to an array of Event structures

Parameters
  • n_rawbytes: Address of a variable in which to put the number of bytes contained in the buffer

bool log_raw_data(const std::string &f)

Writes the stream of events into a file.

Return

true if the file has been created

Parameters
  • f: Name of the file

void stop_log_raw_data()

Stops writing raw event into the file provided to log_raw_data.

class Metavision::I_Geometry : public Metavision::IV_InterfaceFacility

Class to access information on the size of the sensor.

Public Functions

I_Geometry(Device &device, IV_Geometry &iv_geometry)

Constructor

I_Geometry(IV_Geometry &iv_geometry)

Standalone constructor that doesn’t add itself to the list of facilities for the device.

I_Geometry(I_Geometry&&) = default

Default move constructor

int get_width() const

Returns width of the sensor in pixels.

Return

Sensor’s width

int get_height() const

Returns height of the sensor in pixels.

Return

Sensor’s height

class Metavision::I_HALSoftwareInfo : public Metavision::IV_InterfaceFacility

Provides information about the HAL software.

Public Functions

I_HALSoftwareInfo(Device &device, const Metavision::SoftwareInfo &software_info)

Constructor.

~I_HALSoftwareInfo()

Destructor.

const Metavision::SoftwareInfo &get_software_info()

Gets plugin’s software information.

class Metavision::I_HW_Identification : public Metavision::IV_InterfaceFacility

Facility to provide information about the available system.

Public Types

using SystemInfo = std::map<std::string, std::string>

Alias to provide any useful information for the end-user.

Example of possible key-value:

  • ”Connection” : “USB 3.0”

  • ”System Build Date” : “YYYY-MM-DD h:m:s (example : 2017-03-08 13:36:44 ) (UTC time)”

Public Functions

I_HW_Identification(Device &device, IV_HW_Identification &iv_hw_identification)

Facility Constructor.

Parameters
  • device: Camera for which the hardware identification should be available

  • iv_hw_identification: Implementation of the interface

~I_HW_Identification()

Destructor.

std::string get_serial() const

Returns the serial number of the camera.

Return

Serial number as a string

long get_system_id() const

Returns the serial number of the camera.

Return

The system id as an integer

Note

This number can be used to check the compatibility of biases file

SensorInfo get_sensor_info() const

Returns the detail about the available sensor.

Return

The sensor information

long get_system_version() const

Returns the version number for this system.

Return

System version as an integer

std::vector<std::string> get_available_raw_format() const

Returns the name of the available raw format.

Return

The available format

Note

Currently the available formats are:

  • EVT2

  • EVT3

std::string get_manufacturer() const

Returns the manufacturer name.

Return

Name of the manufacturer

SystemInfo get_system_info() const

Returns all available information.

Return

Map of key-value

Note

the purpose of this function is mainly for debug and display system information The class provides a basic implementation that can be enriched by inherit class

std::string get_connection_type() const

Returns the connection with the camera as a string.

Return

A string providing the type of connection with the available camera

struct SensorInfo

Information about the type of sensor available.

As example for Gen 3.1 Sensor:

  • major_version = 3

  • minor_version = 1

Public Functions

std::string as_string() const

Returns the sensor information as a string

Return

string of the sensor_version

Public Members

uint16_t major_version_

Sensor Generation.

uint16_t minor_version_

Sensor Revision.

class Metavision::I_HW_Register : public Metavision::IV_InterfaceFacility

Interface facility for writing/reading hardware registers.

Unnamed Group

void write_register(uint32_t address, uint32_t v)

Writes register.

Parameters
  • address: Address of the register to write

  • v: Value to write

void write_register(const std::string &address, uint32_t v)

Writes register.

Parameters
  • address: Address of the register to write

  • v: Value to write

Unnamed Group

uint32_t read_register(uint32_t address)

Reads register.

Return

Value read

Parameters
  • address: Address of the register to read

uint32_t read_register(const std::string &address)

Reads register.

Return

Value read

Parameters
  • address: Address of the register to read

Public Functions

I_HW_Register(Device &device, IV_HW_Register &iv_hw_register)

Constructor.

Creates a I_HW_Register instance.

~I_HW_Register()

Destructor.

void write_register(const std::string &address, const std::string &bitfield, uint32_t v)

Writes register.

Parameters
  • address: Address of the register to write

  • bitfield: Bit field of the register to write

  • v: Value to write

uint32_t read_register(const std::string &address, const std::string &bitfield)

Reads register.

Return

Value read

Parameters
  • address: Address of the register to read

  • bitfield: Bit field of the register to read

class Metavision::I_LL_Biases : public Metavision::IV_InterfaceFacility

Interface facility for Lower Lever Biases.

Public Functions

I_LL_Biases(Device &device, IV_LL_Biases &iv_ll_biases)

Constructor.

Creates a I_LL_Biases instance.

~I_LL_Biases()

Destructor.

bool set(const std::string &bias_name, int bias_value)

Sets bias value.

Parameters
  • bias_name: Bias to set

  • bias_value: Value to set the bias to

int get(const std::string &bias_name)

Gets bias value.

Return

The bias’s value

Parameters
  • bias_name: Name of the bias whose value to get

std::map<std::string, int> get_all_biases()

Gets all biases values.

Return

A map containing the biases values

class Metavision::I_Monitoring : public Metavision::IV_InterfaceFacility

Interface facility for Monitoring events (such as temperature and illumination)

Public Functions

I_Monitoring(Device &device, IV_Monitoring &iv_monitoring)

Creates a I_Monitoring instance.

Parameters
  • device: The camera

  • iv_monitoring: Implementation

~I_Monitoring()

Destructor.

int get_temperature()

Gets temperature.

Return

Sensor’s temperature (in C)

int get_illumination()

Gets illumination.

Return

Sensor’s illumination (in lux)

class Metavision::I_PluginSoftwareInfo : public Metavision::IV_InterfaceFacility

Provides information about the Plugin software.

Public Functions

I_PluginSoftwareInfo(Device &device, const Metavision::SoftwareInfo &software_info)

Constructor.

~I_PluginSoftwareInfo()

Destructor.

const Metavision::SoftwareInfo &get_software_info()

Gets HAL’s software information.

class Metavision::I_ROI : public Metavision::IV_InterfaceFacility

Interface facility for ROI (Region Of Interest)

Unnamed Group

I_ROI(Device &device, IV_ROI &pimpl)

Constructor.

I_ROI(I_ROI&&) = default

Constructor.

Public Functions

~I_ROI()

Destructor.

void enable(bool state)

Applies ROI.

Parameters
  • state: true or false

void set_ROI(const DeviceRoi &roi, bool enable = true)

Sets an ROI from DeviceRoi geometry The ROI input is translated into a bitword (register format) and then programmed in the sensor.

Parameters
  • roi: ROI to set

  • enable: If true, applies ROI

void set_ROIs_from_bitword(const std::vector<uint32_t> &vroiparams, bool enable = true)

Sets an ROI from bitword (register format)

Parameters
  • vroiparams: ROI to set

  • enable: If true, applies ROI

void set_ROIs(const std::vector<DeviceRoi> &vroi, bool enable = true)

Sets sparse ROIs.

The input ROIs are translated into a single bitword (register format) and then programmed in the sensor. Due to the sensor format, the final ROI is one or a set of regions (i.e. a grid).

If the input vector is composed of 2 ROIs: (0, 0, 50, 50), (100, 100, 50, 50), then in the sensor, it will give 4 regions, such as: (0, 0, 50, 50), (0, 100, 50, 50), (100, 0, 50, 50) and (100, 100, 50, 50).

If the input vector is composed of 2 ROIs: (0, 0, 50, 50), (25, 25, 50, 50), then in the sensor, it will give 1 region, such as: (0, 0, 75, 75)

Parameters
  • vroi: A vector of ROI

  • enable: If true, applies ROI

void set_ROIs_from_file(std::string const &file_path, bool enable = true)

Sets union of several ROIs from a file with CSV format “x y width height”.

Warning

If the file cannot be found, it cancels all currently active ROIs

Parameters
  • file_path: Path to the file to be read

  • enable: If true, applies ROI

bool set_ROIs(const std::vector<bool> &cols_to_enable, const std::vector<bool> &rows_to_enable, bool enable = true)

Sets several rectangular ROIs in bitword register format from binary map of a line and a column.

The binary maps (std::vector<bool>) arguments must have the sensor’s dimension

Return

true if input have the correct dimension and thus the roi is set correctly, false otherwise

Parameters
  • cols_to_enable: Vector of boolean of size sensor’s width representing the binary map of the columns to disable (0) or to enable (1)

  • rows_to_enable: Vector of boolean of size sensor’s height representing the binary map of the rows to disable (0) or to enable (1)

  • enable: If true, applies ROI

std::vector<uint32_t> create_ROI(const DeviceRoi &roi)

Creates a rectangular ROI in bitword register format.

Parameters
  • roi: ROI’s geometry to transform to bitword register format

std::vector<uint32_t> create_ROIs(const std::vector<DeviceRoi> &vroi)

Creates several rectangular ROIs in bitword register format.

Parameters
  • vroi: Vector of ROI to transform to bitword register format

class Metavision::I_TriggerIn : public Metavision::IV_InterfaceFacility

Interface to handle external trigger signals.

Public Functions

I_TriggerIn(Device&, IV_TriggerIn&)

Constructor.

Creates a I_TriggerIn instance.

~I_TriggerIn()

Destructor.

bool enable(uint32_t channel)

Enables external trigger monitoring.

Parameters
  • channel: External trigger’s address

bool disable(uint32_t channel)

Disables external trigger monitoring.

Parameters
  • channel: External trigger’s address

bool is_enabled(uint32_t index)

Checks if the trigger in index is enabled.

Return

True if the trigger in index is enabled, False otherwise

class Metavision::I_TriggerOut : public Metavision::IV_InterfaceFacility

Internal interface for trigger out signal configuration.

Note

The trigger out signal is a binary signal

Public Functions

I_TriggerOut(Device &device, IV_TriggerOut &iv_trigger_out)

Constructor.

~I_TriggerOut()

Destructor.

bool enable()

Enables the trigger out.

void disable()

Disables the trigger out.

void set_period(uint32_t period_us)

Sets the trigger out signal period (in us)

Parameters
  • period_us: the period to set (in us)

bool loopback(bool enable)

Multiplex the trigger_out in the trigger in.

Return

true on success and false otherwise

Parameters
  • enable: If true, enables the multiplexing

void set_duty_cycle(double period_ratio)

Sets the duty cycle of the trigger out signal i.e. the pulse duration.

The duty cycle represents the part of the signal, during which its value is 1 (0 otherwise). Duty cycle represents the quantity \(\frac{pulse_width_us}{period_us}\) and thus must be in the range [0, 1]. The period is set with set_period.

Setting a duty cycle of 0.5 (50%) means that the value of the signal is 1 during the first half of each period, and 0 during the second half.

Parameters
  • period_ratio: the ratio representing \(\frac{pulse_width_us}{period_us}\) which must be in the range [0, 1] (value is clamped in this range otherwise)

bool is_enabled()

Checks if trigger out is enabled.

Return

True if trigger out is enabled, False otherwise