Positioning Model
A positioning model is a process network with graph topology, aimed to sample sensor data to an output position. In the ModelBuilder you can add nodes, shapes and services. SourceNodes push data frames, SinkNodes store an finalize data frames and ProcessingNodes process the data frame and its contents.
Graph node
The position model contains nodes connected with edges. A node represents a single chain in the positioning model that helps to produce a final position for one or more data objects.
tsimport {Node } from '@openhps/core';
Usually, a SinkNode, SourceNode or ProcessingNode is extended instead of extending the base Node class.
Creating a positioning model
Creating a positioning model can be done using a builder design pattern. The ModelBuilder allows you to create the flow from source (e.g. sensors), to processing node (e.g. positioning algorithm) and finally to sink node (e.g. displaying or storing the result).
Example
tsimport {ModelBuilder ,CallbackSourceNode ,CallbackSinkNode ,CallbackNode ,DataFrame ,DataObject ,Model } from '@openhps/core';ModelBuilder .create ().from (newCallbackSourceNode (() => {constmyObject = newDataObject ("bsigner", "Beat Signer");constframe = newDataFrame ();frame .addObject (myObject );returnframe ;})).via (newCallbackNode ((frame :DataFrame ) => {})).to (newCallbackSinkNode ((frame :DataFrame ) => {})).build ().then ((model :Model ) => {});
Merging DataFrames
Merging streams of data frames
Merging multiple streams of data frames can be done without much interference.
tsimport {ModelBuilder ,CallbackSourceNode ,CallbackSinkNode ,CallbackNode ,DataFrame ,DataObject ,Model } from '@openhps/core';ModelBuilder .create ().from (newCallbackSourceNode (() => {constmyObject = newDataObject ("bsigner", "Beat Signer");constframe = newDataFrame ();frame .addObject (myObject );returnframe ;}), newCallbackSourceNode (() => {constmyObject = newDataObject ("bsigner", "Beat Signer");constframe = newDataFrame ();frame .addObject (myObject );returnframe ;})).via (newCallbackNode ((frame :DataFrame ) => {})).to (newCallbackSinkNode ((frame :DataFrame ) => {})).build ().then ((model :Model ) => {});
Merging frames of the same type
Merging frames of the same type means that you want to merge the information contained within these frames.