Nodegraph Editor

From RoboPad Wiki
Revision as of 17:38, 25 February 2023 by Blayze (talk | contribs)
Jump to navigation Jump to search
The Nodegraph Editor page, displaying the default nodegraph (as of 2023-02-25, beta build).

At the core of the configurability of RoboPad is the Nodegraph Editor. It allows you to specify a control flow from the UI elements that make up your on-screen controller when in controller mode all the way to the RoboPad itself. Every bit of processing that is performed on the node graph is performed on the device you are using to control the robot (usually a mobile phone), meaning that it has minimal impact on the robot's performance. Every time a node is updated - either by it's UI element moving (such as a joystick being moved or a button being pressed), it transmits that change out of it's output ports (golden rounded-squares on the left side of the node), and into the input ports (blue circles on the right side of the node) of any connected nodes. In this way, data can be transformed using different nodes before transmission to the robot itself. This lets you do things like configure different controllers on the screen, adding buttons to perform additional functions or process control signals in different ways.

If you are looking to start exploring the nodegraph editor, you may want to start with the list of Node Catalogue or list of Example Nodegraphs below, once you have familiarised yourself with general usage of the nodegraph editor and the concepts of inter-node communication.

General Usage

The Nodegraph Editor stage is fairly simple - the top-bar is where you'll find every button to handle things that effect the whole nodegraph. Here you can:

  • Save the Nodegraph, which will save the current nodegraph to the RoboPad, allowing it to be loaded when you open the controller.
  • Add a Node, which will spawn a new node of the type specified by the dropdown on the left to the top-left of the nodegraph editor stage.
  • Automatically adjust the UI, the "Auto UI" button will automatically arrange the UI elements on the controller following a simple pattern. This is useful if you wan to quickly iterate on controller UI designs.

In order to change settings about individual nodes on the stage, you can use the three buttons at the bottom of each node. The clone and delete buttons allow you to copy (along with all configured settings) and delete the node, while the edit button opens each node's specific settings menu that allows you to configure that node's behaviour. On UI nodes, this will generally involve things like placement and physical behaviour of the UI element that the node describes, while on non-UI nodes these settings will control node behaviour. The only non-removable node is the Chip Node, which is a special node that represents the RoboPad itself. The input and output ports on the Chip Node are defined by the physical configuration of the RoboPad in the IO Config Editor.

Nodes can communicate with each other via connections, which can be made by first clicking/tapping on either a port (the blue or gold shapes extending out of the side of each node) and then tapping on a port of the other colour on another node, linking them and allowing data to flow from one to the other.

Inter-Node Communication

Individual nodes can control a variety of processes and communicate with each other via the gold and blue ports on either side of them - rounded-square edges gold ports on the left of the node always output signals, emitting data away from the node, while circular light-blue ports on the right of the node consume signals. In the example below, signals flow from the right-hand side into the Chip Node, which then actuators the robot's M1 output. Every time the Slider is moved on the controller, it's signal is sent into the divide Math node (which has also previously been sent the signal "3" from the Number node), which computes the new value of a/b and the emits that value into M1 on the Chip Node. In this case, that has the effect of decreasing the sensitivity and maximum value of the slider by three.

Similarly, the Chip Node will emit a signal of "1" on the M1 armed output port whenever M1 becomes armed. In the example, we connect this signal to an Indicator, a UI element that will allow us to see that the motor is armed.

Control flow example.png

You'll notice that signals can be any numeric value - while most built-in UI elements and IO Units work within the range of zero to one, any value can be passed between the nodes. This can be very useful when you are trying to perform more complex behaviours within a nodegraph, however you should always know what values the input ports on the Chip Node (as defined by the IO Units currently configured) accept. Strange and difficult to debug behaviour may be the result of sending values to the Chip Node that it's not expecting. If in doubt, try adding an Indicator Node to the stage first before hooking anything up to the Chip Node and check that the values it's displaying are as expected as you use the UI elements on the screen. Once you've verified that, then you can start hooking up nodes to the Chip Node itself.

Node Catalogue

Here is a list of all nodes available to you while in the nodegraph editor, clicking on each will bring you to a page outlining it's function, behaviour and available settings. The list has been split into the groups found on the "Add Node" UI selector in the editor, with the addition of a link to the Chip Node.

Special Nodes

  • Chip Node

UI Element Nodes

These nodes all draw

Example Nodegraphs

TODO