gd_node package

Subpackages

Submodules

gd_node.callback module

class gd_node.callback.GD_Callback(_cb_name: str, _node_name: str, _port_name: str, _update: bool = False)

Bases: Callback

set_transitioning()
class gd_node.callback.GD_UserFunctions(_cb_name: str, _node_name: str, _port_name: str, _libraries: list, _message: str, _user='SUPER')

Bases: UserFunctions

globals: Dict[str, Any]
load_classes(_node_name, _port_name, _user)

gd_node.message 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

class gd_node.message.GD_Message(_name: str, _type='msg')

Bases: object

Class that imports and make available all Messages, Services and Actions for the GD_Node

Parameters:
  • _name – package/message_name

  • _type – Available types are: msg, srv, action

Raises:

Exception – Message does not exist

get()

Method that returns the message

Returns:

Any

Return type:

TYPE

get_srv()

Method that returns the full service

Returns:

Any

Return type:

TYPE

class gd_node.message.GD_Message2

Bases: object

Class that makes available all Messages and Services from ROS1, ROS2 and Redis to the GD_Node

Parameters:
  • _name – package/message_name

  • _type – Available types are: msg, srv, action

Raises:

Exception – Message does not exist

get_ros1_msg(_input: Any) Any

Returns a Ros1 msg class

get_ros1_srv()
get_ros2_msg(_input: Any) Any

Returns a Ros2 msg class. Accepts string with package/message and ROS1/ROS2 message class instance

get_ros2_srv(_input: Any) Any

Returns a Ros2 srv class. Accepts string with package/service and ROS1/ROS2 service Request/Responce class instance

gd_node.metrics module

DEPRECATED: This module is no longer functional and will be removed in a future release. Any usage will raise a RuntimeError.

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

Previous usage (no longer supported):

from libraries import Metrics metrics_a = Metrics(<name>)

metrics_a.add(<value>, tags=[<string>, <string>,…]) – or – metrics_a.log(<value>, tags=[<string>, <string>,…])

class gd_node.metrics.HealthNodeHandler(*args, **kwargs)

Bases: object

class gd_node.metrics.Metrics(*args, **kwargs)

Bases: object

gd_node.node module

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

gd_node.node.CoreInterruptHandler(signalnum)

Core interrupt handler for GD_Node. This function is called when the GD_Node receives a signal to stop (SIGINT or SIGTERM). It sets the GD_User.STOP event to signal the node to stop gracefully.

class gd_node.node.GDNode(args, unknown, perf_metrics)

Bases: object

GD_Node asynchronous class

async collect_metrics() None

Periodic collection of runtime metrics

async connect() None

Connect to aioredis slave db

handle_exception(loop, context)
async init_iports(inst_name: str, ports_templates: dict, ports_inst: dict, init: bool = False, transition_data=None)

Initialize input ports

This function initializes input ports based on the provided templates and instances. :param inst_name: Instance name of the node :param ports_templates: Dictionary of port templates :param ports_inst: Dictionary of port instances :param init: Boolean indicating if this is an initialization phase :param transition_data: Data for transition messages, if any

async init_oports(inst_name: str, ports_templates: dict, ports_inst: dict, flow_name: str)

Init all the output ports

This function initializes all output ports based on the provided templates and instances.

Parameters:
  • inst_name – Instance name of the node

  • ports_templates – Description

  • ports_inst – Description

  • flow_name – Name of the flow to which the ports belong

async init_transports(node_name: str, inst_name: str, ports_templates: dict, transports: dict, remaps: list)

Initialize required transports This function checks the port templates for required transports and initializes them.

Parameters:
  • node_name (str) – Name of the node

  • inst_name (str) – Instance name of the node

  • ports_templates (dict) – Dictionary of port templates

  • transports (dict) – Dictionary of transport names and their status

  • remaps (list) – List of remaps for transport initialization

initial_print(inst_name: str, template_name: str, inst_params: list)

Some inital debug prints

async main(args, unknown) None

Runs the main loop. Exiting stops GDNode

async stop() None

Gracefully shutdown node

gd_node.notifications module

gd_node.protocol 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 all the tranports and protocols currently supported by the GD_Node

class gd_node.protocol.IportHttpRoute(**kwargs)

Bases: object

class gd_node.protocol.IportMovaiContextClient(**kwargs)

Bases: object

is_port_fully_created()
class gd_node.protocol.IportMovaiContextServer(**kwargs)

Bases: object

class gd_node.protocol.IportMovaiDependency(**kwargs)

Bases: object

class gd_node.protocol.IportMovaiExit(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportMovaiInit(**kwargs)

Bases: object

class gd_node.protocol.IportMovaiSM(**kwargs)

Bases: object

class gd_node.protocol.IportMovaiTransition(**kwargs)

Bases: object

class gd_node.protocol.IportRos1Action(**kwargs)

Bases: object

class gd_node.protocol.IportRos1ActionClient(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos1Service(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos1Sub(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos1Tf(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos1Timer(**kwargs)

Bases: object

class gd_node.protocol.IportRos1TopicHz(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos2ServiceServer(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportRos2Sub(**kwargs)

Bases: object

shutdown()
class gd_node.protocol.IportVarSub(**kwargs)

Bases: object

class gd_node.protocol.IportWebSocket(**kwargs)

Bases: object

class gd_node.protocol.OportMovaiContextClient(node_name, name, topic, message, _params, **_ignore)

Bases: object

class gd_node.protocol.OportMovaiContextServer(node_name, name, topic, message, _params, **_ignore)

Bases: object

class gd_node.protocol.OportMovaiDepends(name, node_name, **_ignore)

Bases: object

class gd_node.protocol.OportMovaiTransition(name, node_name, flow_name, **_ignore)

Bases: object

class gd_node.protocol.OportRos1ActionClient(name, topic, message, **_ignore)

Bases: object

class gd_node.protocol.OportRos1Bag(name, topic, message, **_ignore)

Bases: object

shutdown()
class gd_node.protocol.OportRos1DynReconfigure(name, topic, message, **_ignore)

Bases: object

shutdown()
class gd_node.protocol.OportRos1Parameter(name, topic, message, _params, **_ignore)

Bases: object

class gd_node.protocol.OportRos1Pub(name, topic, message, _params=None, _gd_node=None, **_ignore)

Bases: object

shutdown()
class gd_node.protocol.OportRos1ServiceClient(name, topic, message, **_ignore)

Bases: object

shutdown()
class gd_node.protocol.OportRos1Tf(name, topic, message, _params, **_ignore)

Bases: object

shutdown()
class gd_node.protocol.OportRos2Pub(name, topic, message, _params, **_ignore)

Bases: object

class gd_node.protocol.OportRos2ServiceClient(name, topic, message, _params, **_ignore)

Bases: object

class gd_node.protocol.Params(_name: str, _value: Any)

Bases: object

Makes GD_Node parameters accessible in all callbacks

Parameters:
  • _name – Name of the parameter

  • _value – Value of the parameter

class gd_node.protocol.PortsProvider

Bases: object

Class to help create ports instances

create(key, **kwargs)
on_shutdown(**kwargs)
register(key, builder)
register_event(key, callback)
shutdown()
class gd_node.protocol.TransportHttp

Bases: object

class gd_node.protocol.TransportROS1

Bases: object

shutdown()
class gd_node.protocol.TransportROS2

Bases: object

shutdown()
class gd_node.protocol.TransportRedis

Bases: object

class gd_node.protocol.TransportSocketIO

Bases: object

class gd_node.protocol.TransportsProvider

Bases: object

create(key, **kwargs)
get(key, **kwargs)
on_shutdown(**kwargs)
register(key, builder)
register_event(key, callback)
shutdown()
start(**kwargs)

gd_node.shared 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

class gd_node.shared.Shared

Bases: object

Shared class implements thread safe local storage

delete(name)

Same as delattr

get(name)

Same as getattr

lock = <unlocked _thread.RLock object owner=0 count=0>
set(name, value)

Same as setattr

store = {}

gd_node.user 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 to store and give access to GD_Node Iports, Oports and Parameters during runtime

class gd_node.user.GD_User

Bases: object

User class

iport

Input ports of the node

Type:

dict

name

Name of the node instance

Type:

str

oport

Output ports of the node

Type:

dict

params

Parameters of the node instance

Type:

dict

STOP: Event | None = None
iport = {}
name = ''
oport = {}
params = {}
classmethod send(port, msg='')

Making send function easy to write

template = ''

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