Layer 4 — rSkill (S1)
Part of the OpenRAL public-symbol inventory. Hand-curated;
(LNN)markers are refreshed bytools/refresh_methods_linenos.py.
python/rskill/src/openral_rskill/base.py
rSkillBase — abstract base class with lifecycle state machine.
- const
_TRANSITIONS: dict[RSkillState, frozenset[RSkillState]] = {...}— Legal lifecycle edges keyed by current state;_require_transitionchecks membership. (L59) class rSkillBase(abc.ABC)— Abstract base class for all OpenRAL skills (rSkill is the official package-format name). (L68)__init__(name, *, version='0.1.0', role='s1', embodiment_tags=None, latency_budget_ms=None)— Init only; does not configure or load weights. (L98)info -> RSkillInfo[@property] (L122)name -> str[@property] (L130)state -> RSkillState[@property] (L135)configure() -> None—unconfigured → inactive. (L142)activate() -> None—inactive → active. (L167)deactivate() -> None—active → inactive. (L189)shutdown() -> None— Any state →finalized. (L209)step(world_state) -> Action— One inference step (hot path). (L233)on_load_weights() -> None— Hook: load weights. (L279)on_unload_weights() -> None— Hook: release weights, called byshutdown()(VRAM eviction). (L286)on_quantize() -> None— Hook: apply quantization. (L296)on_warmup() -> None— Hook: dummy forward pass, called byactivate()before_activate_impl; default no-op. The deploy path implements it in the runner's policy shim (rskill_runner_node.pyon_warmup), which runsadapter.stepon a synthetic observation and swallows+logs failures asrskill_runner.warmup_failed. (L303)_configure_impl/_activate_impl/_deactivate_impl/_shutdown_impl/_step_impl()[@abstractmethod] (L313)- private:
_transition,_update,_require_transition,_enter_error
python/rskill/src/openral_rskill/runtime.py
Runtime Protocol and NullRuntime — inference backend contract.
class Runtime(Protocol)— Structural protocol for skill inference backends. (L24)is_loaded -> bool[@property] (L40)device -> str[@property] (L45)load(path) -> None(L49)infer(inputs) -> dict[str, Any](L61)quantize(config: QuantizationConfig) -> None(L76)warmup(inputs) -> None(L88)unload() -> None(L96)class NullRuntime— No-op backend for testing; same surface asRuntime, every method a no-op. (L101)__init__(device='cpu')(L123)is_loaded -> bool[@property] (L133)device -> str[@property] (L138)load(path) -> None(L142)infer(inputs) -> dict[str, Any](L150)quantize(config) -> None(L161)warmup(inputs) -> None(L168)unload() -> None(L175)
python/rskill/src/openral_rskill/runtime_pytorch.py
- const
_ALLOW_UNSAFE_PICKLE_ENV = "OPENRAL_ALLOW_UNSAFE_PICKLE"— Env var gatingload()'s pickle deserialization (C2). (L38) class PyTorchRuntime—torch-backedRuntime. (L41)__init__(device='cpu')(L70)is_loaded -> bool[@property] (L81)device -> str[@property] (L86)load(path) -> None— Unpickles a full module — gated behind_ALLOW_UNSAFE_PICKLE_ENV, C2. (L90)load_safetensors(path, *, model, strict=True) -> None— Safe: loads astate_dictinto a caller-supplied module, no code execution — preferred for new skills. (L146)infer(inputs) -> dict[str, Any](L202)quantize(config) -> None— Dynamic INT8 on Linear. (L229)warmup(inputs) -> None(L261)unload() -> None— Frees CUDA cache. (L273)
python/rskill/src/openral_rskill/runtime_onnx.py
- const
_CUDA_PROVIDERS = ["CUDAExecutionProvider", "CPUExecutionProvider"](L30) - const
_CPU_PROVIDERS = ["CPUExecutionProvider"](L31) class ONNXRuntime—onnxruntime-backedRuntime. (L52)__init__(device='cpu')(L80)is_loaded -> bool[@property] (L100)device -> str[@property] (L105)load(path) -> None(L109)infer(inputs) -> dict[str, Any](L132)quantize(config) -> None— Always raises — ONNX quantization is pre-applied. (L157)warmup(inputs) -> None(L173)unload() -> None(L186)
python/rskill/src/openral_rskill/backend_registry.py
Extraction seam: entry-point-based runtime-backend + policy-attach-hook registry.
- const
_RUNTIME_BACKENDS_GROUP = "openral.runtime_backends"(L41) - const
_POLICY_ATTACH_HOOKS_GROUP = "openral.policy_attach_hooks"(L42) - const
_BUILTIN_RUNTIME_BACKENDS: dict[str, str] = {...}— Built-inkind→ runtime-class-name map (pytorch/onnx/null). (L48) resolve_runtime_backend(kind: str) -> type[Runtime]— built-in dict (pytorch→PyTorchRuntime,onnx→ONNXRuntime,null→NullRuntime) first, else looked up via theopenral.runtime_backendsentry-point group (e.g.openral-pro-trtregisteringtensorrt). Miss →ROSConfigErrornamingopenral-pro-trt. (L55)maybe_attach_pro_hooks(policy_name: str, skill, **kwargs) -> bool— Generic policy-attach-hook lookup via theopenral.policy_attach_hooksentry-point group (name =policy_name). No hook installed → debug log +False, never a silent skip; hook found → invoked ashook(skill, **kwargs). (L106)
Moved to OpenRAL Pro:
runtime_tensorrt.py(TensorRTRuntime),smolvla_export.py,smolvla_trt.py, andact_trt.pynow live in the privateopenral-pro-trtpackage asopenral_pro_trt.*, plugging in via theopenral.runtime_backends/openral.policy_attach_hooksentry-point groups above.
python/rskill/src/openral_rskill/loader.py
rSkill loader — HF Hub download, manifest validation, license guard, local registry.
- const
_DATA_HOME = Path(os.environ.get("OPENRAL_DATA_HOME", ...))— Base dir for the local rSkill registry. (L66) - const
_CACHE_HOME = Path(...)— Base dir HF Hub downloads land under. (L67) - const
DEFAULT_REGISTRY_PATH: Path = _DATA_HOME / "rskills.json"— Default JSON registry file written byrSkill.from_pretrained. (L71) - const
_RSKILL_MANIFEST_CACHE: dict[str, RSkillManifest] = {}— In-process memoisation forload_rskill_manifest. (L76) - const
_ALLOW_NONCOMMERCIAL_ENV = "OPENRAL_ALLOW_NONCOMMERCIAL"— Env var gating noncommercial-weight loads (CLAUDE.md §1.9). (L80) - const
_REQUIRE_SIGNED_ENV = "OPENRAL_REQUIRE_SIGNED_SKILLS"— Env var that fails closed when provenance signing is unverified. (L85) - const
_EMBODIMENT_ANY_TAG: str = "any"— Sentinel embodiment tag matching every robot. (L93) class InstalledRSkillEntry(BaseModel)— One row in the local registry. (L99) fields:repo_id, version, revision, local_dir, manifest_path, license, role, embodiment_tags, installed_atclass rSkill— Packaged, capability-tagged robot skill; provenance signing is not yet enforced. (L143)__init__(manifest, local_dir)(L167)from_pretrained(cls, repo_id, *, revision=None, cache_dir=None, force_download=False, commercial_use=True, registry_path=None) -> rSkill[@classmethod] — Download from HF Hub, validate, register. (L180)from_yaml(cls, path, *, local_dir=None) -> rSkill[@classmethod] — Load locally without network. (L299)list_installed(registry_path=None) -> list[InstalledRSkillEntry][@staticmethod] (L334)uninstall(repo_id, registry_path=None) -> bool[@staticmethod] — Remove from registry only. (L365)check_embodiment_tags(manifest, robot_capabilities) -> None[@staticmethod] — Verify embodiment tag intersection (raises on disjoint sets). Exempt for perception kinds (detector/segmenter/vlm,_EMBODIMENT_AGNOSTIC_KINDS): they are camera-in → detections/text-out with no action contract, so they match any robot regardless of tags. (L395)check_capability_flags(manifest, robot_capabilities) -> None[@staticmethod] — Verify everymanifest.capabilities_requiredflag againstRobotCapabilities. (L423)check_runtime(manifest, robot_capabilities) -> None[@staticmethod] — Verifymanifest.runtime∈gpu_supported_runtimes; skipped when the legacy capability field is missing or empty (the GPU support fields moved toComputeSpec, so missing means "unknown" for now). (L455)check_quantization_dtype(manifest, robot_capabilities) -> None[@staticmethod] — Verifymanifest.quantization.dtype∈gpu_supported_dtypes; skipped when the legacy capability field is missing or empty. (L484)check_capabilities(manifest, robot_capabilities) -> None[@staticmethod] — Composition of the four narrower checks; raises on first failure. (L512)check_sensors(manifest, robot_sensors) -> None[@staticmethod] — Verify the robot exposes everySensorRequirementthe manifest declares: avla_feature_keyrequirement resolves to exactly one matching robot sensor, otherwise the robot must exposecountsensors of the requested modality meeting any resolution minimum.ROSCapabilityMismatchon any unmet requirement. (L550)check_compatibility(manifest, robot, *, scene_gripper_convention=None) -> None[@staticmethod] — Umbrella entry point combiningcheck_capabilities(embodiment tags + capability flags, withcompute=robot.compute_edge or robot.compute_local),check_sensorsagainstrobot.sensors, andcheck_gripper_conventions. (L591)check_gripper_conventions(manifest, robot, *, scene_gripper_convention=None) -> None[@staticmethod] — Refuse (ROSCapabilityMismatch) a skill whoseGRIPPER_*encoding (its gripper actuator'sgripper_convention) differs from what the addressed end effector — or, withscene_gripper_convention, the simulated scene's environment — consumes; targets come from explicit gripper slots or slots expanded fromaction_contract.representation; an undeclared encoding on either side is a mismatch. Called by the runner when it resolves a skill and byopenral sim run. (L631)_check_license(manifest, *, commercial_use) -> None[@staticmethod] — Enforce license guards for the manifest's declared posture. (L829)_validate_eval_jsons(skill_dir) -> None[@staticmethod] — Validate every<skill_dir>/eval/*.jsonagainstRSkillEvalResult. (L929)_register(entry, registry_path) -> None[@staticmethod] (L955)__repr__() -> str(L979)resolve_rskill_local_dir(uri) -> Path | None— Return the absolute on-disk directory of an in-tree rSkill from a bare skill ref (name,rskills/<name>, or Hub repo id), orNonefor Hub-only refs. Used byopenral benchmark runto write eval results and updaterskill.yamlregardless of cwd. (L991)_candidate_local_paths(uri) -> list[Path]— Enumerate on-disk candidates (cwd-relative + repo-root anchored) for a skill reference. Also unwraps HF Hub form<org>/rskill-<name>to in-treerskills/<name>. (L1012)discover_intree_rskills() -> list[tuple[str, RSkillManifest]]— Walk<repo>/rskills/*/rskill.yamland return(name, manifest)pairs. Malformed entries are skipped with a stderr warning. (L1047)find_repo_root_from(start) -> Path | None— Walk up fromstartfor the first ancestor containing bothpyproject.tomlandrskills/. Public, re-exported fromopenral_rskill.__init__; used across the package boundary byopenral_sim.cli,openral_cli.main, and the deploy_e2e launch file. (L1078)SKILL_ONLY_EMBODIMENT_TAGS: frozenset[str]—{"any", "custom", "multi"}: embodiment tags valid on an rSkill manifest that no robot declares. (L1091)intree_embodiment_tags() -> frozenset[str]—SKILL_ONLY_EMBODIMENT_TAGSplus everycapabilities.embodiment_tagsof the checkout'srobots/*/robot.yaml; the typo guard for the openEmbodimentTagid (scaffolders + CI). Public, re-exported. (L1096)known_benchmark_ids() -> frozenset[str] | None—benchmarks/*.yaml∪scenes/benchmark/*.yamlstems of the checkout, orNonewithout one; the membership set for the openBenchmarkNameid (writeback,benchmark sceneguard, CI). Public, re-exported. (L1113)_warn_unknown_benchmarks(manifest, *, source) -> None—rskill.unknown_benchmarkswarning (never a failure) when a Hub manifest cites a benchmark the checkout lacks; called byrSkill.from_pretrained. (L1129)validate_skill_ref(raw) -> str— Validate and return a bare rSkill reference unchanged (bare name,rskills/<name>path, or HF repo id); rejects a known URI scheme (hf://,local://,file://,http(s)://). Public, re-exported fromopenral_rskill.__init__. (L1141)load_rskill_manifest(uri) -> RSkillManifest— Resolve a bare skill reference to a parsed manifest. Tries local path → in-tree mapping → HF Hub download. In-process memoised. (L1181)resolve_rskill_to_hf(uri) -> str— Resolve a skill reference to either the underlying HF Hub repo id (hf://...) or an absolute local path (local://...); both forms are accepted byfrom_pretrainedhelpers. (L1253)resolve_rskill_to_hf_with_revision(uri) -> tuple[str, str | None]— Likeresolve_rskill_to_hfbut splits the optional@<branch-or-sha>pin off anhf://weights_uriinto a separaterevision, since HF drops a pin glued onto the repo id. A directory that already holdsmodel.safetensors(or a shardedmodel.safetensors.index.json+ shards) next to itsrskill.yaml— the snapshotrSkill.from_pretrainedleaves in~/.cache/openral/rskills— resolves to itself rather than following itshf://pointer, which otherwise re-resolved a just-downloaded repo through the default HF cache (second fetch online, hard failure offline). In-treerskills/<name>/dirs ship no weights and are unaffected. (L1287)
python/rskill/src/openral_rskill/hub_search.py
Free-text + facet search over an HF Hub org's rSkills — backs openral rskill search.
class HubRSkillHit(BaseModel)[frozen] — One matching Hub repo. (L43) fields:repo_id, manifest: RSkillManifest, local: Literal["in-tree","installed"] | None, hub_tags: tuple[str, ...].local == "in-tree"compares the Hubrepo_idagainst thenamedeclared by a realrskills/<dir>/rskill.yaml— never against the fetched (possibly stale) remote manifest's ownnamefield.class HubRSkillSearchResult(BaseModel)— Search result:hits(sorted byrepo_id),skipped_repo_ids— the explicit record of dropped repos, since this module never logs a skip itself — andinspected. (L82)search_hub_rskills(query='', *, kind='', role='', embodiment='', license='', family='', org='OpenRAL', limit=None, max_workers=8) -> HubRSkillSearchResult— Lists every repo the org taggedrskillin one Hub call, fetches each candidate'srskill.yamlconcurrently, then matchesquerylocally (case-insensitive, every token substring-matched against id/name/description/tags) and applies the facet filters.limitcaps hits after sorting byrepo_id. (L207)_manifest_haystack(repo_id, manifest, hub_tags) -> str— Build the lower-cased blob_matches_querysearches. (L112)_matches_query(query, haystack) -> bool— Every whitespace-split token must substring-match. (L127)_matches_facets(m, *, kind, role, embodiment, license_, family) -> bool— Whether a manifest passes every non-empty facet filter. (L133)_fetch_one(model) -> tuple[str, RSkillManifest | None, tuple[str, ...], str]— Worker-thread fetch + validate of one repo'srskill.yaml; narrow-catches expected errors so one bad repo never fails the whole search. The skip reason isn't logged (would corrupt--json | jqoutput) — only the repo id surfaces, viaHubRSkillSearchResult.skipped_repo_ids. (L148)_local_markers() -> tuple[frozenset[str], frozenset[str]]—(in_tree_names, installed_repo_ids)for thelocalmarker. A corrupt registry or an invalid row is treated as no installed entries, withlog.warning("rskill.hub_search.registry_unreadable", ...)— never silently swallowed. (L182)
python/rskill/src/openral_rskill/gpu_passthrough.py
GpuPassthroughSkill — minimal rSkill whose per-step image processing provably runs on GPU (M8 PR I/10).
_REDUCTION_SIZE: int = 64— module constant; reduction-target size used to bound GPU latency. (L48)_RGB_CHANNELS: int = 3— module constant; channel count for the GPU mean-reduction read-back. (L52)class GpuPassthroughSkill(rSkillBase)— Uploads eachSensorFrameto torch.cuda, runs per-channel mean reduction (with explicittorch.cuda.synchronize), emits result asAction.confidence. Refuses silent CPU fallback. (L55)__init__(sensor_id='wrist_rgb', n_joints=6, horizon=1, device='cuda', latency_budget_ms=None)(L76)step_count -> int[@property] (L104)on_load_weights() -> None— no-op (skill is weight-less). (L110)on_quantize() -> None— no-op (skill is weight-less). (L114)on_warmup() -> None— Allocate the GPU input buffer + launch a kernel so the first step doesn't pay cudaMalloc latency. (L118)_configure_impl()— Lazy-import torch, resolve device, raise ifcudarequested andtorch.cuda.is_available()is False. (L144)_activate_impl/_deactivate_impl/_shutdown_impl(L169)_step_impl(world_state) -> Action— Pull frame → CPU→GPU upload → GPU reduction → action with confidence. (L185)- private:
_extract_latest_image(world_state) -> NDArray[np.uint8],_gpu_reduce(frame, *, torch) -> (float, float, float). (L227 / L260) _channels(encoding: FrameEncoding) -> int— Per-pixel channel count for aFrameEncoding; MONO8 → 1, BGR8/RGB8 → 3, everything else falls through to a defensive BGR default of 3. (L297)_zero_frame() -> NDArray[np.uint8]— Resilient placeholder when no sensor frame is available yet. (L310)
python/rskill/src/openral_rskill/_diagnostics.py
Shared load-phase instrumentation seam — generalises the inline _heartbeat originally inside openral_sim.policies.pi05 so every VLA adapter's _build_* factory uses the same <prefix>_<name>_{start,heartbeat,done} event shape (CLAUDE.md §1.13 — single seam, no duplicates).
- const
_PAGE_SIZE = os.sysconf("SC_PAGE_SIZE") if hasattr(os, "sysconf") else 4096— Page size in bytes, for converting/proc/self/statm's page count intorss_mb. (L46) phase_timer(name, *, prefix="phase", interval_s=15.0, log=None, gpu_mb=False, **fields) -> Iterator[None][@contextmanager] — Emits<prefix>_<name>_start/heartbeat/doneevents withelapsed_s,rss_mb, andmajor_faultsso a slow-but-idle load is attributable to page reclaim.gpu_mb=Truealso attaches CUDA memory to the heartbeat; torch import is lazy so CPU-only hosts still work. (L136)gpu_allocated_mb(*, no_import=False) -> float | None— Current CUDA allocator usage in MB (memory_allocated, notmemory_reserved), orNoneif unavailable — the single GPU-memory probe eviction accounting and phase-timer heartbeats both read.no_import=Trueconsults only an already-imported torch. Public, re-exported fromopenral_rskill.__init__. (L49)_rss_majflt() -> tuple[float, int] | None— Process RSS (MB) + lifetime major-fault count from/proc/self/{statm,stat};Noneoff Linux. (L82)- const
_PAGE_SIZE: int = os.sysconf("SC_PAGE_SIZE") if hasattr(os, "sysconf") else 4096— Page size in bytes used to convert/proc/self/statm's page count intorss_mb. (L46)
python/rskill/src/openral_rskill/executor.py
Action-chunk executor shared by every chunked VLA family. Also the home of Real-Time Chunking (RTC): with an enabled lerobot RTCConfig the buffer becomes an ActionQueue whose tail a landing prefetch replaces.
- const
_CHUNK_TENSOR_RANK = 3— Expected(batch, chunk, action_dim)tensor rank for a chunk producer's output. (L98) _check_boundary_blend(steps, dims, *, chunk_size, prefetch_at, rtc_enabled, steps_name, dims_name) -> tuple[int, tuple[int, ...] | None]— Single source of the boundary-blend rules, shared byChunkedExecutor.__init__andbuild_chunk_executor(labels viasteps_name/dims_name).stepsan int>= 0, not with RTC, and<the shortest chunk that can enter behind a previous one:chunk_size, or withprefetch_at >= 1thechunk_size - prefetch_at - 1rows a merged chunk keeps (back tochunk_sizewhen that is0, since every merge is then fully stale);dimsgiven only withsteps >= 1, a non-empty list of distinct non-negative ints.ROSConfigErrorotherwise. (L101)_check_rtc_relative(policy, *, rtc_enabled, rtc_prefix_fn, has_postprocess, name) -> None— Single source of the relative-action RTC guard, shared byChunkedExecutor.__init__andbuild_chunk_executor(which runs it beforeinit_rtc_processor). With RTC enabled:ROSConfigErrorwhenpolicy.config.use_relative_actionsis set and nortc_prefix_fnre-anchors the prefix (the raw leftover is relative to the previous chunk's state, openral/openral#378), or whenrtc_prefix_fnis given withoutpostprocess_action(it reads the postprocessed, absolute rows). (L180)_copy_action(action) -> Any— Independent copy of a NumPy / torch action (clone()/np.array(copy=True)); the stored boundary-blend tail. (L228)_host_norm(value) -> float— L2 norm of a NumPy / torch action for any float dtype (torch reduces via.float(), so bfloat16 works; NumPy in float64); the DEBUGjump_norm. (L233)class ChunkedExecutor— Owns the per-step action buffer for every chunked VLA family, optionally overlapping chunk N+1 inference with execution via a background thread; callspredict_action_chunkdirectly rather than resetting lerobot's shared queue. Default producer ispolicy.predict_action_chunk, or a customchunk_fn;prefetch_at=0is synchronous.postprocess_actionfinishes each chunk where it is produced: one host copy of the whole chunk (any non-CPU device — CUDA, MPS, XPU), then the per-action postprocessor on every row, in the producing (prefetch) thread, so pops never touch the GPU and lerobot'sAbsoluteActionsProcessorStepadds the state cached for that chunk's own inference; under RTC it runs at merge time into theActionQueue's processed copy, which pops serve as NumPy, while the raw rows stay for the guidance blend. Without RTC a pre-fetched chunk is appended behind the tail minus its leading actions that are already in the past (_merge_prefetched): it was planned from the observation of the step that launched it (action i targets that step + i), and the tail served those steps meanwhile; a fully stale chunk is discarded and the step replans synchronously. RTC mode (an enabled lerobotRTCConfig) swaps the buffer for anActionQueueand replaces its tail on each prefetch landing instead of appending, requiringprefetch_at >= 1for real overlap. The guidance prefix is the raw leftover rows (truncated toexecution_horizon) — or, withrtc_prefix_fn(relative-action policies, seerelative_rtc_prefix_fn), the postprocessed absolute leftover re-anchored (in the prefetch thread, so a failure surfaces through the background-error path) to the state of the batch the prefetch was built from; ause_relative_actionspolicy without it is refused (_check_rtc_relative). Every merge logschunked_executor.rtc_mergeat DEBUG withchunk_index,merge_tick(served actions before the merge; actionmerge_tick + 1is the first from the new chunk) and the measuredrtc_delay. Boundary blend (opt-inboundary_blend_stepsK, non-RTC only, openral/openral#378): when a chunk enters behind a previous one (prefetch merge after the stale-row drop, or a synchronous re-plan),delta = last_served - new[0]is added to its first K rows with weight1 - (i+1)/(K+1)onblend_dims(default all), so the boundary step is1/(K+1)of the raw jump and row K onward is the policy's own (K must leave row K inside the entering chunk); runs on the robot-facing actions (NumPy or torch, any float dtype incl. bfloat16), stitches to a copy of the last served action (callers may mutate what they get), leaves dims outsideblend_dimsas produced (non-finite values included, never turned into NaN), never blends the first chunk after construction/reset(), and is refused together with RTC. (L244)__init__(policy=None, *, chunk_fn=None, chunk_size=None, prefetch_at=20, rtc_config=None, postprocess_action=None, boundary_blend_steps=0, blend_dims=None, rtc_prefix_fn=None)— Takes policy OR chunk_fn+chunk_size (ValueErrorotherwise). Negativeprefetch_atraisesROSConfigError; it's clamped tochunk_size - 1at construction. An enabledrtc_configrequires a clampedprefetch_at >= 1(ROSConfigErrorotherwise); a lead shorter thanexecution_horizonwarns rather than errors.boundary_blend_steps/blend_dimsare checked by_check_boundary_blend: steps an int>= 0and< chunk_size, and with a pre-fetch also< chunk_size - prefetch_at - 1(the rows a merged chunk keeps after its stale-row drop; when that is0every boundary is a synchronous re-plan and the bound ischunk_size);blend_dimsa non-empty list of distinct non-negative ints given only with steps>= 1; blending + RTC raisesROSConfigError. Ablend_dimsindex past the action width raisesROSConfigErrorwhen the first chunk lands, before any action is served (the robot-facing width is only known after postprocessing). (L247)start() -> None— Mark as running (call after policy is on-device). (L441)stop() -> None— Signal background thread, join. (L445)reset() -> None— Clear buffer/bg state, the boundary-blend tail, and the RTC queue + last delay;policy.reset()when a policy was given. (L452)select_action(batch_or_fn) -> Any— Next action; cold-start foreground inference / buffer pop / wait-on-prefetch. Delegates to_select_action_rtcin RTC mode. (L472)- private:
_pop_and_maybe_prefetch(batch)(every pop routes through it so the trigger is branch-independent),_produce(payload, chunk_index, kind, rtc_kwargs=None)(passessynchronize=Trueon the prefetch path only),_materialize,_extend_buffer,_launch_prefetch(batch),_blend_boundary(actions)(every entering chunk passes through it: checks action type andblend_dimswidth, then fades the new chunk's offset from the last served action over its first K rows; DEBUGchunked_executor.boundary_blendwithjump_normandsteps) - private (RTC):
_select_action_rtc(batch)— serve from theActionQueue, re-checking after the prefetch wait so a landed chunk isn't discarded._rtc_merge(chunk, *, idx_before, served_before)— replace the tail;real_delayis the index delta the queue advanced during inference, and the loggedmerge_tickisserved_before(served count at launch) +real_delay, and the producer's batch dim must be 1._raise_bg_error_if_any()— re-raise a latched background error on the foreground thread. The prefetch path truncates the leftover tail toexecution_horizonrows so tail length doesn't depend on how earlyprefetch_atfires.
python/rskill/src/openral_rskill/execution_budget.py
Execution budgets measured on the graph clock (sim seconds under use_sim_time) with wall-clock backstops, shared by the rSkill runner's goal budget and ROSActionRskill's result wait. Without a graph clock the budget is time.monotonic() exactly as before — never the NTP-stepped ROS system clock. Adapted from DsslRobot/openral.
- const
DEFAULT_WALL_CAP_FACTOR = 20.0— a graph-clock budget may stretch to at most this many times its value in wall seconds: intact down to 0.05x real time (the slowest measured rendering graph, 0.09x, needs 11.1x). (L66) - const
DEFAULT_CLOCK_STALL_S = 10.0— wall seconds the graph clock may stand still before the goal is failed. (L69) - const
PARAM_WALL_CAP_FACTOR = "execution_wall_cap_factor"— ROS parameter name a host node declares to overrideDEFAULT_WALL_CAP_FACTOR; read bynode_execution_budget. (L73) - const
PARAM_CLOCK_STALL_S = "graph_clock_stall_s"— ROS parameter name a host node declares to overrideDEFAULT_CLOCK_STALL_S; read bynode_execution_budget. (L74) class BudgetMiss(BaseModel)— Frozen Pydantic record of why a budget lapsed:kind("deadline_exceeded"|"clock_stalled", thefailure_reasonprefix),elapsed_son the budget's clock, and adetailstring. (L77)class ExecutionBudget— One goal's execution budget; starts at construction. (L97)__init__(budget_s, *, graph_now=None, wall_cap_factor=DEFAULT_WALL_CAP_FACTOR, stall_s=DEFAULT_CLOCK_STALL_S, wall_now=time.monotonic)—graph_nowis a graph-clock seconds callable (seegraph_clock_fn) orNonefor wall time;budget_s <= 0disables every check. RaisesROSConfigErroron a non-finitebudget_s(a NaN would never lapse) and, on a graph-clock budget, on a non-positive / non-finite backstop — the backstops cannot be disabled (deadline fallback is mandatory). (L117)on_graph_clock -> bool[@property] (L150)elapsed_s() -> float— Seconds on the budget's clock;0while a sim node has not yet received its first/clock(the budget anchors on the first non-zero reading, so that message is never a jump that lapses it). A backward/clockjump (sim reset) banks the elapsed so far and re-anchors, so elapsed neither freezes nor rewinds. (L171)progress() -> float—elapsed / budgetclamped to[0, 1]. (L179)check() -> BudgetMiss | None—deadline_exceededwhen elapsed > budget (either clock) or wall elapsed >wall_cap_factor x budget;clock_stalledwhen the graph clock has not advanced (or never started) forstall_sof wall time. (L183)graph_clock_fn(node) -> Callable[[], float] | None— The rclpy node's clock as a seconds callable when itsuse_sim_timeparameter is true at call time, elseNone(also fornode=Noneor an undeclared parameter); re-read per call so a node switched off sim time goes back totime.monotonic(). (L222)node_execution_budget(node, budget_s, *, graph_clock=True) -> ExecutionBudget— AnExecutionBudgetonnode's clock (graph clock whengraph_clockand the node is on sim time now), with the backstops taken from the node'sexecution_wall_cap_factor/graph_clock_stall_sparameters when declared, else the defaults — the one builder the rSkill runner andROSActionRskillshare. (L245)
python/rskill/src/openral_rskill/ros_action_rskill.py
ROS-wrapping rSkill adapter — bridges arbitrary ROS 2 action / service servers (MoveIt, Nav2, …) into the rSkillBase lifecycle. Selected by make_default_skill_resolver when manifest.kind in {"ros_action", "ros_service"}.
- const
_RESULT_DEADLINE_MULTIPLIER = 5.0(L84) - const
_MIN_RESULT_DEADLINE_S = 2.0(L89) - const
_FUTURE_POLL_INTERVAL_S = 0.02(L93) - const
_FINAL_WAYPOINT_TOL_RAD = 0.05— worst per-joint error at which the trajectory replay counts the final waypoint as reached (justification in the source comment). (L112) - const
_REPLAY_SETTLE_TIMEOUT_S = 10.0— bound past the plan's lasttime_from_startfor the measured joints to reach the final waypoint beforeROSDeadlineMissed. (L117) - const
_WAIT_FOR_SERVER_TIMEOUT_S = 15.0(L125) - const
_GOAL_STATUS_LABELS: dict[int, str] = {...}— Human-readable labels foraction_msgs/GoalStatuscodes, used in error/log messages. (L132) build_joint_permutation_from_names(*, source_names, target_names) -> list[int]— Build the permutation that reorders a wrapped server'sJointTrajectory.positionsinto the hostRobotDescription.jointsorder. RaisesROSConfigErroron set-inequality so a joint mismatch surfaces loudly instead of silently swapping bytes. (L203)- const
CUMOTION_PIPELINE_ID = "isaac_ros_cumotion"— the cuMotion MoveIt planning-pipeline id. (L172) maybe_inject_cumotion_pipeline(goal_dict, *, interface_type, capabilities) -> dict— On a host clearing the cuMotion GPU floor, setsrequest.pipeline_id = CUMOTION_PIPELINE_IDon aMoveGroupgoal so MoveIt plans with cuMotion; no-op for non-MoveGroup actions, low-VRAM hosts, an already-setpipeline_id, or a goal with norequestblock. Pure — never mutates the input. (L175)class ROSActionRskill(rSkillBase)—rSkillBaseshim wrapping a ROS 2 ActionClient (or service client), in two modes selected bymanifest.ros_integration.result_trajectory_field: trajectory mode replays one waypoint perstep(), paced by the plan'stime_from_starton the host node's clock, and raisesROSRskillGoalSatisfiedonly once the measured joints reach the last waypoint (ROSDeadlineMissedif they do not settle in time); result-only mode awaits the wrapped result and raisesROSRskillGoalSatisfied. ROS imports are deferred to_configure_implso the module imports cleanly without ROS sourced. (L330)__init__(*, manifest, ros_node, robot_description, prompt, prompt_metadata_json)(L363)_configure_impl()— Lazy-import IDL, build ActionClient/service client, parsedefault_goal_json. (L442)_activate_impl()— no-op; the wrapped action dispatches on firststep(). (L532)_deactivate_impl()/_shutdown_impl()— Release the wrapped client. (L535)_step_impl(world_state) -> Action— First call sends goal and caches result; subsequent calls emit the waypoint due bytime_from_start(timed onnode_execution_budget(self._node, planned + _REPLAY_SETTLE_TIMEOUT_S)), holding the last untilworld_state.joint_stateis within_FINAL_WAYPOINT_TOL_RAD. (L552)_final_waypoint_error(world_state) -> float | None— worst|measured - final|over the planned joints, by name;None(never "reached") when unmeasurable. (L625)_poll_future(future, *, deadline_s, what, graph_clock=True)— Polls a wrapped future undernode_execution_budget(self._node, …): on the graph clock whengraph_clockand the host node runs on sim time, else ontime.monotonic(). Raises the typedROSDeadlineMissed(FAILURE_DEADLINE_MISSED) namingdeadline_exceeded/clock_stalled; a non-positivedeadline_slapses at once (fail closed). Only the result-only result wait (Nav2: the server moves the robot) uses the graph clock — goal acceptance, service responses and a MoveIt plan result are compute/IPC and passgraph_clock=False; a lapsed result wait cancels the wrapped goal before re-raising. (L903)
python/rskill/src/openral_rskill/look_at_rskill.py
Camera-aiming MoveGroup skill. Selected by make_default_skill_resolver when manifest.ros_integration.goal_builder == "look_at" (new RosIntegration.goal_builder field; RSkillAction gains LOOK = "look").
- const
_DEFAULT_CAMERA = "wrist"(L46) - const
_DEFAULT_POSITION_TOLERANCE_M = 0.02(L47) - const
_DEFAULT_ORIENTATION_TOLERANCE_RAD = 0.15(L48) - const
_TF_LOOKUP_TIMEOUT_S = 5.0(L49) - const
_XYZ_LEN = 3(L50) - const
_MIN_DIRECTION_NORM = 1e-9(L51) resolve_camera_sensor(description, camera) -> SensorSpec— Find the named camera inRobotDescription.sensors;ROSConfigErrorlisting the available sensor names on a miss (explicit beats implicit — default camera is"wrist"). (L54)build_look_at_constraints(*, camera_goal: Pose6D, link_name, link_t_cam=None, position_tolerance_m=0.02, orientation_tolerance_rad=0.15) -> dict— Lower a camera gaze pose into one MoveGroupgoal_constraintsentry by delegating topose_goal_rskill.build_pose_constraintswith the optical (z) axis tolerance set to π (roll free). Withlink_t_camthe goal is re-expressed for the mount link; without it the camera frame is the constrained link. (L100)class LookAtRskill(ROSActionRskill)— Consumes the merged goal'slook_atblock (target_xyzrequired, plusframe_id/camera/standoff_m/tolerances) instead of raw constraints, lowering it lazily on the firststep()viacompute_gaze_pose→build_pose_constraints. The manifest shipsplan_only: trueso MoveIt-side execution never bypasses the safety kernel. (L132)
python/rskill/src/openral_rskill/pose_goal_rskill.py
Generic Cartesian end-effector pose MoveGroup skill. Selected by make_default_skill_resolver when ros_integration.goal_builder == "pose". Home of the shared pose→constraints lowering LookAtRskill reuses.
- const
_SOLID_PRIMITIVE_SPHERE = 2—shape_msgs/SolidPrimitive.SPHERE. (L40) - const
_DEFAULT_POSITION_TOLERANCE_M = 0.01(L41) - const
_DEFAULT_ORIENTATION_TOLERANCE_RAD = 0.05(L42) - const
_XYZ_LEN = 3(L43) - const
_QUAT_LEN = 4(L44) - const
_QUATERNION_ORDERS = ("xyzw", "wxyz")(L45) - const
_TF_LOOKUP_TIMEOUT_S = 5.0(L46) build_pose_constraints(*, pose: Pose6D, link_name, link_t_target=None, position_tolerance_m=0.01, orientation_axis_tolerances_rad=(0.05, 0.05, 0.05)) -> dict— Lower a target pose into one MoveGroupgoal_constraintsentry (sphere position region + per-axis orientation constraint);link_t_targetre-expresses the goal for the constrained link. The one place pose→MoveGroup-constraint math lives — do not re-implement. (L49)pose_from_block(block) -> tuple[Pose6D, str, float, float]— Parse aposegoal block →(pose, link_name, pos_tol, orient_tol). Orientation is a 4-float quaternion array; component order fromblock["quaternion_order"]("xyzw"default /"wxyz").ROSConfigErroron missing/ill-typed fields or an unknown order. (L141)class PoseGoalRskill(ROSActionRskill)— Consumes the merged goal'sposeblock; lowers it viabuild_pose_constraints(full orientation) on the firststep(), then dispatches/replays like the parent.link_t_targetis identity in v1 (the RobotDescription tool-frame offset is a later phase). (L198)
python/rskill/src/openral_rskill/joint_goal_rskill.py
Joint-space MoveGroup skill. Selected when ros_integration.goal_builder == "joint". The LLM-facing replacement for hand-written joint_constraints JSON.
- const
_DEFAULT_JOINT_TOLERANCE_RAD = 0.001(L23) - const
_JOINT_WEIGHT = 1.0(L24) joint_constraints_from_block(block) -> dict— Lower ajointblock (joint_names,positions, optionalposition_tolerance_rad) into onegoal_constraintsentry ({"joint_constraints": [{joint_name, position, tolerance_above, tolerance_below, weight}, …]}).ROSConfigErroron missing/ill-typed fields or a name/position length mismatch. (L27)class JointGoalRskill(ROSActionRskill)— Consumes the merged goal'sjointblock; lowers it into ajoint_constraintsgoal at_configure_impl, then dispatches/replays like the parent. (L69)_configure_impl() -> None(L77)
python/rskill/src/openral_rskill/_vla_core.py
Shared helpers for VLA adapters (Layer 3); internal — no public re-export.
InferenceKind— Re-export ofopenral_observability.InferenceKind(Literal["foreground", "prefetch", "single"]), the closed value set for theinference.kindlabel — a timing axis, deliberately without a"chunk"value since chunk shape ridesinference.chunk_size/chunk_indexinstead. (L45)resolve_device(spec: VLASpec) -> str—"auto"→"cuda:0"/"mps"/"cpu"against real torch. (L48)resolve_rskill_repo_id(weights_uri: str, *, adapter_name: str) -> str— Validate skill reference and resolve to bare HF repo id;adapter_nameis used in theROSConfigErrormessage. (L73)resolve_rskill_repo_revision(weights_uri: str, *, adapter_name: str) -> tuple[str, str | None]— Likeresolve_rskill_repo_idbut also returns the optional@<sha>revision pin, threaded intofrom_pretrained/snapshot_downloadby the sim adapters, and warnsrskill.unpinned_weightswhen anhf://skill is unpinned. (L104)resolve_image_preprocessing(manifest, spec_extra) -> ImagePreprocessing— Build theImagePreprocessingblock an adapter applies, by strict precedence:spec_extraYAML override →manifest.image_preprocessingper-checkpoint contract → schema defaults. No auto-derivation frompolicy.config.input_features— missing hints surface as the schema default rather than a guessed heuristic. RaisesROSConfigErrorwhen a manifest alias key is not a slot declared bysensors_required[].vla_feature_key. (L147)resolve_state_dim(manifest, spec_extra) -> int | None— Per-checkpoint proprio state dimension:spec_extra["state_dim"]override →manifest.state_contract.dim→None(adapter falls back to the policy's own preprocessor width). (L252)resolve_camera_keys(manifest, spec_extra, *, scene_cameras=None, default=("camera1", "camera2")) -> tuple[str, ...]— Resolve which scene camera keys an adapter pulls from the observation:spec_extra["camera_keys"]override →scene_cameras(the SimEnvironment YAML'sscene.cameras) →default. (L273)manifest_camera_slots(manifest) -> tuple[str, ...]— The RGB VLA slots an rSkill declares, insensors_requiredorder (vla_feature_keysuffix). Theresolve_camera_keysdefault for adapters whose cameras are the manifest's slots (openvla, rldx, lingbot, diffusion). (L305)checkpoint_image_keys(image_preprocessing, camera_keys) -> tuple[str, ...]— The one slot→checkpoint rename:input_template.format(cam=aliases.get(slot, slot))per slot. Used by the xvla / gr00t / diffusion / lingbot / molmoact2 adapters so manifestaliasesis the only rename mechanism. (L326)resolve_n_action_steps(manifest, extra, *, default, chunk_size=None) -> int— The one chunk-slicing rule every policy adapter calls (xr1, xvla, gr00t, lingbot_vla/vla2, rldx, molmoact2, openvla, and viaapply_chunk_replaysmolvla/pi05/act):extra["n_action_steps"](--n-action-steps) >manifest.n_action_steps> deprecatedextra["replan_steps"](warnsvla.deprecated_replan_steps) >default; bounded bychunk_size(elsemanifest.chunk_size, logsvla.n_action_steps_clamped);ValueErrorbelow 1. (L354)apply_chunk_replay(policy, spec_extra, *, manifest=None, default_n_action_steps=None) -> int— Setpolicy.config.n_action_stepsviaresolve_n_action_steps, defaulting to and bounded by the policy's ownconfig.chunk_size; used by the lerobot-style adapters (smolvla,act,pi05,xvla). (L405)_CUDAGRAPH_COMPILE_MODES—frozenset({"reduce-overhead", "max-autotune"}); thetorch.compilemodes that may capture CUDA graphs and therefore require output cloning (static replay buffers would otherwise be overwritten under lerobot's queued action views /ChunkedExecutorpre-fetch). (L460)_has_bnb_quantized_modules(policy) -> bool— True when any submodule's class comes frombitsandbytes(Linear4bit/Linear8bitLtrewrites fromopenral_sim._quantization). Class-module-path check; never imports bnb. (L472)_clone_chunk_output(out, torch) -> Any— Recursively.clone()every tensor in a chunk forward's output (tensor / tuple / list / dict; non-tensor leaves pass through) so downstream holders own their storage, detached from CUDA-graph static buffers. (L486)maybe_compile_chunk_forward(policy, spec_extra, device, torch, *, method_name="_get_action_chunk") -> bool— Best-efforttorch.compileof the chunk forward with a runtime fallback that latches into eager mode on backend errors; skipped on CPU or whenvla.extra.compileis falsy. Never compiles bitsandbytes-quantized policies (dtype-mismatch under mixed nf4/bf16), and routes cudagraph-mode output through_clone_chunk_outputon both branches. (L504)run_inference(policy, batch, *, chunk_index=None, kind="single", chunk_size=None, engine=None, call=None, call_kwargs=None, synchronize=False) -> Tensor— Single seam wrapping a policy inference call ininference_span+torch.no_grad()— the only placeinference.kind/chunk_index/chunk_size/inference.engineattributes are emitted.callreplaces the defaultpolicy.select_action(batch)for custom chunk producers;ChunkedExecutorpassessynchronize=Trueon its prefetch so the span times compute, not just kernel launch. Must staytorch.no_grad(), nevertorch.inference_mode()— RTC's guidance callsautograd.grad, which raises under inference mode. (L607)resolve_inference_engine(owner, declared=None) -> str— Resolve the backend actually executing after optional runtime attachment: explicit_openral_inference_enginemarker wins, then theopenral-pro-trtmodule, then the manifest name (normalizedpytorch→torch/tensorrt→trt). Keeps the dashboard from reporting a stale pre-attachment runtime. (L696)_RTC_ADAPTERS—frozenset({"smolvla", "pi05"}); the flow-matching adapters whose lerobot policies carry anrtc_config. molmoact2 / pi0_fast support RTC upstream but are out of scope — extend this set and the adapter's chunk_fn kwargs pass-through together. (L736)- const
_RTC_KEYS—frozenset({"enabled", "execution_horizon", "max_guidance_weight", "prefix_attention_schedule", "debug"}); the closed key set_parse_rtc_configaccepts in apolicy_extras.rtcblock. (L743) _parse_rtc_config(spec_extra, *, adapter_name, default_horizon=10) -> RTCConfig | None— Parse the manifest'spolicy_extras.rtcblock into a lerobotRTCConfig, orNoneif absent.ROSConfigErroron a non-mapping block, an unknown key or schedule, a non-positive horizon,RTCConfigrejection, or an adapter outside_RTC_ADAPTERS; lerobot imports are deferred. (L748)rtc_enabled_in_extra(spec_extra, *, adapter_name) -> bool— True only for a present, well-formed, enabledrtcblock — keyed on the parsedenabledflag, not just presence, sortc: {enabled: false}still compiles. Lets a factory (e.g. smolvla skippingmaybe_compile_chunk_forward) decide before the executor exists. (L818)- const
_CHUNK_BOUNDARY_BLEND_KEYS—frozenset({"steps", "dims"}); the closed key set of apolicy_extras.chunk_boundary_blendblock. _parse_chunk_boundary_blend(spec_extra, *, adapter_name) -> tuple[int, tuple[int, ...] | None]— Parse the YAML shape ofpolicy_extras.chunk_boundary_blend: {steps: K, dims: [...]}into(steps, dims);(0, None)without a block.ROSConfigErroron a non-mapping block, unknown keys,stepsnot an int>= 1, ordimsmissing or not a list (no all-dims default in a manifest: a binarized gripper or delta-action dim must not be faded). The rules themselves areexecutor._check_boundary_blend's, applied bybuild_chunk_executorunder this block's key.build_chunk_executor(spec_extra, *, policy=None, chunk_fn=None, chunk_size=None, adapter_name="policy", postprocess_action=None, rtc_prefix_fn=None) -> ChunkedExecutor | None— Shared executor construction:chunk_prefetchenables overlap,chunk_prefetch_atcalibrates the lead (default 20, clamped to the chunk). An enabledpolicy_extras.rtcblock setspolicy.config.rtc_configand callsinit_rtc_processor()before building the executor; a block withoutexecution_horizongets the clampedchunk_prefetch_at(guidance over the whole overlap); RTC is refused withROSConfigError(never a silent downgrade) on chunk size 1,chunk_prefetch: false, a policy withoutinit_rtc_processor, bitsandbytes-quantized weights, or ause_relative_actionspolicy withoutrtc_prefix_fn(checked before the policy is mutated). With nortcblock, construction and served actions are byte-identical to before. Apolicy_extras.chunk_boundary_blendblock is checked withexecutor._check_boundary_blend(before any RTC policy mutation) and handed to the executor asboundary_blend_steps/blend_dims; it is refused withROSConfigErroron chunk size 1, astepsnot below the chunk size (or, withchunk_prefetch, belown - chunk_prefetch_at - 1), or alongside an enabledrtcblock. (L897)relative_rtc_prefix_fn(preprocessor, *, device) -> Callable[[Tensor], Tensor] | None— Thertc_prefix_fnfor a relative-action checkpoint (an enabledRelativeActionsProcessorStepin its preprocessor), elseNone. Mirrors lerobot 0.6.0's RTC rollout: absolute leftover rows →lerobot.policies.rtc.reanchor_relative_rtc_prefixagainst the relative step's cached state (the latest preprocessor call) → the preprocessor's normalizer, ondevice. The hook raisesROSRuntimeErrorwhen no state is cached, where lerobot would silently keep the stale rows; building it raisesROSConfigErrorwhen no normalizer carries action stats (the prefix would reach the model in raw units). pi05 and SmolVLA pass it tobuild_chunk_executor. (L1080)to_numpy_action(action_tensor) -> NDArray[np.float32]—(1, A)torch tensor → 1-D float32 NumPy. (L1151)release_torch_modules(owner, *attrs, device="", torch=None) -> None— Drop an adapter's references to its loaded torch modules, thengc.collect()and (on CUDA)torch.cuda.empty_cache()— order matters:empty_cache()only returns already-free blocks, so it must run after the reference is dropped, andgc.collect()is needed since a policy is typically part of a reference cycle. Best-effort; called fromclose()in every sim VLA adapter. (L1569)parse_hf_file_uri(uri: str) -> tuple[str, str | None, str]— Splitshf://owner/repo[@rev]/path/to/file.extinto(repo_id, revision, filename)for per-filehf_hub_downloadcalls. Rejects bare-repo URIs with a typedROSConfigError. (L1279)materialize_processor_dir(manifest: RSkillManifest) -> str— Downloads the manifest's per-fileprocessorsartefacts viahf_hub_downloadand symlinks them under lerobot-canonical filenames in a fresh temp directory, also fetching each processor JSON's siblingstate_filesoPolicyProcessorPipeline.from_pretrainedresolves every step locally. Used by the SmolVLA and modern-ACT adapters; raisesROSConfigErrorifmanifest.processors is None. (L1329)hf_download_cached_first(hf_hub_download, local_not_found_exc, *, repo_id, filename, revision=None, **extra) -> str— Cache-first wrapper aroundhuggingface_hub.hf_hub_download: trieslocal_files_only=Truefirst, falling back to a normal call onLocalEntryNotFoundError. Avoids the per-file HEAD validation that turns a cached load into seconds of latency on a cold connection;HF_HUB_OFFLINE=1extends the skip to inner lerobot/transformers calls this helper doesn't wrap. Public, re-exported fromopenral_rskill.__init__. (L1167)local_snapshot_dir(repo_id, *, revision=None, ignore_patterns=("*.md",), **extra) -> str(L1230) — The resolved checkpoint as a local directory: a directory (an installed rSkill snapshot, whichresolve_rskill_to_hf_with_revisionreturns for a snapshot holdingmodel.safetensorsor a sharded index) is returned as is, a Hub repo id issnapshot_downloaded withignore_patterns/extraforwarded.snapshot_downloadrejects a filesystem path as a repo id, so ACT, Diffusion, GR00T and the processor-sidecar fallback all broke on an installed skill until they routed through this (2026-09-23). Public, re-exported fromopenral_rskill.__init__.suppress_hf_weight_init() -> Iterator[None][@contextmanager] — Context manager that patchestransformers.PreTrainedModel._init_weightsto a no-op, skipping SmolVLA's full random backbone init when the checkpoint setsload_vlm_weights=False. Only sound when the checkpoint covers every parameter — pair withassert_all_parameters_finite. Process-global while active; the skill runner serialises loads behind its resident-skill lock. (L1624)assert_all_parameters_finite(policy, *, repo_id) -> None— RaisesROSConfigErrorif any floating-point parameter is NaN/Inf — the guard that makessuppress_hf_weight_initsafe, since uninitialised memory read as float is overwhelmingly non-finite. (L1698)call_make_processors_cached_first(make_pre_post_processors, policy_config, *, pretrained_path, **kwargs) -> tuple[Any, Any]— Wraps lerobot'smake_pre_post_processorsso the tokenizer'sAutoTokenizer.from_pretrainedcall skips its HF HEAD revalidation when that tokenizer is already cached, by flippingHF_HUB_OFFLINEfor the inner call. Passthrough on a cold cache or for adapters with no tokenizer step (ACT, Diffusion Policy). (L1479)- private:
_read_tokenizer_repo_from_preprocessor(pretrained_path) -> str | None— Parses<pretrained_path>/policy_preprocessor.jsonfor thetokenizer_processorstep'sconfig.tokenizer_name. ReturnsNoneon missing/malformed JSON or absent step (ACT / Diffusion Policy). Used bycall_make_processors_cached_first. - private:
_hf_tokenizer_is_cached(repo_id) -> bool— Probeshuggingface_hub.try_to_load_from_cache(repo_id, "tokenizer_config.json")and returnsTrueonly when the result is a real cached path (str), notNoneor the_CACHED_NO_EXISTsentinel. ReturnsFalseon any import error so callers fall back to a normal online load.
python/rskill/src/openral_rskill/_policy_io.py
The one policy <-> robot I/O codec (joint order, deg<->rad, gripper scale, clamp), applied on every deploy dispatch path; internal — no public re-export.
class PolicyIOCodec(BaseModel)— Frozen codec built once per skill from the manifest'saction_contract(joint_units,joint_names,gripper_scale, legacypolicy_extras.gripper_scalewith a deprecation warning) + theRobotDescription. State: permute robot→policy order, thengripper * gripper_scale/degrees(joint). Action:gripper / gripper_scale/radians(joint)back in robot order; on the slot path the same per-channel conversion in policy order per slot (JOINT_POSITION/JOINT_VELOCITY + GRIPPER_POSITION), no permutation, and JOINT_POSITION slot channels clamped by the same_CLAMP_EPSasclamp— keyed by the slot'sjoint_names, orRobotDescription.jointsorder when it declares none (this replaced the runner's own_clamp_joint_position_slice, which skipped unnamed slots); a GRIPPER_POSITION slot's channel clamped strictly inside itsee's kernel bound (gripper_ranges, fromEndEffectorSpec.resolved_command_range), a move wider than the epsilon logged once per end effector (policy_io.gripper_command_clamped). (L101)from_manifest(manifest, description, *, adapter=None) -> PolicyIOCodec— Joint order:action_contract.joint_names(robot names in policy order; unknown name →ROSConfigError) > the adapter'spolicy.config.action_feature_names(.pos/_joint_normalised; mismatch → identity +policy_io.feature_names_unmatched) > identity.ROSConfigErrorfor a joint-position contract withoutjoint_unitsor a legacy extras scale contradicting the contract. (L144)is_identity -> bool[@property] — True when the codec changes nothing (radians,gripper_scale == 1, robot joint order);openral_sim.sim_runnerrefuses a non-identity codec on a scene withoutconverts_policy_units. (L284)to_policy_state(robot_state) -> NDArray— Robot-order radians → policy order + units. (L303)to_robot_action(policy_action, *, slots=None) -> NDArray— Policy action → robot units (+ robot order without slots; + JOINT_POSITION limit clamp with slots). (L316)clamp(robot_action) -> NDArray— Pull each joint strictly (1e-3) insideRobotDescriptionposition limits; no-op on a width mismatch. (L404)- private:
_effective_perm(robot_to_policy, n) -> list[int]— Identity unless a valid length-npermutation, so unit conversion runs on the no-reorder path too. (L60)
python/rskill/src/openral_rskill/testing.py
Test helpers for skill latency-budget enforcement (CLAUDE.md §2).
class LatencyBudgetExceededError(AssertionError)— Raised byassert_within_budgeton overrun; a plainAssertionErrorsubclass (notROSRuntimeError) so pytest reports a crisp failure with the budget delta rather than the operational exception the safety supervisor would catch. (L42)__init__(*, stage, measured_ms, budget_ms, rskill_id=None)— Builds the failure message and storesstage/measured_ms/budget_ms/rskill_idon the instance. (L56)assert_within_budget(*, measured_ms, budget: RSkillLatencyBudget, stage="per_chunk", rskill_id=None, tolerance_pct=0.0) -> None— Assertmeasured_msdoes not exceedbudget's field forstage(per_chunk_ms/warmup_ms/load_ms), with an optional percent tolerance. Unset optional budget stages (warmup_ms/load_msareNone) pass silently — enforcement is opt-in per manifest. RaisesLatencyBudgetExceededErroron overrun,ValueErroron a negative input. (L78)
python/rskill/src/openral_rskill/_lerobot_compat.py
Compatibility shim for lerobot.policies import side-effects.
- const
_STUB_NAME = "lerobot.policies.groot.modeling_groot"(L32) - private:
_install_stub() -> None(L35) sanitize_smolvla_config(repo_id, *, revision=None) -> None— Strip config keys lerobot'sSmolVLAConfigrejects (e.g.pretrained_revision) from a checkpoint'sconfig.json, in place, beforeSmolVLAPolicy.from_pretrained. Idempotent; no-op when the config is already clean or lerobot/the config are unavailable. (L54)