How to use the kervi.controllers.Controller.__init__ function in kervi

To help you get started, we’ve selected a few kervi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kervi / kervi / kervi / kervi / vision / camera.py View on Github external
def __init__(self, camera_id, name, **kwargs):
        Controller.__init__(self, camera_id, name)
        self.type = "camera"
        #self.media_config = Configuration.media
        self.inputs.add("pan", "Pan", NumberValue)
        self.inputs.add("tilt", "Tilt", NumberValue)
        self.fpc_start_time = time.time()
        self.fpc_counter = 0

        self.pan = self.outputs.add("pan", "Pan", NumberValue)
        self.tilt = self.outputs.add("tilt", "Tilt", NumberValue)

        self.streamed_fps = self.outputs.add("stream_fps", "Streamed frames pr second", NumberValue)
        

        self.flip_vertical = kwargs.get("flip_vertical", False)
        self.flip_horizontal = kwargs.get("flip_horizontal", False)
github kervi / kervi / kervi-core / kervi / hal / motor_controller.py View on Github external
def __init__(self, controller_id , device_name, num_motors):
        Controller.__init__(self, controller_id, device_name + "-DC motors")

        self._num_motors = num_motors
        self._device_name = device_name
github kervi / kervi / kervi / kervi / messaging / message_manager.py View on Github external
def __init__(self, log_queue):
        Controller.__init__(self, "message_manager", "Message handler")
        self.spine.register_command_handler("messageManagerSend", self.send_message)
        self._channels = {}
        self._authorization = Authorization()
        self._plugin_manager = PluginManager(Configuration, "messaging", [MessagePlugin], log_queue=log_queue)
        self._plugin_manager.load_managed_plugins()
        self._users = self._authorization.get_users()
        self.load()
github kervi / kervi / kervi / kervi / utility / authorization_manager.py View on Github external
def __init__(self):
        Controller.__init__(self, "authentication", "Authentication")
        #self._config = Configuration.authentication
        self._sessions = {}
        self._plugin_manager = PluginManager(Configuration, "authentication", [AuthenticationPlugin])
        self._plugin_manager.load_managed_plugins()
        self.spine.register_query_handler("authorizationActive", self._is_active)
        self.spine.register_query_handler("authorizationValidSessionHeader", self._is_session_valid)
        self.spine.register_query_handler("authorizationAllowAnonymousUser", self.allow_anonymous)
        self.spine.register_query_handler("authorizationGetUsers", self.get_users)
        self.spine.register_query_handler("authorizationAuthorizeUser", self.authorize)
        self.spine.register_command_handler("authorizationRemoveSession", self.remove_session)
github kervi / kervi / kervi / build / lib / kervi / vision / camera.py View on Github external
def __init__(self, camera_id, name, **kwargs):
        Controller.__init__(self, camera_id, name)
        self.type = "camera"
        self.media_config = Configuration.media
        self.inputs.add("pan", "Pan", NumberValue)
        self.inputs.add("tilt", "Tilt", NumberValue)

        self.pan = self.outputs.add("pan", "Pan", NumberValue)
        self.tilt = self.outputs.add("tilt", "Tilt", NumberValue)

        self.flip_vertical = kwargs.get("flip_vertical", False)
        self.flip_horizontal = kwargs.get("flip_horizontal", False)

        self.inputs.add("fps", "FPS", EnumValue)
        self.inputs["fps"].set_ui_parameter("inline", True)

        self.actions["take_picture"].set_ui_parameter("button_icon", "camera")
        self.actions["take_picture"].set_ui_parameter("inline", True)
github kervi / kervi / kervi-core / kervi / controllers / steering.py View on Github external
def __init__(self, controller_id="steering", name="Steering"):
        Controller.__init__(self, controller_id, name)
        self.type = "steering"
        self.left_speed = self.outputs.add("left_speed", "Left speed", NumberValue)
        self.right_speed = self.outputs.add("right_speed", "Right speed", NumberValue)

        self.inputs.add("left_encoder", "Left encoder", NumberValue)
        self.inputs.add("right_encoder", "Right encoder", NumberValue)

        self._adjust = 0

        self.speed = self.inputs.add("speed", "Speed", NumberValue)
        self.adaptive_speed = self.inputs.add("adaptive_speed", "Adaptive speed", NumberValue)
        self.direction = self.inputs.add("direction", "Direction", NumberValue)
        self.adaptive_direction = self.inputs.add("Adaptive direction", "Adaptive direction", NumberValue)
github kervi / kervi / kervi-core / kervi / streams / stream_observer.py View on Github external
def __init__(self, stream_id, stream_event, observer_id, handler=None, name="stream", observer_type="stream_observer"):
        Controller.__init__(self, observer_id, name)
        self.type = observer_type
        self.observer_id = observer_id
        self.stream_id = stream_id
        self.stream_event = stream_event
        self._epc_start_time = time.time()
        self._epc_counter = 0
        self._handler = handler
        self._last_event_frame = None
        self._lock = Lock()

        self._ui_parameters["source_stream"] = stream_id
        self._ui_parameters["stream"] = stream_id + "." + self.observer_id
        
        self.streamed_eps = self.outputs.add("source_eps", "Events per second", NumberValue)

        self.spine.register_stream_handler(stream_id, self._on_event, stream_event)
github kervi / kervi / kervi / kervi / vision / region_observer.py View on Github external
def __init__(self, stream_id, region_group, observer_id, handler=None, name="stream", observer_type="stream_observer"):
        Controller.__init__(self, observer_id, name)
        self.type = observer_type
        self.observer_id = observer_id
        self.stream_id = stream_id
        self.region_group = region_group
        self._epc_start_time = time.time()
        self._epc_counter = 0
        self._handler = handler

        self.streamed_eps = self.outputs.add("source_eps", "Events per second", NumberValue)

        self.spine.register_event_handler("visionRegionChange",self._on_event, stream_id)
github kervi / kervi / kervi-core / kervi / displays / __init__.py View on Github external
def __init__(self, page_id, name = None):
        Controller.__init__(self, page_id, name)
        self.spine.register_event_handler("valueChanged", self._link_changed_event)
        self._template = ""
        self._links = {}
        self._displays = []
        self._text = None
        self._lines = 1