Datasets:
Download code/robohome/src/engine/source/packages/runtime/isaac/contracts.py from RoboParty/RoboHome: direct link, hf CLI and curl.
- Browser
- Download file 3.7 kB
-
https://huggingface.co/datasets/RoboParty/RoboHome/resolve/86ffa4ecc1047bb404fdc283987bd22cbc259a96/code/robohome/src/engine/source/packages/runtime/isaac/contracts.py
- Command line
-
hf download hf://datasets/RoboParty/RoboHome@86ffa4ecc1047bb404fdc283987bd22cbc259a96/code/robohome/src/engine/source/packages/runtime/isaac/contracts.py
-
curl -L -o contracts.py https://huggingface.co/datasets/RoboParty/RoboHome/resolve/86ffa4ecc1047bb404fdc283987bd22cbc259a96/code/robohome/src/engine/source/packages/runtime/isaac/contracts.py
3.7 kB
| from __future__ import annotations | |
| from datetime import UTC, datetime | |
| from typing import Any, Literal | |
| from pydantic import BaseModel, ConfigDict, Field, model_validator | |
| from packages.core.contracts.scene import RobotStart, SceneBundle | |
| class _StrictModel(BaseModel): | |
| model_config = ConfigDict(extra="forbid", validate_assignment=True) | |
| class RobotInjectionSpec(_StrictModel): | |
| schema_version: Literal["1.0"] = "1.0" | |
| scene_bundle_id: str | |
| scene_bundle_sha256: str = Field(pattern=r"^[0-9a-f]{64}$") | |
| robot_id: str | |
| robot_asset_uri: str | |
| robot_asset_sha256: str = Field(pattern=r"^[0-9a-f]{64}$") | |
| robot_profile_version: str | |
| spawn: RobotStart | |
| injection_layer_uri: str | |
| def for_bundle( | |
| cls, | |
| bundle: SceneBundle, | |
| **values: Any, | |
| ) -> RobotInjectionSpec: | |
| if bundle.content_hash is None: | |
| raise ValueError("SceneBundle must be sealed before robot injection") | |
| return cls( | |
| scene_bundle_id=bundle.bundle_id, | |
| scene_bundle_sha256=bundle.content_hash, | |
| spawn=bundle.robot_start, | |
| **values, | |
| ) | |
| class IsaacValidationPlan(_StrictModel): | |
| schema_version: Literal["1.0"] = "1.0" | |
| validators: list[ | |
| Literal[ | |
| "asset", | |
| "layout", | |
| "navigation", | |
| "reachability", | |
| "physics", | |
| "task", | |
| "safety", | |
| ] | |
| ] = Field(min_length=7) | |
| require_oracle_replay: Literal[True] = True | |
| require_no_op_control: Literal[True] = True | |
| require_random_control: Literal[True] = True | |
| require_goal_false_initially: Literal[True] = True | |
| warm_process_required: bool = True | |
| gpu_lease_required: bool = True | |
| def require_full_gate(self) -> IsaacValidationPlan: | |
| required = { | |
| "asset", | |
| "layout", | |
| "navigation", | |
| "reachability", | |
| "physics", | |
| "task", | |
| "safety", | |
| } | |
| if set(self.validators) != required: | |
| raise ValueError("Isaac validation plan must include every production hard gate") | |
| return self | |
| class IsaacRunManifest(_StrictModel): | |
| schema_version: Literal["1.0"] = "1.0" | |
| run_id: str | |
| scene_bundle_sha256: str = Field(pattern=r"^[0-9a-f]{64}$") | |
| robot_injection_sha256: str = Field(pattern=r"^[0-9a-f]{64}$") | |
| isaac_sim_version: str | |
| isaac_lab_arena_version: str | |
| seed: int | |
| started_at: datetime = Field(default_factory=lambda: datetime.now(UTC)) | |
| completed_at: datetime | None = None | |
| validator_reports: dict[str, str] = Field(default_factory=dict) | |
| oracle_replay_uri: str | None = None | |
| negative_control_report_uri: str | None = None | |
| passed: bool = False | |
| failure_reasons: list[str] = Field(default_factory=list) | |
| def validate_release(self) -> IsaacRunManifest: | |
| if self.passed: | |
| required = { | |
| "asset", | |
| "layout", | |
| "navigation", | |
| "reachability", | |
| "physics", | |
| "task", | |
| "safety", | |
| } | |
| if set(self.validator_reports) != required: | |
| raise ValueError("passed Isaac run requires every validator report") | |
| if not self.oracle_replay_uri or not self.negative_control_report_uri: | |
| raise ValueError("passed Isaac run requires replay and negative-control evidence") | |
| if self.completed_at is None or self.failure_reasons: | |
| raise ValueError("passed Isaac run must be complete and failure-free") | |
| return self | |