{"id":14977673,"url":"https://github.com/callumjhays/bdsim_realtime","last_synced_at":"2025-08-09T21:10:42.250Z","repository":{"id":56169537,"uuid":"305890271","full_name":"CallumJHays/bdsim_realtime","owner":"CallumJHays","description":"Real-time execution and remote monitoring and tuning of BDSim Block-Diagrams for modeling and control of Dynamical Systems","archived":false,"fork":false,"pushed_at":"2023-02-05T05:57:45.000Z","size":8936,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T19:04:58.787Z","etag":null,"topics":["bdsim","block-diagram","computation-graph","computer-vision","control","control-flow","control-system","data-flow","modeling","opencv","python","realtime","remote-control","rtos","signal-anaylsis","simulation","telemetry","tuner","tuning-interface","webapplication"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CallumJHays.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-21T02:48:18.000Z","updated_at":"2024-08-24T00:43:48.000Z","dependencies_parsed_at":"2024-09-18T22:08:17.431Z","dependency_job_id":"51d1c4d3-59dd-4907-91a8-378237ad06e0","html_url":"https://github.com/CallumJHays/bdsim_realtime","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.02941176470588236,"last_synced_commit":"51ba7d7d3c5825d377eb83f6614d3f3eda6aea63"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CallumJHays%2Fbdsim_realtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CallumJHays%2Fbdsim_realtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CallumJHays%2Fbdsim_realtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CallumJHays%2Fbdsim_realtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CallumJHays","download_url":"https://codeload.github.com/CallumJHays/bdsim_realtime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238603665,"owners_count":19499488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdsim","block-diagram","computation-graph","computer-vision","control","control-flow","control-system","data-flow","modeling","opencv","python","realtime","remote-control","rtos","signal-anaylsis","simulation","telemetry","tuner","tuning-interface","webapplication"],"created_at":"2024-09-24T13:56:07.173Z","updated_at":"2025-02-13T05:35:04.997Z","avatar_url":"https://github.com/CallumJHays.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BDSim Realtime\n\nReal-time execution and remote monitoring and tuning of BDSim Block-Diagrams for modelling and control of Dynamical Systems.\nSee https://github.com/petercorke/bdsim for the base framework and simulation package.\n\nTODO: more docs\n\n## BDSim Web-Tuner\n\nWeb-based telemetry and parameter tuning interface for BDSim\n\n![Demo](./demo.gif)\n\nNote: Screen-recording lead to low FPS - usual FPS was around 30 on the laptop used (max for webcam).\n\nNote: 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.\n\n## Installation\n\n```bash\npip install \"git+https://github.com/CallumJHays/bdsim_realtime#egg=bdsim_realtime[opencv]\"\n```\n\n\n## Usage\n\nFirst, start the server and keep it running:\n\n```bash\npython -m bdsim_realtime.webapp\n```\n\nThen, add and run your bdsim script, \n\n```python\nimport bdsim, numpy as np\nimport bdsim_realtime\n\n# setup block-diagram and tuner client\nbd = bdsim.BDSim(packages=\"bdsim_realtime\").blockdiagram()\n\n# All TunableBlocks within this context manager will register their parameters swith the Tuner\nwith bdsim_realtime.tuning.tuners.TcpClientTuner() as tuner:\n    # use first local camera available\n    clock = bd.clock(24, unit='Hz')\n    bgr = bd.CAMERA(0, clock=clock)\n\n    # display in web stream\n    bd.DISPLAY(bgr, name=\"BGR Stream\", web_stream_host=tuner, show_fps=True)\n\n    # tune system parameters in the web editor\n    gain = tuner.param(1, min=0, max=100)\n\n    # stream some telemetry data (random for demo)\n    data = bd.FUNCTION(\n        lambda _: (gain.val * np.random.rand(3)).tolist(),\n        nin=1, # unused import required here to use function as a Clocked Source Block\n        nout=3\n    )\n    bd.connect(bgr, data)\n\n    bd.TUNERSCOPE(\n        data[0], data[1], data[2],\n        nin=3,\n        labels=['x', 'y', 'z'],\n        name='Random Data',\n        tuner=tuner)\n\nbd.compile() # perform verification\nbdsim_realtime.run(bd, tuner=tuner) # run forever\n```\n\nNow access the tuner at [http://localhost:8080](http://localhost:8080)\n\n\n## Development\n\n### Setup\n\n\n```bash\npython -m venv .venv # create venv\nsource .venv/bin/activate # activate venv\n\npip install -e \".[opencv]\" # install in editable symlink mode\nnpm i # install JS deps\n```\n\n#### Frontend\n\n```\nnpm run dev # run hot-reloaded app\n```\n\n#### Backend\n\nSame as non-development version. Run:\n\n```\npython -m bdsim_realtime.webapp\n```\n\nAnd then run your example / test script:\n\n```\npython examples/blob_detector_tuner.py\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallumjhays%2Fbdsim_realtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcallumjhays%2Fbdsim_realtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallumjhays%2Fbdsim_realtime/lists"}