gd_node.protocols package

Subpackages

Submodules

gd_node.protocols.base module

Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential

Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020 - Tiago Paulino (tiago@mov.ai) - 2020

Base classes for all protocols

class gd_node.protocols.base.BaseIport(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, update: bool = True, _gd_node: Any | None = None, **_ignore)

Bases: object

Class with common methods for all the iports

callback(msg: Any) None

Executes the callback if port is enabled

register() None

Enables the iport

unregister() None

Disables the iport

class gd_node.protocols.base.BaseOport

Bases: object

Class with common methods for all the oports

gd_node.protocols.movai module

Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential

Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020 - Tiago Paulino (tiago@mov.ai) - 2020

Module that implements specific Mov.AI protocol to deal with GD_Nodes

class gd_node.protocols.movai.ContextClientIn(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, _params: dict, _update: bool, **_ignore)

Bases: BaseIport

Class that implements the Client Context comunication in the GD_Node

Is subscribed to a redis hash (param)

Parameters:
  • _node_name – Name of the node instance

  • _iport_name – Name of the port

  • _cb_name – Name of the callback to be executed

callback(msg)

Executes callback

is_port_subscribed()
async register_sub(_port_name: str, _node_name: str) None

Subscribe to key.

class gd_node.protocols.movai.ContextClientOut(_node_name: str, _oport_name: str, _params: dict)

Bases: object

Class that implements Client Context comunication in the GD_Node

send(msg)

Send function

class gd_node.protocols.movai.ContextMsg(id={}, data={}, changed={})

Bases: object

Message for Context data -> dictionary of full context table changed -> dictionary only of values changed

class gd_node.protocols.movai.ContextServerIn(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, _params: dict, _update: bool, **_ignore)

Bases: BaseIport

Class that implements the Server Context comunication in the GD_Node

Is subscribed to a redis hash (param)

Parameters:
  • _node_name – Name of the node instance

  • _iport_name – Name of the port

  • _cb_name – Name of the callback to be executed

callback(msg)

Executes callback

async register_sub(_port_name: str, _node_name: str) None

Subscribe to key.

class gd_node.protocols.movai.ContextServerOut(_node_name: str, _oport_name: str, _params: dict)

Bases: object

Class that implements Client Context comunication in the GD_Node

send(msg)

Send function

class gd_node.protocols.movai.Exit(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, **_ignore)

Bases: BaseIport

Class that implements the exit callback of the GD_Node

Parameters:
  • _node_name – Name of the node instance

  • _iport_name – Name of the port

  • _cb_name – Name of the callback to be executed

execute()

Executes exit callback

unregister()

Disables the iport

class gd_node.protocols.movai.Init(_node_name: str, _port_name: str, _callback: str, **_ignore)

Bases: BaseIport

Class that implements the init callback of the GD_Node

Parameters:
  • _node_name – Name of the node instance

  • _iport_name – Name of the port

  • _cb_name – Name of the callback to be executed

class gd_node.protocols.movai.StateMachineProtocol(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, _params: dict, **_ignore)

Bases: BaseIport

Class that implements a state machine inside a GD_Node

callback(msg) None

Executes the callback if port is enabled

change_state(port)

Change from current state to next one according to port called

get_state()

Returns the current state

async register_sub(loop, scope, callback, **sub_dict)
run()

Executes the callback of the current state

set_state(state)

Sets the current state

class gd_node.protocols.movai.Transition(_node_name: str, _oport_name: str, _flow_name: str)

Bases: object

Method for changing between GD_Nodes

Parameters:
  • _node_name – Name of the node instance

  • _oport_name – Name of the port

send(msg=None) None

Send function

class gd_node.protocols.movai.TransitionIn(_node_name: str, _port_name: str, _callback: str, _data, **_ignore)

Bases: BaseIport

Class that implements the transition callback of the state GD_Node

Parameters:
  • _node_name – Name of the node instance

  • _iport_name – Name of the port

  • _cb_name – Name of the callback to be executed

gd_node.protocols.redissub module

Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential

Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020 - Tiago Paulino (tiago@mov.ai) - 2020

Module that implements Redis Subscriber as a GD_Node input protocol

class gd_node.protocols.redissub.Var_Subscriber(_node_name: str, _port_name: str, _topic: str, _message: str, _callback: str, _params: dict, _update: bool, **_ignore)

Bases: BaseIport

Redis Var Event Subscriber. Implementention of redis pubsub

Parameters:
  • _node_name – Name of the node instance

  • _port_name – Name of the port

  • _topic – Iport topic - not used

  • _message – Custom Message containing subscribed info

  • _callback – Name of the callback to be executed

callback(msg: Any) None

Callback of the Redis subscriber protocol

Parameters:

msg – Redis psubscribe message

async register_sub(db, loop, sub_dict, callback)

Register the subscriber

gd_node.protocols.ros1 module

gd_node.protocols.ros2 module

Module contents

Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential

Developers: - Alexandre Pires (alexandre.pires@mov.ai) - 2020