Skip to content

Node Author Guide

This guide teaches you to write, test and ship a Neuraverse node in Python. After reading it you will be able to build a node class with its schema file, run it in the Mock Runner without any platform infrastructure, package it into a node service and deploy that service on a Node Engine.

SDK version

This documentation was generated from SDK 2.52.0.

Statements that need a newer SDK than your project pins carry a Since SDK x.y.z box. Behaviour described without such a box exists in every SDK release from 2.46.2 on, the version the Mock Runner and the node template ship. The What's new for node authors page lists the changes per release.

What a node is

A node is a Python class that extends NodeBase, plus a sibling <module>_schema.json file that describes the node's ports and default settings. One or more node classes are hosted by a node service: a small Python program (run_nodes.py) that registers the classes and starts a gRPC server. The Neuraverse Node Engine drives the node service over gRPC: it initialises, configures, executes and stops each node.

Between nodes two kinds of connections exist:

Connection Carries Port kind Node API
Data edge Typed ROS 2 messages (std_msgs/msg/String, sensor_msgs/msg/CompressedImage, ...) Data ports self.get_data("port"), self.publish("port", msg)
Trigger edge Control signals (Start, Stop, Error, custom types) Trigger ports on_execute, on_stop_execution, self.fire_trigger("port")
flowchart LR
    engine[Node Engine] -- gRPC --> service
    subgraph service [Node service: run_nodes.py]
        a[NodeA extends NodeBase]
        b[NodeB extends NodeBase]
    end
    a -- data edge --> b
    a -- trigger edge --> b

The smallest complete node reads one text message and publishes it in upper case:

class UppercaseNode(NodeBase):
    """Reads ``text_input`` and publishes the upper-cased text on ``text_output``."""

    def on_configure(
        self,
        config: ScalarMap[str, str],
        dynamic_config: MessageMap[str, NodeConfigEntry] | None = None,
    ) -> None:
        """Receives the static schema config and the typed UI config. Nothing to set up here."""
        self.log_info("UppercaseNode configured")

    def on_execute(self, trigger_context: Optional[TriggerContext] = None) -> None:
        """Runs every time the node is triggered."""
        msg = self.get_data("text_input")
        if msg is None:
            self.log_warning("No message on text_input yet, nothing to publish")
            return
        result = String(data=msg.data.upper())
        self.publish("text_output", result)
        self.log_info(f"Published: {result.data}")


    def on_stop(self, trigger_context: Optional[TriggerContext] = None) -> None:
        """Runs once when the node is stopped."""
        self.log_info("UppercaseNode stopped")

    def on_get_configuration(self) -> dict[str, NodeConfigEntry]:
        """This node has no settings to show in the UI."""
        return {}

You can develop and test this node without an engine, a message broker or a service registry by mounting your source folder into the Mock Runner. Everything that runs there runs unchanged on the platform. The Quickstart walks through it in about 15 minutes.

The five things every node has

# Thing What it is Read
1 A class A subclass of NodeBase imported from neuraverse_sdk.node_base. Node anatomy
2 Three hooks on_configure, on_execute and on_get_configuration are abstract, so a class that misses one cannot be instantiated. Nodes that run loops or hold resources add on_stop_execution and on_cleanup. Lifecycle and states
3 A schema file <module>_schema.json next to <module>.py, declaring name, ports and static configuration. This is what makes the node appear in the palette. Schema file reference
4 A registration set_node_classes([...]) followed by run() in run_nodes.py, both imported from neuraverse_sdk.node_manager_service. Project layout and build
5 A service config config/service_config.yaml, read by the node service at start (gRPC and HTTP ports, broker, registry, JWT). service_config.yaml reference

The hook signatures are the same on every page of this guide:

def on_configure(self, config, dynamic_config=None) -> None: ...
def on_execute(self, trigger_context=None) -> None: ...
def on_get_configuration(self) -> dict[str, NodeConfigEntry]: ...
# optional
def on_stop_execution(self, trigger_context=None) -> None: ...
def on_cleanup(self) -> None: ...

on_configure always receives two arguments

The SDK calls on_configure(config, dynamic_config) with two positional arguments on every configuration. A one-parameter override raises TypeError, the SDK moves the node to the error state and the configuration fails. The zero-argument forms of on_execute and on_stop_execution still work for older nodes, but new code should accept trigger_context.

Your journey

Read the parts in order the first time. Afterwards the Concepts and Schema pages work as reference material, and the Features pages stand on their own.

Python first, C++ available

This guide is written for the Python SDK. A C++ SDK exists with the same node model: a class extending NodeBase, the same lifecycle hooks and a sibling <node>_schema.json. The C++ SDK mapping page maps every Python hook and helper named in this guide to its C++ counterpart, so you can read the Python pages and apply them in C++.

All pages