Designer Engine API¶
-
class
metavision_designer_engine.
CombinedFilter
¶ Abstract class implementing wrappers for a filter component which is both a producer and a consumer.
-
set_name
(self: metavision_designer_engine.CombinedFilter, name: str) → None¶ Sets the name of the component
- Args:
name (str): Name to set
-
-
class
metavision_designer_engine.
Controller
¶ The Controller manages a filtering chain.
The controller is in charge of managing all the elements constituting an application. It will manage the filters, their buffers, and the parallel execution of the simulation across time. All the filters used in the chain should be added to one controller object which will assure that every filter is updated in the right order to make a valid simulation.
- Args:
parallel_threads (bool, optional): Defines if simulation should run in a single or multi threads (default : True)
-
class
RenderingMode
¶ Members:
WallClock
SimulationClock
SlowestClock
-
property
name
¶ (self: handle) -> str
-
property
-
add_component
(*args, **kwargs)¶ Overloaded function.
add_component(self: metavision_designer_engine.Controller, component: Metavision::CombinedFilter, name: str = ‘’) -> None
Adds a CombinedFilter to the controller
- Args:
component (CombinedFilter): Producer object
name (string, optional): Name of this component (default : “”)
add_component(self: metavision_designer_engine.Controller, component: Metavision::Consumer, name: str = ‘’) -> None
Adds a Consumer to the controller
- Args:
component (Consumer): Consumer object
name (string, optional): Name of this component (default : “”)
add_component(self: metavision_designer_engine.Controller, component: metavision_designer_engine.Producer, name: str = ‘’) -> None
Adds a Producer to the controller
- Args:
component (Producer): Producer object
name (string, optional): Name of this component (default : “”)
-
add_device_interface
(self: metavision_designer_engine.Controller, device_interface: metavision_designer_engine.DeviceInterface) → None¶ Adds a device interface to get events from
- Args:
device_interface (DeviceInterface): Instance of a DeviceInterface
-
add_renderer
(self: metavision_designer_engine.Controller, renderer: metavision_designer_engine.Renderer, mode: metavision_designer_engine.Controller.RenderingMode, fps: float) → None¶ Adds a Renderer to the controller
- Args:
renderer (Renderer): Renderer to add to the pipeline
mode (RenderingMode): Rendering mode associated to the renderer
fps (float): Frame per second desired for the renderer. The value is interpreted according to the given mode
-
are_producers_done
(self: metavision_designer_engine.Controller) → bool¶ Returns the status of the producers
- Returns:
bool: True if all producers have no more events to produce
-
enable_rendering
(self: metavision_designer_engine.Controller, enable: bool) → None¶ Enables or disables all registered renderers
- Args:
enable (bool): If True, enables rendering
-
enable_sparse_rendering
(self: metavision_designer_engine.Controller, enable: bool) → None¶ Enables or disables sparse image generation (for supported filters)
- Args:
enable (bool): If True, enable sparse rendering
-
get_batch_duration
(self: metavision_designer_engine.Controller) → int¶ Gets the currently used batch duration
- Returns:
int: Current batch duration (in us)
-
get_last_key_pressed
(self: metavision_designer_engine.Controller) → int¶ Returns the last keyboard event received in the window
- Returns:
KeyboardEvent: Last key event
-
get_slice_duration
(self: metavision_designer_engine.Controller) → int¶ Gets the currently used slice duration
- Returns:
int: Current slice duration (in us)
-
get_sync_mode
(self: metavision_designer_engine.Controller) → metavision_designer_engine.Controller.SyncMode¶ Gets tue currently used sync_mode
Returns: SyncMode: Current sync mode
-
get_time
(self: metavision_designer_engine.Controller) → int¶ Returns the current timestamp of the Controller
- Returns:
int: Current timestamp (in us)
-
is_done
(self: metavision_designer_engine.Controller) → bool¶ Convenient method, to return status of both producers and pipeline
- Returns:
bool: True if is_pipeline_empty() and are_producers_done() returns True
-
is_pipeline_empty
(self: metavision_designer_engine.Controller) → bool¶ Returns the pipeline status
- Returns:
bool: True if there are no events in the Controller pipeline
-
print_stats
(self: metavision_designer_engine.Controller, print_addresses: bool = False) → None¶ Prints pipeline statistics about time usage
- Args:
print_addresses (bool): If True, print filters addresses (default : False)
-
process_ui_events
(self: metavision_designer_engine.Controller) → None¶ Indicates to the controller to ask the user interface to process the UI events if any
-
run
(*args, **kwargs)¶ Overloaded function.
run(self: metavision_designer_engine.Controller, max_dt: int, end_time: int, sync: bool) -> float
- end_time (int): Run function returns as soon as ‘dt’ + the timestamp of the last simulation step
is after end_time
sync (bool): If true, function won’t return before end_time is reached in the sync mode set
- Returns:
int: Execution time (in seconds)
run(self: metavision_designer_engine.Controller) -> float
Runs one batch of simulation from the last simulated timestamp up to last simulated timestamp plus batch duration If the batch duration has not been set, the loop will end after one slice. The slice size is either the one provided at the controller construction or the default value: ‘DEFAULT_TIME_SLICE’ The sync mode is the one set with ‘set_sync_mode’ method
- Returns:
int: Execution time (in seconds)
run(self: metavision_designer_engine.Controller, sync: bool) -> float
Runs one batch of simulation from the last simulated timestamp up to last simulated timestamp plus batch duration. If the batch duration has not been set, the loop will end after one slice. The slice size is either the one provided at the controller construction or the default value: ‘DEFAULT_TIME_SLICE’
- Args:
sync (bool): If true, function won’t return before end_time is reached in the sync mode set
- Returns:
int: Execution time (in seconds)
-
set_batch_duration
(self: metavision_designer_engine.Controller, batch_duration: int) → None¶ Sets the desired batch duration
- Args:
batch_duration (int): Batch duration (in us)
-
set_slice_duration
(self: metavision_designer_engine.Controller, slice_duration: int) → None¶ Sets the desired slice duration
- Args:
slice_duration (int): Slice duration (in us)
-
set_sync_mode
(self: metavision_designer_engine.Controller, sync_mode: metavision_designer_engine.Controller.SyncMode) → None¶ Sets the desired synchronization mode
- Args:
sync_mode (SyncMode): Can be one of the Controller.SyncMode value
-
class
metavision_designer_engine.
DeviceInterface
¶ Abstract class implementing the basic interface needed to be recognized as a device interface component.
This interface allows the controller to periodically poll some hardware device.
- Args:
polling_interval (float): Polling interval in seconds.
-
set_name
(self: metavision_designer_engine.DeviceInterface, name: str) → None¶ Sets the name of the DeviceInterface
- Args:
name (str): Name to set
-
class
metavision_designer_engine.
KeyboardEvent
¶ Commodity class exposing the Symbol enum.
KeyboardEvent.Symbol enum defines key symbols that can be retrieved from Controller.get_last_key_pressed().
-
class
metavision_designer_engine.
Renderer
¶ Abstract class implementing the basic interface needed to be recognized as a component able to render some data. This interface allows the controller to perform real time rendering at given frame rates considering wall clock time instead of simulation time.
-
set_name
(self: metavision_designer_engine.Renderer, name: str) → None¶ Sets the renderer’s name attribute
- Args:
name (str): Name to set on the renderer
-