BB.TUI

Hex.pmDocsCILicense

Terminal-based dashboard for Beam Bots robots. Built on ExRatatui.

BB.TUI Demo

Features

Layout

🤖 BB.TUI · MyApp.Robot ← title bar
╭ Safety ────────╮╭ Joint Control ────────────────────────────────────╮
│ ● ARMED ││ Joint Type Position Target │
│ Runtime: Idle ││ elbow rev -63.8° -90 ─────●────── 90 │ 60%
│ a arm ││ gripper SIM pri 30.6 mm 0 ─────●────── 50 │ height
│ d disarm ││ wrist rev 87.0° ! -90 ──────────◆─ 90 │
├ Commands (2) ──┤│ ... │
│ ▶ home ● Ready││ │
│ calibrate ││ │
╰────────────────╯╰───────────────────────────────────────────────────╯
╭ Events (47) ───╮╭ Parameters ───────────────────────────────────────╮
│ 18:23:12 sensor.sim JointState 2 joint(s) ││
│ 18:23:11 state_machine disarmed → armed ││
╰────────────────────────────────────────────────────────────────────╯╯
MyApp.Robot │ ● ARMED │ idle Tab panel ? help q quit a arm d disarm

Installation

Use Igniter to add bb_tui to a project. The installer imports formatter rules and prints a launch notice tailored to the chosen install shape. If the project already has a BB robot module (typically scaffolded by mix igniter.install bb):

mix igniter.install bb_tui
mix igniter.install bb_tui --robot MyApp.Arm

The install shape can be tuned with flags:

Local dashboards are not supervised — a child that claims the terminal on boot would fight an IEx session for stdin/stdout — so the local entry points are mix bb.tui and BB.TUI.run/1. See mix help bb_tui.install for the full option reference, and the Transports guide for SSH and distribution setups.

To skip Igniter, add the dep directly:

def deps do
[
{:bb_tui, "~> 0.1"}
]
end

Quick Start

Standalone, via the mix task:

mix bb.tui --robot MyApp.Robot

From IEx:

BB.TUI.start(MyApp.Robot)

Under a supervision tree:

children = [
{BB.Supervisor, MyApp.Robot},
{BB.TUI, robot: MyApp.Robot}
]

Serving the dashboard over SSH or attaching to a robot on another BEAM node is covered in the Transports guide. The full key reference lives in the Keybindings guide (and in the in-app ? overlay).

How It Works

BB stores state in ETS and publishes changes over PubSub. The TUI subscribes to the [:state_machine], [:sensor], and [:param] paths, takes a one-time ETS snapshot on mount, then keeps state fresh from PubSub messages. Keyboard events call BB APIs directly (safety, actuator, command execution) — there are no optimistic updates, so the dashboard is a faithful reflection of the robot's actual state.

All state transitions live in BB.TUI.State as pure functions — no side effects, no process communication — which makes the dashboard easy to test headlessly. BB.TUI.App wires input and async results to those transitions through ExRatatui's reducer runtime.

Robots can publish sensor data faster than a terminal can usefully redraw, so the event log debounces repeats of the same {path, payload-type} within a one-second window, and sensor-driven renders coalesce to at most one frame every ~33ms (~30fps). Key presses, command results, and safety/parameter/state changes still render immediately. Both windows are fields on BB.TUI.State.Throttle.

Configuration

KeyDefaultNotes
:bb_tui, :command_timeout30_000 msWait window for BB.Command.await/2 on commands dispatched from the UI. Compile-time only — downstream apps need mix deps.compile bb_tui --force after changing it.
# config/config.exs
config :bb_tui, command_timeout: 30_000

Development

The project ships a simulated WidowX-200 robot arm that starts automatically in dev:

mix deps.get
mix bb.tui --robot Dev.TestRobot

Dev.TestRobot exercises every panel feature end-to-end:

Exercising the SSH and Erlang-distribution transports against the simulated robot is covered in the Transports guide.

Guides

GuideDescription
TransportsServe the dashboard over SSH or attach over Erlang distribution, inspect a running session, and test both locally
KeybindingsFull per-panel key reference, including command argument editing and parameter stepping
Telemetry:telemetry events for mount, input, dispatch, and frames — logging and Telemetry.Metrics

Contributing

See CONTRIBUTING.md for development setup and guidelines.

BB.TUI is built on ExRatatui - a general-purpose terminal UI library for Elixir, and Beam Bots - robotics framework. Contributions to underlying libraries are very welcome too.

License

Apache-2.0 — see LICENSE.