Quickstart: your first node in 15 minutes¶
In this page you start the Mock Runner from the node template, write a node that reads a text message and publishes it in upper case, run it in the browser, change it, and run it again. Nothing is installed on your machine except Docker. Everything you build here runs unchanged on the Neuraverse platform once you register it for deployment.
What you need¶
| Requirement | Notes |
|---|---|
| Docker with Compose v2 | https://docs.docker.com/get-docker/ |
| Access to the NEURA container registry | docker login registry.gitlab.neura-robotics.com with your GitLab user and a personal access token with the read_registry scope. Ask your NEURA contact for an account. |
| A code editor | Any editor. |
No Python, ROS 2 or Poetry on the host. The SDK and the ROS 2 message packages live inside the Mock Runner image.
1. Start the Mock Runner¶
Get the node template (clone it, or unpack the archive your NEURA contact gave you) and start
the three Mock Runner services from the node-template project directory:
docker login registry.gitlab.neura-robotics.com
git clone git@gitlab.neura-robotics.com:neuraverse/node-studio/node-template.git
cd node-template/node-template
docker compose up -d mock-backend mock-frontend docs
Name the three services exactly as shown. They belong to the mock profile in
docker-compose.yml, so a bare docker compose up skips them and instead builds the deployable
neuraverse-node image, which is slow and not needed for local testing. The backend mounts your
src/ directory into the container and imports every node module it finds there.
| Service | URL | What it is |
|---|---|---|
| Mock Runner UI | http://localhost:3000 | Canvas: drag nodes, wire ports, run the three node-card actions (Init, Configure, Execute) |
| Mock Runner API | http://localhost:5000 | Backend that runs your node code with the real SDK |
| Documentation | http://localhost:3001 | This guide |
If port 3000 is taken, start with FRONTEND_PORT=3005 docker compose up -d mock-backend mock-frontend docs.
The backend port 5000 is fixed.
Versions
The compose file pins the Mock Runner images to one SDK version (the sdk-x.y.z image tag).
This guide may describe a newer SDK; behaviour that needs it is marked Since SDK x.y.z.
2. Write the node¶
A node is one directory under src/ holding two files named after the directory:
src/
uppercase_node/
uppercase_node.py # class UppercaseNode(NodeBase)
uppercase_node_schema.json # executionContext.className: "UppercaseNode"
Create src/uppercase_node/uppercase_node.py:
from typing import Optional
from google.protobuf.internal.containers import MessageMap, ScalarMap
from neuraverse.models.v1.gen.business.node_graph_pb2 import NodeConfigEntry
from std_msgs.msg import String
from neuraverse_sdk.node_base import NodeBase
from neuraverse_sdk.trigger.i_trigger import TriggerContext
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 {}
What matters in this file:
- The class extends
NodeBaseand implements the four required hooks. Leave one out and the class cannot be instantiated. on_configurealways receives two positional arguments: the static string map from the schema and the typed values from the UI (orNone). A one-parameter override raisesTypeErrorat configure time and the node never starts.on_executeandon_stop_executionreceive an optionaltrigger_context; keep the parameter even if you do not use it yet.self.get_data("text_input")returns the last ROS 2 message on that port, orNonewhen nothing has arrived. Read the payload throughmsg.data.self.publish("text_output", result)needs a ROS 2 message object such asString(data=...). A bare Python string is not serialisable, the error is logged and the output never arrives.- Log with
self.log_info,self.log_warning,self.log_error. Neverprint(); that output does not reach the node logs.
3. Write the schema¶
The schema makes the node appear in the palette and declares its ports. Create
src/uppercase_node/uppercase_node_schema.json:
{
"id": "Examples",
"name": "Uppercase Node",
"type": 1,
"description": "Reads a text message and publishes it in upper case",
"tags": ["example", "quickstart"],
"inputs": {
"start": { "rosType": "Start", "edgeType": 2 },
"stop": { "rosType": "Stop", "edgeType": 2 },
"text_input": { "rosType": "std_msgs/msg/String", "edgeType": 1 }
},
"outputs": {
"start": { "rosType": "Start", "edgeType": 2 },
"error": { "rosType": "Error", "edgeType": 2 },
"text_output": { "rosType": "std_msgs/msg/String", "edgeType": 1 }
},
"executionContext": {
"type": 3,
"target": "",
"className": "UppercaseNode"
}
}
| Field | Rule |
|---|---|
executionContext.className |
Exactly the Python class name. The SDK overwrites it with the real class name at registration, so keep the file in step with your class; a mismatch is not reported by any tool. |
id |
Palette category; pick a group name for your nodes. |
name, description, tags |
Shown in the palette and on the node card. |
inputs / outputs |
Port key to { "rosType": ..., "edgeType": ... }. Keys are lowercase snake_case and must equal the strings you pass to get_data and publish. |
| Trigger ports | start and stop inputs, start and error outputs. rosType carries the trigger type name (Start, Stop, Error); do not add a stop output. |
| Data ports | rosType is the ROS 2 type as pkg/msg/Type, edgeType is 1. |
The full field list is in the schema file reference.
4. Run it¶
- In the browser, click Reload Code at the bottom of the Available Nodes panel.
Uppercase Node appears; the backend re-imported every module under
src/. - Drag Uppercase Node onto the canvas.
- On the node card click Init, the first of the three icon buttons (Init, Configure, Execute from left to right). The Mock Runner creates a fresh instance and asks it for its configuration widgets (this node has none).
- Click Configure. This calls
on_configurewith the schema configuration and the values from the card, and wires the input ports to any connected upstream outputs. - Select the node, open the Inputs tab on the right, type
hello neuraverseunder Current Inputs next totext_inputand click Override. - Click Execute.
on_executeruns once, synchronously, withtrigger_context=None.
Check the result in the right-hand tabs:
| Tab | What you see |
|---|---|
| Outputs | HELLO NEURAVERSE on text_output, one row per publish call. |
| Node Logs | Your log_info line Published: HELLO NEURAVERSE, plus the SDK's own execution log lines. |
| State Logs | Success or failure of every Init, Configure and Execute click. |
The messages you inject and receive are ROS 2 objects. That is why on_execute reads
msg.data and wraps the result in String(...) before publishing:
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}")
Click Execute before overriding an input and the node logs a warning and publishes nothing.
That is the if msg is None branch.
5. Change the code¶
Edit uppercase_node.py, for example reverse the text as well:
result = String(data=msg.data.upper()[::-1])
Then, in the browser:
- Click Reload Code. The backend re-imports your modules and resets every node on the canvas.
- Click Init on the node again, then Configure, then Override the input and Execute.
Init does not reload code
Init instantiates the class that was imported at the last Reload Code. Clicking Init after editing a file runs the old code. Always reload first, then re-Init every node on the canvas.
If Reload Code seems to do nothing after you add or edit a node, a module under src/
failed to import (a syntax error, a missing dependency). The reload aborts as a whole and the
palette keeps its previous list. The error message is in the backend container log:
docker compose logs mock-backend.
What the Mock Runner does differently¶
The Mock Runner runs your class with the real NodeBase, but it replaces the platform around
it with an in-memory bus. Keep these differences in mind:
| Area | In the Mock Runner |
|---|---|
| Triggers | Not evaluated. You click Execute; downstream nodes do not run on their own. |
get_data |
Returns whatever is on the port right now, without waiting. |
| Execute | Runs on_execute once and blocks until it returns. Avoid endless loops. |
| Stop, pause, resume | Not triggered from the UI. |
Next steps¶
- Register the class for deployment: add
UppercaseNodetoset_node_classes([...])insrc/run_nodes.pyand theuppercase_nodepackage topackagesinpyproject.toml. See Project layout and build. - Read Node anatomy for every hook and the rules around them, and Triggers for how nodes start each other on the platform.
- Continue with the tutorials; the first one adds configuration values to a node like this one.
- Write a unit test for your node without ROS: see Testing.