Add core Arena environment factory - #860
Conversation
Greptile SummaryThis PR extracts the core factory infrastructure from
Confidence Score: 4/5Safe to merge for the current environment set; the structural migration is clean, but the test will silently break for the first new environment that implements only build() without legacy adapters. All 17 environment parent-class swaps are mechanical and correct, and ArenaEnvironmentFactoryBase itself is a straightforward extraction with no logic changes. The one concrete defect is in test_environment_cfgs.py: the loop over all registered environments unconditionally calls add_cli_args and get_env, which are no longer part of the base contract. isaaclab_arena/tests/test_environment_cfgs.py needs a guard so it only exercises environments that expose the legacy adapter methods. Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
class ArenaEnvironmentFactoryBase {
<<abstract, Generic[CfgT]>>
+name: str | None
+asset_registry: AssetRegistry
+device_registry: DeviceRegistry
+hdr_registry: HDRImageRegistry
+__init__()
+build(cfg: CfgT) IsaacLabArenaEnvironment*
}
class ExampleEnvironmentBase {
<<deprecated shim, Generic[CfgT]>>
+get_env(args_cli: Namespace) IsaacLabArenaEnvironment*
+add_cli_args(parser: ArgumentParser) None*
+build(cfg: CfgT) raises NotImplementedError
}
class PickAndPlaceMapleTableEnvironment {
+name = "pick_and_place_maple_table"
+get_env(args_cli) IsaacLabArenaEnvironment
+build(cfg) IsaacLabArenaEnvironment
+add_cli_args(parser) None
}
class OtherMigratedEnvironments {
+get_env(args_cli) IsaacLabArenaEnvironment
+build(cfg) IsaacLabArenaEnvironment
+add_cli_args(parser) None
}
class FutureDirectFactories {
+build(cfg) IsaacLabArenaEnvironment
}
ArenaEnvironmentFactoryBase <|-- ExampleEnvironmentBase : deprecated shim
ArenaEnvironmentFactoryBase <|-- PickAndPlaceMapleTableEnvironment
ArenaEnvironmentFactoryBase <|-- OtherMigratedEnvironments
ArenaEnvironmentFactoryBase <|-- FutureDirectFactories : intended new pattern
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
classDiagram
class ArenaEnvironmentFactoryBase {
<<abstract, Generic[CfgT]>>
+name: str | None
+asset_registry: AssetRegistry
+device_registry: DeviceRegistry
+hdr_registry: HDRImageRegistry
+__init__()
+build(cfg: CfgT) IsaacLabArenaEnvironment*
}
class ExampleEnvironmentBase {
<<deprecated shim, Generic[CfgT]>>
+get_env(args_cli: Namespace) IsaacLabArenaEnvironment*
+add_cli_args(parser: ArgumentParser) None*
+build(cfg: CfgT) raises NotImplementedError
}
class PickAndPlaceMapleTableEnvironment {
+name = "pick_and_place_maple_table"
+get_env(args_cli) IsaacLabArenaEnvironment
+build(cfg) IsaacLabArenaEnvironment
+add_cli_args(parser) None
}
class OtherMigratedEnvironments {
+get_env(args_cli) IsaacLabArenaEnvironment
+build(cfg) IsaacLabArenaEnvironment
+add_cli_args(parser) None
}
class FutureDirectFactories {
+build(cfg) IsaacLabArenaEnvironment
}
ArenaEnvironmentFactoryBase <|-- ExampleEnvironmentBase : deprecated shim
ArenaEnvironmentFactoryBase <|-- PickAndPlaceMapleTableEnvironment
ArenaEnvironmentFactoryBase <|-- OtherMigratedEnvironments
ArenaEnvironmentFactoryBase <|-- FutureDirectFactories : intended new pattern
|
🤖 Isaac Lab-Arena Review BotSummaryThis PR promotes the core factory behavior ( Design, Boundaries & ScopeOne thing worth a look: the first-party environments still expose Findings🔵 Improvement: Test CoverageThe refactor is exercised by the existing VerdictShip it — clean refactor; the two notes above are optional polish, not blockers. |
b9deb8e to
6893c92
Compare
Separate the typed build contract and registry initialization from the legacy argparse compatibility surface. Migrate first-party factories while preserving their existing CLI adapters. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Keep the marker configuration beside the factory base because it exists solely as the typed input to that contract. This gives environment implementations one stable core import. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Use ArenaEnvironmentFactory because the abstract factory role is already explicit and the Base suffix adds no useful distinction. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Signed-off-by: Clemens Volk <cvolk@nvidia.com>
6893c92 to
f0470ad
Compare
alexmillane
left a comment
There was a problem hiding this comment.
LGTM. One tiny comment.
Summary
Move the shared environment construction class
ExampleEnvironmentBaseinto core (asArenaEnvironmentFactory) because it applies to every Arena environment, not just examples.ArenaEnvironmentFactorynow handles registry setup and provides the typed build(cfg) entry point.