Dataflow Programming Method Summary

This guide summarizes how MotionScore models computation using dataflow programming to process timestamped sensor data and generate reliable output variables.

Overview

Dataflow programming is a method of modeling computation where data flows through interconnected function nodes and is processed according to their internal algorithm. The method is especially useful for applications that need to run mathematical operations on timestamped sensor data and generate specific output values.

An algorithm is implemented by a dataflow diagram which has one or more input stream nodes connected to a number of function nodes that create a sequence of interconnected sequential operations to calculate the value of one or more variable output nodes. Any settings of the algorithm are implemented by using constant nodes.

Timestamped Variables

To process different types of numerical data, several timestamped variables are defined, each with a timestamp indicating when the variable was last updated, a value holding the actual value, and an updated boolean indicating whether the value was updated.

Available basic types: Float, Integer, Boolean, and String. For motion‑specific processing, compound types are included: Vector (3D position), Orientation (quaternion rotation), and Sequence (array of timestamped float samples). Arrays of all types are also supported and are themselves timestamped variables.

Node Classes

  • Input Stream: Generates an output when updated by an external process; output connector only.
  • Constant: Stores a fixed value; output connector only.
  • Variable Output: Stores the result of the diagram; input connector only.
  • Function: Has one or more inputs and a single output; computes a value from its inputs.

Update and Execution Semantics

Because data “flows,” a function node calculates (updates) its output when all inputs are updated; it effectively waits for all required inputs. After the output is calculated and marked updated, the inputs are reset to the not‑updated state.

If one input updates multiple times while another has not updated, those intermediate updates are ignored. The timestamp of a function’s output is the timestamp of the last‑updated input used in that computation.

Connecting Nodes

Nodes are interconnected by connecting the output of one node to the input of another, provided the variable types match (or a connector is generic). An input connector may only have one source, but an output connector can feed many inputs.

Diagram Execution

  1. Update input stream nodes that have new data for a given timestamp. Their outputs update connected inputs.
  2. Update constant nodes, which also propagate to connected inputs.
  3. Iterate over function nodes. If all relevant inputs are updated, execute the internal algorithm, update the output, and propagate to connected inputs.
  4. If any function updated during the iteration, repeat the loop.
  5. When stable (no further updates), check whether inputs of any variable output nodes were updated. If so, the process may repeat using those values as inputs.

If there are no input stream nodes with the same description and variable type as the updated variable output nodes, execution stops and the application can process the updated outputs. If there are, execution repeats. To prevent infinite loops, variable output nodes are only reused once in this way.

Sub‑Algorithms

This method allows the creation of reusable sub‑algorithms to simplify complex diagrams.

← Back to Resources