Skip to main content

robot-data-collector-irsl

Receive-only robot episode collection for switch_controller-style robot_msg publishers, review/trim, robomimic export, and portable NumPy/HDF5 training reads with a Grain pipeline. Use it from the terminal UI, the rdc CLI, or as a Python library: a teleoperation program can import it and start/stop recordings from a VR controller button.

The distribution is robot-data-collector-irsl; import robot_data_collector; command rdc. MIT licensed. 0.1.0 is the first stable release (classifier "4 - Beta"): the documented public API, the CLI and the on-disk dataset format follow SemVer. No JAX, PyTorch, TensorFlow, robomimic package or PyArrow is required.

Install

Python 3.11–3.14. The core is lean (numpy, h5py, pyzmq, pillow, robot-msg-irsl); the UI, 3D preview, camera SDK and Grain are extras:

python -m pip install "robot-data-collector-irsl[all]"   # everything (the 0.1.0a2 install)
python -m pip install robot-data-collector-irsl          # lean core: library recording/reading
# or, in a uv project:
uv add "robot-data-collector-irsl[all]"
rdc --help
Extra Adds Needed for
(core) numpy, h5py, pyzmq, pillow, robot-msg-irsl Collector, rdc record/demo/episodes/trim/label/trash/export/verify/recover, Dataset, RobomimicDataset, SequenceSource
tui textual rdc tui
preview mujoco==4.0.1, glfw, PyOpenGL rdc replay --preview, TUI 3D/RGB-D windows, model joint limits in auto recipes
realsense pyrealsense2 (Linux/Windows) Intel RealSense D4xx capture
train grain==0.2.18 make_grain_dataset
all all of the above the full application

A missing extra gives an install hint (for example rdc tui prints pip install 'robot-data-collector-irsl[tui]'). The live collector/raw repository uses POSIX locks and is qualified on Linux; the typed reader/Grain path has not been runtime-tested on every wheel platform. Upgrading from 0.1.0a2? See the 0.1.0 release notes and migration.

Record from your own program

from robot_data_collector import Collector, CollectorConfig


def main():
    config = CollectorConfig.from_toml("collector.toml")  # or CollectorConfig.from_dict({...})
    with Collector(config) as recorder:  # starts the capture service; threads in background
        recorder.wait_ready(timeout=10)  # every required source has fresh valid data
        episode = recorder.start("pick_cube")
        ...  # teleoperate
        info = recorder.stop()  # durable save; recorder.discard() trashes instead
        recorder.label(info.id, outcome="success", review="accepted")
        recorder.on("episode_interrupted", lambda event: print("source lost:", event.error))


if __name__ == "__main__":  # required: collection uses multiprocessing spawn
    main()

Commands are thread-safe and idempotent (stop while idle returns None); start_async/ stop_async/discard_async never block a control loop; astart/astop serve asyncio. triggers.ButtonTrigger/RecordingButtons turn button levels (Meta Quest via meta_bridge, keyboard, foot pedal) into start/stop/discard. One writer owns a dataset root at a time: the TUI and a Collector on the same root refuse each other (DatasetBusyError); readers always work. Full guide: docs/capture-api.md; examples: examples/meta_teleop_record.py, examples/keyboard_trigger.py, examples/jsonl_events.py.

Fast training reads

Training data should be exported once to typed HDF5. Do not decode/realign raw envelopes on every training epoch.

from robot_data_collector import RobomimicDataset, make_grain_dataset


def main():
    with RobomimicDataset.open("training-export", split="train") as dataset:
        print(dataset.observation_keys, dataset.action_names, dataset.fps)
        with dataset.sequences(length=32, stride=1, action_space="normalized") as source:
            sample = source[0]
            print(sample["actions"].shape)  # (32, action_dimension)
            pipeline = make_grain_dataset(
                source,
                batch_size=32,
                shuffle=True,
                seed=42,
                num_workers=2,
                prefetch=1,
            )
            iterator = iter(pipeline)
            batch = None
            try:
                for batch in iterator:
                    print(batch["actions"].shape)  # (B, 32, action_dimension)
            finally:
                batch = None  # optional: release caller-owned output memory
                iterator.close()


if __name__ == "__main__":
    main()
  • Sequences never cross demonstration/clip boundaries; incomplete trailing sequences are excluded, not silently padded. Train/valid splits remain grouped by original parent episode.
  • observations[key], actions, time_ns, valid, sequence_mask, demo_index and start_index are NumPy leaves. valid is not the padding mask or split mask.
  • action_space="physical" uses the stored inverse transform; no inferred units/bounds.
  • source.read_batch([5, 0, 5]) coalesces nearby reads while preserving order and duplicates. Ordinary Grain batching does not promise to call that bulk reader.
  • Each worker lazily opens its own HDF5 handle. Pickles contain paths/options/metadata, never live file handles. Use __main__ for spawn and close both iterator and source. Yielded batches are ordinary caller-owned arrays: retaining them does not hold worker/SHM resources. Closing the iterator cannot free arrays you still retain; budget them separately.
  • num_workers=0 reads synchronously with no prefetch thread. Positive worker counts use project-owned spawn readers, explicit credits and bounded numeric pipes; public Grain source/shuffle/batch operations still determine finite order and values. No upstream process prefetch, shared-memory output, whole-batch pickle, queue feeder or private Grain API is used. Multiprocessing has startup/RSS costs and is not always faster. Admission covers numeric, HDF5 cache/chunk scratch and transport buffers, not total RSS. See the public API for close deadlines, late-start ownership and semantic checkpoint compatibility.

Read native recordings without modifying them

from robot_data_collector import Dataset

with Dataset.open("recording-copy", mode="snapshot") as dataset:
    info = next(dataset.iter_episodes(status="complete"))
    with dataset.episode(info.id) as episode:
        print(episode.primary, episode.sources, episode.recorded_root)
        print(episode.fields(max_events=256))  # bounded, explicitly sampled discovery
        window = episode.load_window("0.1", "0.3", {"q": episode.primary}, strict=True)
        print(window.fields["q"].values, window.fields["q"].time_ns)

snapshot is for an externally immutable offline copy: moved/copied data is allowed; source-side cache/locks/metadata are not written. An external disposable cache is cleaned on close. It is not concurrent live snapshot isolation. The default mode="live" retains writable repository coordination and deletion-protecting OS leases; no silent fallback occurs.

Native fields are asynchronous and can have different timestamps/lengths. Decimal-string or Decimal seconds map to int64 ns; intervals are [start, stop). Missing/empty/zero remain distinct. load_window is capped at100,000 rows/64MiB. Use iter_events or an explicit recipe with episode.view(...).iter_aligned(...) for large reads. view is nonpersistent; episode.set_trim(...) (the kept range) deliberately saves metadata and is not allowed in snapshot mode; the 0.1.0a2 episode.clip(...) still works but is deprecated.

Try the installed package without a robot

Run from any empty working directory; no checkout paths or private APIs are required:

rdc demo --root ./demo-data --seconds 3 --hz 100
rdc episodes --root ./demo-data
rdc init-config --template recipe-demo --output ./demo-recipe.toml
python -m robot_data_collector.examples.export_demo \
  --root ./demo-data --recipe ./demo-recipe.toml --output ./demo-training
rdc verify ./demo-training
python -m robot_data_collector.examples.public_read --root ./demo-data
python -m robot_data_collector.examples.train_grain \
  --dataset ./demo-training --split all --length 8 --batch-size 4 --workers 2

The demo publishes synthetic14-coordinate state/action only on random loopback ports, never controller ports. Its bounds are synthetic, not real-robot limits. Example export begins at an actual primary sample, not an arbitrary timestamp that could lack a causal observation. Existing paths are not overwritten. init-config requires an existing parent directory.

Receive-only collection and TUI

# Copy the INSTALLED template, then edit root/hosts/fields for your deployment.
rdc init-config --template collector --output ./collector.toml
rdc tui --config ./collector.toml

# State-only inspection of an already running local simulator/controller:
rdc init-config --template state-only --output ./state.toml
rdc record --config ./state.toml --task inspection --seconds 3

The state 28400 address is the controller host. Action 28402 is the external target publisher host, not necessarily that same machine. 28401 is ControllerCommand. Templates are explicit local examples, not device autodiscovery.

Keep topic = "" for switch_controller endpoints. Its telemetry publishers (State 28400, StateSnapshot 28405, PlanningStatus 28505) are XPUB sockets that send untopicked single-frame payloads and honor only the empty subscription; a non-empty topic (or topic_hex) never yields valid data: it receives nothing, or, when it happens to prefix the payload (e.g. the binary magic R2), only frames rejected as topic_mismatch. The controller just logs the subscription. rdc record names topic-filtered sources without valid data when preflight times out, and the TUI marks them topic filter set. Non-empty topics remain for other publishers that send a topic frame.

The codec is robot-msg-irsl==0.5.4, matching switch_controller main. Raw wire bytes are stored verbatim, so every StateSnapshot ArmSample.q_des the controller publishes is recorded and projectable as arms.q_des with an explicit component_id (same order/units/length as arms.q). q_des is the controller's held/commanded joint reference, not a measurement; absent or empty means no reference. It is an observation field only (it is not a training action), and its presence toggling does not interrupt an episode. A controller restart (new session_id, sequence reset) interrupts the active episode instead of merging sessions. The collector does not start/stop, reconfigure, restart or send motion commands to the controller. State-only capture is not training-ready; an explicit observation/action recipe is required.

Key TUI action
1 2 3 (or F1–F3), Tab / Shift+Tab switch section: Collect, Episodes (incl. Review & trash), Export. In a text field digits type and Tab first leaves the field; dialogs keep normal Tab
F6, then ← / →, Enter focus the screen's primary action row, move between its buttons, press one
Collect T · Episodes E / V / Delete task field · Note dialog / trash view / move to trash
R, S, Ctrl-Q start recording, stop/drain/save, finalize and quit
Review Space, arrows, Shift+arrows play/pause, sample step, larger step
I, O, L, G, +/- In/Out, range loop, exact time, zoom
Episodes Enter, F, U Review & Trim, restore full length, undo trim change
Review F, Ctrl-S full / trimmed view, save trim
Esc back: leave a text field, close Details/Advanced/trash view, then the previous screen (never quits; asks before dropping an unsaved trim)

Review & Trim opens a trimmed episode showing only its kept range; F switches to the full episode to re-adjust (the 3D window keeps running and just follows the new bounds). Ctrl-S Save trim and Restore full episode write new revisions. The title shows task, recorded time, duration, outcome/review and TRIMMED/FULL; IDs are behind Details. The plot channel picker uses joint names from the recorded model (units only when recorded); raw field/index/ unit and local-model inputs are under Advanced. Every episode has at most one non-destructive trim (kept range), stored as immutable revisions in episodes/ID/trim/; raw shards are never rewritten. F2 shows whether each episode is trimmed or full (kept / full length); Restore full length and Undo trim change are themselves new, reversible revisions. Older clips stay on disk as legacy clips: an untrimmed episode shows its most recent clip range as its trim until you edit it (or run rdc trim --root ROOT --migrate). F3 Export all exports every non-trashed episode with its trim, one robomimic output per task (<dataset>/exports/<task>-<timestamp>), auto-assigning a recipe by task; tasks without one show "needs recipe" with a picker and a prefilled draft. Rejected reviews are excluded unless toggled. Export needs no setup: when no recipe matches a task, one is derived from the recording (joint positions as observations; recorded RobotAction/HandAction commands, else the controller reference arms.q_des, as actions — never the same-time measured position; bounds from the recorded model's joint limits; fps from the primary rate; cameras as images), saved as <dataset>/recipes/<task>.toml marked rdc:auto-recipe, and used at once. A user-written recipe always wins. CLI: rdc trim ID --start S --end E | --restore | --undo | --history, rdc export --all [--include-rejected] [--dry-run], legacy rdc clip create, rdc clips and rdc export --clip remain available. F2 → Edit labels keeps Note as free text; Outcome (success/failure/unknown) and Review (accepted/rejected/unreviewed) are radio choices (click, or Tab → arrows → Space/Enter). A stored value outside those choices is shown unselected and kept unless you pick a new one. O includes the current sample by snapping to its next boundary; storage remains [In, Out). Task/text/select focus does not issue collection shortcuts. Episode/trimmed/export counts are separate. Trash/restore preserve IDs; permanent purge needs explicit confirmation and refuses referenced or leased data. Startup failures show SERVICE FAILED, not an endless connection claim. Configuration-relative ../data paths are supported with traversal/symlink defenses.

3D preview (extra preview)

The preview extra installs MuJoCo 4.0.1 (the mujoco meta package: mujoco-core + mujoco-studio). A source checkout's uv sync installs every extra:

uv sync
uv run rdc tui --config configs/dual_nero_preview.toml

For a package installation, create the installed profile instead of relying on a checkout:

rdc init-config --template simulation-preview --output ./simulation.toml
rdc tui --config ./simulation.toml

The simulator must already provide native StateSnapshot PUB28405 and read-only model TCP28430. This profile records new episodes under data/dual-nero-preview, separate from state-only data. In the TUI, record with R, stop/save with S, then F2 → Review & Trim → top-row 3D toggle (the 3D preview button, labelled 3D: off / 3D: on). The robot appears in a separate MuJoCo window, not in the terminal. The CLI equivalent is rdc replay EPISODE_ID --root DATASET_ROOT --preview.

Opening an episode with a recorded model prewarms a windowless preview process (current model only); clicking 3D preview (the 3D toggle) then only creates the window. The 3D window is persistent and reused. The first 3D preview starts one preview process and window; opening another episode or clip, leaving and reopening Review, and switching models reuse that same process and window. The same model_id only switches the pose stream; a different model is swapped into the open window from a small in-process cache (at most 3 compiled models / 768 MiB, the displayed one is never evicted). While no episode is attached, the last pose is dimmed as stale. Pressing the 3D toggle while it is attached, closing the window, or quitting the TUI shuts the process down with a bounded sequence (orderly viewer close, bounded join, then terminate/kill), so a hung or crashed viewer never blocks the TUI; the next 3D preview starts a fresh window. If one episode has no usable model, the window stays up and that episode falls back to graphs with a diagnostic. Asset bytes are SHA-256 verified once per preview process, immediately before compiling a model_id; later opens reuse the compiled, content-addressed model. rdc replay --preview uses a private window that closes when the replay ends.

The window opens small (640×480 by default) with both side panels hidden; press Tab / Shift+Tab to show the left / right panel. On X11 (including Xvfb and GNOME on Xorg) it is moved to a corner of the monitor it opened on: the corner farthest from the TUI terminal when the terminal exports WINDOWID, otherwise the top-right. Size, placement and hidden panels are kept across episode and model switches. If the window cannot be found (e.g. a Wayland-only session), the viewer keeps its default size. Override the size with an optional, display-only table in the collector TOML (it is never stored with episodes):

[preview]
width = 800   # 160..7680, default 640
height = 600  # 120..4320, default 480

For CLI replay use rdc replay ID --root ROOT --preview --preview-width 800 --preview-height 600.

Since 0.1.0 MuJoCo is the preview extra again (0.1.0a2 installed it by default). A state-only episode does not gain recorded native pose or model metadata just because today's configuration is changed. Keep it for numeric review, or record a new episode using simulation-preview.

Passive preview applies measurements with mj_forward, not mj_step or robot commands. MJB requires the descriptor's exact engine version: switch_controller simulation serves MJB with engine_version 4.0.1 (its mj_versionString(), equal to Python mujoco.__version__), and MJB files do not load across 3.13/4.0.1. Real backends serve MJCF with engine_version any; its includes are resolved against the main file (the exporter writes root-relative assets/N-name paths) and texture cube faces (fileleft...fileback) are supported. MuJoCo 4 writes absolute, host-specific asset paths into compiled models, so a served model_id differs between hosts/installs; models are cached content-addressed per model_id and never assumed stable across hosts. Missing display/model or an engine mismatch gives a diagnostic and graph-only fallback. The classic passive mujoco.viewer window is still used (verified with 4.0.1, including under Xvfb); MuJoCo Studio is not required.

RGB-D: compact recording, replay and training

# Without hardware: actual capture/codec/storage path, synthetic acquisition only.
rdc demo --rgbd --root ./rgbd-data --seconds 3 --hz 200
python -m robot_data_collector.examples.export_rgbd_demo \
  --root ./rgbd-data --output ./rgbd-training
rdc verify ./rgbd-training
python -m robot_data_collector.examples.read_rgbd \
  --dataset ./rgbd-training --camera front --length 1 --workers 2 --max-mib 256 --transform

# With one D4xx: edit hosts/root/serial BEFORE starting collection.
rdc init-config --template realsense --output ./camera.toml
rdc tui --config ./camera.toml
rdc init-config --template recipe-rgbd --output ./rgbd-recipe.toml

The reference native profile is RGB640×480 + Z16 depth640×480 at30FPS. The installed realsense template requires the camera and the configured state/external-action publishers. A missing required camera prevents recording; no fallback profile is silently negotiated. The SDK is the realsense extra on supported Linux/Windows wheels; macOS has no SDK marker. Live collection uses POSIX locks and is qualified on Linux, not Windows despite SDK availability. Enumeration on the reference host found no device: physical sensor capture remains unverified.

  • Native storage keeps one atomic header/JPEG/PNG pair: RGB JPEG90,4:4:4, depth lossless uint16 PNG level1, including invalid0 and65535. Calibration, native unaligned dimensions, directed extrinsics, depth scale, device frame clocks and host receipt times are preserved. No automatic normalization, alignment, hole filling, filtering or resampling occurs.
  • F2 → Review & Trim → camera selector → top-row Images toggle opens a separate passive GLFW window (RGB left, depth colormap right). Seek/I/O/loop share the graph playhead. Display colorization does not change saved depth; missing/stale frames are explicit.
  • episode.iter_frames(camera="front", decode=False) returns lazy pair references. Use decode=True for owned uint8 HWC RGB / uint16 HW depth. Snapshot reads do not write source.
  • Export schema2 keeps RGB uint8 HWC under obs and raw depth under collector/media. RobomimicDataset.sequences(..., depth_keys=("front",)) explicitly selects Z16. Typed training epochs use HDF5, not Pillow again. rgb_chw and depth_metres are explicit helpers. Raw Z16 is not registered in stock robomimic's clipping depth modality.
  • Typed export is a separate dense pixel copy and may be substantially larger than native JPEG/PNG, particularly with held images. Preflight reserves decoded output plus free-space reserve. Recording does not automatically double-store/export every episode.
  • Image carry-in is opt-in (ImageSpec default false); the packaged recipe explicitly uses true with100ms maximum age. RGB/depth always come from the same causal at-or-before pair. Original timestamp/ref/age are preserved; repeated device frames cannot refresh age.

See RGB-D API and schema and measured quality/capacity/performance.

Other known limitations

  • External robomimic v0.5.0 loader/full BC training tests remain opt-in and unexecuted. env_args.type=-1 is an offline-only sentinel, not an instantiable simulator/rollout promise.
  • Core codec is robot-msg-irsl==0.5.4. Recordings made with the previous 0.5.0 pin stay readable: their StateSnapshot/HandState/RobotState/real-time RobotAction bytes decode unchanged. robot-msg 0.5.3 changed the binary RobotAction trajectory layout without a legacy decoder, so binary trajectory RobotAction bytes from pre-0.5.3 publishers now surface as decode_error QC (raw bytes preserved; such actions were never exportable and the QC still invalidates held actions). Collectors pinned to 0.5.0 cannot decode new 0.5.4 snapshots that carry q_des. Raw preservation is not semantic compatibility.
  • Published action is intent, not applied/accepted output. Controller-local TUI actions are not observed on the wire. PUB/SUB is best effort; send time is not measurement time, and clock IDs do not establish physical synchronization. No zero-impact/lossless claim.
  • Alpha2 fixes the historical a1 no-predecessor future-seek, repeated range-step scan and cancelled cold-index owned temporary-file cleanup issues with regressions. Native first index/carry-in reconstruction can still scan history; there is no universal instant-seek claim.
  • Policy training, cloud upload and real motion replay are not implemented.
  • Historical upstream Grain SHM execution emitted cleanup warnings; a subsequent upstream copied-IPC candidate hung on large-batch close and retained queue FDs. Those failures remain documented, not suppressed. Current source uses project-owned workers and numeric pipes; finite RGB-D/numeric, retained handles, fault/close and checkpoint regressions are separate evidence, not a universal OS-stall/shutdown guarantee. The historical288-case performance matrix is not relabelled as current throughput; a new short4-case comparison is recorded.
  • Synthetic post-optimization1000Hz state+action30s capture completed on the reference host with60,127 admitted=committed and zero observed local queue overflow. Historical pre-fix runs overflowed. This is not a real payload, indefinite, or upstream-loss guarantee. Typed reading benchmarks also record worker startup and memory penalties.

Development and verification

In a source checkout: uv sync --locked (installs every extra), uv run pytest, uv run ruff check ., uv run ruff format --check ., uvx pyright, uv build --no-sources. No controller is launched by these commands. Release builds use exact new-name artifacts; no datasets/cache/credentials are shipped.

Documentation (index): library recording, reading API, extension points, integrations, compatibility and versioning, collection use, format, recipes, recovery, capture measurements, reading measurements, CHANGELOG and 0.1.0 release notes. The installed examples and templates above remain usable even when those checkout documents are not installed.

Metadata

Release files for robot-data-collector-irsl 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robot-data-collector-irsl 0.1.0
File Size Uploaded Provenance Actions
robot_data_collector_irsl-0.1.0.tar.gz 308.0 kB Without provenance Details for robot_data_collector_irsl-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for robot-data-collector-irsl 0.1.0
File Interpreter ABI Platform Actions
robot_data_collector_irsl-0.1.0-py3-none-any.whl Python 3 none any Details for robot_data_collector_irsl-0.1.0-py3-none-any.whl

Total release size: 677.6 kB

Release files / robot_data_collector_irsl-0.1.0.tar.gz

Download URL robot_data_collector_irsl-0.1.0.tar.gz
Size 308.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9495448760028f775451d3a0f6b6139354a3e4c9b82a1c396fb68412ebd3e233
BLAKE2b-256 checksum
How to use checksums
316ad91fde928f082aacd01017b6af461dc8a41f7008a6b3362195f7a5cbdcb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / robot_data_collector_irsl-0.1.0-py3-none-any.whl

Download URL robot_data_collector_irsl-0.1.0-py3-none-any.whl
Size 369.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1ce6692aa18d9b751f0f890f8a30412fec940f8114b5a8c36a26ef611edeb22
BLAKE2b-256 checksum
How to use checksums
23ab55592a6048363233c1fe4bd54a116579b7cb9b44867b15eaa6958054d1af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for robot-data-collector-irsl 0.1.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page