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.

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

ts
import {
ModelBuilder,
CallbackSourceNode,
CallbackSinkNode,
CallbackNode,
DataFrame,
DataObject,
Model
} from '@openhps/core';
 
ModelBuilder.create()
.from(new CallbackSourceNode(() => {
const myObject = new DataObject("bsigner", "Beat Signer");
const frame = new DataFrame();
frame.addObject(myObject);
return frame;
}))
.via(new CallbackNode((frame: DataFrame | DataFrame[]) => {
 
}))
.to(new CallbackSinkNode((frame: DataFrame | DataFrame[]) => {
 
}))
.build().then((model: Model) => {
 
});