Connect your hardware to Nominal
🚧 Prototype - changing daily 🚧
- Clone this repo
- Install Rust (try
rustup -V
in your terminal to check) - In the
connect
folder, create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
- Install ZMQ & numpy in this environment:
pip3 install pyzmq numpy
- Run
cargo run
- an app should appear with the default config loaded
Python scripts that connect to your hardware are set in a config.toml file:
[[scripts]]
name = "Print random"
path = "scripts/rand.py"
type = "discrete"
[[scripts]]
name = "Sine Wave"
path = "stream_example.py"
type = "streaming"
[[scripts]]
name = "Echo inputs"
path = "echo.py"
type = "discrete"
functions = [
{ name = "echo_one", display = "Field 1" },
{ name = "echo_two", display = "Field 2" }
]
In the future, additional languages may be supported (C, Rust, MATLAB, etc).
discrete
scripts are run oncestreaming
scripts are run continuously and can push to an IPC (ZMQ) channel- To execute individual functions within a script file, set the
functions
parameter.
Scripts can receive an app state - a JSON payload of return values from other scripts and the UI state of various input widgets (sliders, text fields, etc). See echo.py
in recipes/kitchen_sink
for a simple example of extracting app state in Python.
App layout is also configured in the TOML file. For example, to add a slider:
[[layout.sliders]]
id = "frequency"
label = "Frequency"
min = 0.0
max = 10.0
default = 1.0