Skip to main content

Roboflex Visualization/GUI Library using IMGUI/IMPLOT

Project description

roboflex_imgui

Roboflex visualizers and guis using IMGUI/IMPLOT

System dependencies

Requires SDL and GLEW to be installed. More than likely, they already are installed in your distro. But if not:

apt-get install libsdl2-dev
apt-get install libglew-dev

# or maybe on mac:

brew install sdl2
brew install glew
brew install glfw

pip install

pip install roboflex.imgui

Import

import roboflex.imgui as rgu

Nodes

There are two so far: OneDTV and MetricsTelevision

OneDTV (One-Dimensional Television)

It expects to receive messages that contain a tensor under the key <data_key>. That tensor needs to be of shape (C, S), where C is number of channels, and S is sequence length. In general, C should be small (< 20), and S large. Think multiple audio channels.

# all parameters optional: below are the defaults
visualizer = rgu.OneDTV(
    data_key = "data",
    sample_size = 4,
    center_zero = True,
    initial_size = (640, 220),
    initial_pos = (-1, -1),
    name = "OneDTV",
    debug = False,
)

# must be started
visualizer.start()

# NOTE!!!
# On some systems, such as mac, it's bad news to
# run a UI on a non-main thread. So instead of 
# calling start(), you can do this, which will 
# run on the main thread. This call will block 
# until the window is closed, in this case.
visualizer.run()

MetricsTelevision

Real-time visualization of metrics data as published by GraphRoot::start(profile=True). I.e., when you instantiate a GraphRoot (from roboflex core), make it the root of your graph, and call myroot.start(profile=True) on it, it will publish metrics messages. This is the node that can visualize those metrcs message.

# all parameters optional: below are the defaults
visualizer = rgu.MetricsTelevision(
    window_title = "MetricsTelevision",
    initial_size = (1580, 720),
    initial_pos = (-1, -1),
    name = "MetricsTelevision",
    debug = False,
)

# must be started
visualizer.start()

# NOTE!!!
# On some systems, such as mac, it's bad news to
# run a UI on a non-main thread. So instead of 
# calling start(), you can do this, which will 
# run on the main thread. This call will block 
# until the window is closed, in this case.
visualizer.run()

Using MQTT in this case

MQTT is an ideal transport for metrics messages - they are small and infrequent. We provide helper functions in metrics_central.py to do so:

# give one of these to a GraphRoot as it's publisher node
pub = rgu.metrics_central.get_metrics_mqtt_publisher(
    broker_address: str,
    broker_port: int = 1883,
    metrics_topic: str = "metrics",
)

# get a subscriber
sub = rgu.get_metrics_mqtt_subscriber(
    broker_address: str,
    broker_port: int = 1883,
    metrics_topic: str = "metrics",
)

# get a visualizer
vis = rgu.get_metrics_visualizer(
    broker_address: str,
    broker_port: int = 1883,
    metrics_topic: str = "metrics",
)

# connect the subscriber to the visualizer
sub > vis

# Here's a program that does it all - launches a MetricsVisualizer
# listening to some mqtt broker:port and topic.
python3 metrics_central.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roboflex_imgui-0.1.19.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

roboflex_imgui-0.1.19-cp311-cp311-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file roboflex_imgui-0.1.19.tar.gz.

File metadata

  • Download URL: roboflex_imgui-0.1.19.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for roboflex_imgui-0.1.19.tar.gz
Algorithm Hash digest
SHA256 9146dfef8235da06b3e574eefa7dbc4da36194bfb0d14686ad5aae45c6b902a5
MD5 095e4699727ebe665bfa22af9559514a
BLAKE2b-256 d1f8aba25a60eea4c03b4dd6577b936a01afb412178c31af20ba17bbae0876c4

See more details on using hashes here.

File details

Details for the file roboflex_imgui-0.1.19-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for roboflex_imgui-0.1.19-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9c349c3d7f58d323569277b3b1d0b8806bade14d9a004d0e0b63ac73f12043a6
MD5 6ee4e542f94430eab4c1bdc993a57954
BLAKE2b-256 00ed51943bb966f9bc0c84b2316a05578d6a39c8a9729d69463b16257c4aa891

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page