Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
robotics
embodied-ai
human-demonstration
egocentric-video
bimanual-manipulation
tactile-sensing
License:
File size: 2,499 Bytes
9ff4bea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | from __future__ import annotations
from typing import TYPE_CHECKING
import rerun_bindings as bindings
from .chunk._chunk import Chunk
from .chunk._chunk_store import ChunkStore
from .chunk._lazy_chunk_stream import LazyChunkStream
from .chunk._lazy_store import LazyStore
if TYPE_CHECKING:
from collections.abc import Iterable
from rerun.recording_stream import RecordingStream
from rerun_bindings import ChunkInternal
def _unwrap(c: object) -> ChunkInternal:
"""Validate-then-unwrap a single chunk for the bindings iterable arm."""
if not isinstance(c, Chunk):
raise TypeError(
f"send_chunks expects Chunk objects in the iterable, got {type(c).__name__!r}",
)
return c._internal
def send_chunks(
chunks: Chunk | LazyChunkStream | LazyStore | ChunkStore | Iterable[Chunk],
*,
recording: RecordingStream | None = None,
) -> None:
"""
Send chunks to a recording stream. Blocks until every chunk has been queued.
!!! note
For a `LazyChunkStream` and `LazyStore` inputs, this call triggers execution
and/or loading and will block for the duration of this process.
Parameters
----------
chunks:
One of:
- A single [`Chunk`][rerun.chunk.Chunk].
- A [`LazyChunkStream`][rerun.chunk.LazyChunkStream] — consume
the stream and forward all chunks to the recording stream.
- A [`LazyStore`][rerun.chunk.LazyStore] — send all chunks to the
recording stream. This triggers loading all chunks from the source.
- A [`ChunkStore`][rerun.chunk.ChunkStore] — send all chunks to
the recording stream (fast since all chunks are already loaded).
- Any iterable of `Chunk` objects.
Source store identity (`application_id`, `recording_id`) is **not**
preserved: chunks adopt the destination recording's identity.
recording:
Recording stream to send into. Defaults to the current active recording.
"""
native = recording.to_native() if recording is not None else None
match chunks:
case LazyStore() | ChunkStore():
chunks.stream()._internal.send_to_recording(native)
case LazyChunkStream():
chunks._internal.send_to_recording(native)
case Chunk():
bindings.send_chunks(chunks._internal, recording=native)
case _: # Iterable[Chunk]
bindings.send_chunks((_unwrap(c) for c in chunks), recording=native)
|