BDSim Realtime
Real-time execution and remote monitoring and tuning of BDSim Block-Diagrams for modelling and control of Dynamical Systems. See https://github.com/petercorke/bdsim for the base framework and simulation package.
TODO: more docs
BDSim Web-Tuner
Web-based telemetry and parameter tuning interface for BDSim
Note: Screen-recording lead to low FPS - usual FPS was around 30 on the laptop used (max for webcam).
Note: under heavy development (pre-alpha). These instructions will not fully work at the time of writing, but is supposed to give an idea of the usage once released.
Installation
pip install "bdsim_realtime[opencv]" # opencv optional
Usage
First, start the server and keep it running:
python -m bdsim_realtime.webapp
Then, add and run your bdsim script,
import bdsim, numpy as np
import bdsim_realtime
# setup block-diagram and tuner client
bd = bdsim.BDSim(packages="bdsim_realtime").blockdiagram()
# All TunableBlocks within this context manager will register their parameters swith the Tuner
with bdsim_realtime.tuning.tuners.TcpClientTuner() as tuner:
# use first local camera available
clock = bd.clock(24, unit='Hz')
bgr = bd.CAMERA(0, clock=clock)
# display in web stream
bd.DISPLAY(bgr, name="BGR Stream", web_stream_host=tuner, show_fps=True)
# tune system parameters in the web editor
gain = tuner.param(1, min=0, max=100)
# stream some telemetry data (random for demo)
data = bd.FUNCTION(
lambda _: (gain.val * np.random.rand(3)).tolist(),
nin=1, # unused import required here to use function as a Clocked Source Block
nout=3
)
bd.connect(bgr, data)
bd.TUNERSCOPE(
data[0], data[1], data[2],
nin=3,
labels=['x', 'y', 'z'],
name='Random Data',
tuner=tuner)
bd.compile() # perform verification
bdsim_realtime.run(bd, tuner=tuner) # run forever
Now access the tuner at http://localhost:8080
Development
Setup
python -m venv .venv # create venv
source .venv/bin/activate # activate venv
pip install -e ".[opencv]" # install in editable symlink mode
npm i # install JS deps
Frontend
npm run dev # run hot-reloaded app
Backend
Same as non-development version. Run:
python -m bdsim_realtime.webapp
And then run your example / test script:
python examples/blob_detector_tuner.py
Metadata
Release files for bdsim-realtime 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bdsim_realtime-1.0.1-py3.10.egg | Legacy Egg format | - | - | Details for bdsim_realtime-1.0.1-py3.10.egg |
Release files / bdsim_realtime-1.0.1-py3.10.egg
| Download URL | bdsim_realtime-1.0.1-py3.10.egg |
|---|---|
| Size | 230.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
5eeb6d3b2c0bd5d8064152ea3aad3e337e5cd3ad804d0b122b818b9fc272d802
|
|
BLAKE2b-256 checksum How to use checksums |
e76d4605d968fa2313017775812ea41b5ca5506219c2bf850dc40f031e34130b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for bdsim-realtime 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.