Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions embodichain/lab/gym/envs/expert_program/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@
create_simulation_expert_program_adapter,
)
from .simulation_handover import ConfiguredHandOverPoseProvider
from .simulation_parallel_safety import (
CuroboParallelCommandSafetyValidator,
CuroboParallelSafetyValidatorFactory,
)
Comment on lines +158 to +161

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Document the public safety APIs

These exports add public validator and factory APIs without documenting their required aggregate control-part configuration, interpolation limits, runtime dependencies, or integration procedure, leaving users without the repository's required public API guidance.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/gym/envs/expert_program/__init__.py
Line: 158-161

Comment:
**Document the public safety APIs**

These exports add public validator and factory APIs without documenting their required aggregate control-part configuration, interpolation limits, runtime dependencies, or integration procedure, leaving users without the repository's required public API guidance.

**Context Used:** AGENTS.md ([source](https://github.com/dexforce/embodichain/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code

from .simulation_policies import (
SimulationSegmentPolicyPort,
default_simulation_settle_presets,
Expand Down Expand Up @@ -189,6 +193,8 @@
"ControlPartResourceBinding",
"ConfiguredHandOverPoseProvider",
"CyclicPoseTargetCfg",
"CuroboParallelCommandSafetyValidator",
"CuroboParallelSafetyValidatorFactory",
"DeclarativeCfgValue",
"DemoBridgeError",
"EXPERT_PROGRAM_SCHEMA_VERSION",
Expand Down
15 changes: 14 additions & 1 deletion embodichain/lab/gym/envs/expert_program/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,14 +1457,27 @@ def create_parallel_safety_validator(
*,
simulation: object,
robot: object,
scene_registry: SceneRegistry,
engine: AtomicActionEngine,
) -> ParallelCommandSafetyValidator | None:
"""Create and strictly validate the registration-owned live safety gate."""
self.assert_unchanged()
factory = self.parallel_safety_factory
if factory is None:
return None
if type(scene_registry) is not SceneRegistry:
raise TypeError("scene_registry must be exactly SceneRegistry.")
if not isinstance(engine, AtomicActionEngine):
raise TypeError("engine must be an AtomicActionEngine.")
if engine.robot is not robot:
raise ValueError("engine and factory must reference the exact same robot.")
with self._parallel_safety_validator_lock:
validator = factory.create(simulation=simulation, robot=robot)
validator = factory.create(
simulation=simulation,
robot=robot,
scene_registry=scene_registry,
engine=engine,
)
if not isinstance(validator, ParallelCommandSafetyValidator):
raise TypeError(
"parallel_safety_factory.create() must return a "
Expand Down
10 changes: 8 additions & 2 deletions embodichain/lab/gym/envs/expert_program/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from dataclasses import dataclass, fields, is_dataclass
from enum import Enum
from types import MappingProxyType
from typing import ClassVar, Protocol, runtime_checkable
from typing import ClassVar, Protocol, runtime_checkable, TYPE_CHECKING

import torch

Expand Down Expand Up @@ -57,6 +57,10 @@
RuntimeTransportActionEncoder,
)

if TYPE_CHECKING:
from embodichain.lab.sim.atomic_actions import AtomicActionEngine
from embodichain.lab.sim.skills import SceneRegistry

VersionedKey = tuple[str, str]
"""Exact ``(provider_or_projector_id, revision)`` registry key."""

Expand Down Expand Up @@ -450,8 +454,10 @@ def create(
*,
simulation: object,
robot: object,
scene_registry: SceneRegistry,
engine: AtomicActionEngine,
) -> ParallelCommandSafetyValidator:
"""Create one live validator bound to the exact simulation and robot."""
"""Create one live gate bound to the exact assembled runtime."""


@dataclass(frozen=True, slots=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ def create_parallel_command_safety_validator(
validator = self._registration.create_parallel_safety_validator(
simulation=self._simulation,
robot=self._robot,
scene_registry=scene_registry,
engine=engine,
)
if not isinstance(validator, ParallelCommandSafetyValidator):
raise TypeError(
Expand Down
Loading