Environments¶
The environment classes own the Genesis scene, its entities and the managers, and run the step loop. This page is the class reference; the environments guide explains construction, the step-phase order and auto-reset.
Environment classes construct only: from_config(cfg) returns an unbuilt env, and you call build() and
reset() yourself. Use env_class_for_config(cfg).from_config(cfg) when the class is not known statically. The
training wrappers (below) build and reset inside their own from_config.
Base classes¶
EnvBase
¶
EnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, observation_options: ObservationManagerOptions | None = None, event_options: EventManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: DrawDebugMixin, RBC, Generic[TConfig]
Base class for all environments.
| PARAMETER | DESCRIPTION |
|---|---|
env_options
|
Environment options.
TYPE:
|
scene_options
|
Scene options.
TYPE:
|
observation_options
|
Observation manager options.
TYPE:
|
event_options
|
Event manager options.
TYPE:
|
action_options
|
Action manager options.
TYPE:
|
metric_options
|
Metric manager options.
TYPE:
|
recorder_options
|
Recorder manager options.
TYPE:
|
cameras_options
|
Cameras options.
TYPE:
|
sensors_options
|
Sensors options.
TYPE:
|
renderer_options
|
Renderer options.
TYPE:
|
show_viewer
|
Whether to show the viewer.
TYPE:
|
eval_mode
|
Whether to run in eval mode.
TYPE:
|
**kwargs
|
Forwarded to
DEFAULT:
|
Source code in eden/envs/base.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
Attributes¶
observation_options
instance-attribute
¶
observation_options = observation_options or ObservationManagerOptions()
recorder_options
instance-attribute
¶
recorder_options = recorder_options or RecorderManagerOptions()
episode_length_buf
instance-attribute
¶
mochi_solver
property
¶
mochi_solver: MochiSolver
The Mochi implicit multi-physics solver of this scene's Mochi entities.
See :mod:eden.engine.solvers.mochi.
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If no entity of the scene takes a Mochi material, so no solver was installed. |
segmentation_idx_dict
property
¶
Genesis' segmentation id -> scene element map.
The element is a bare entity_idx at segmentation_level="entity" and an
(entity_idx, link_idx, ...) tuple at "link" / "geom". To go the other
way round use :attr:entity_segmentation_ids, not a manual inversion.
entity_segmentation_ids
property
¶
entity_idx -> [segmentation ids], the inverse of :attr:segmentation_idx_dict.
An entity owns one id per link/geom at segmentation_level="link"/"geom", so this
is the accessor to mask an entity out of a segmentation image — indexing
segmentation_idx_dict the other way round only ever finds one of them. Recomputed per
access so it tracks a rebuilt scene rather than going stale.
config
property
¶
config: EdenConfig
The config describing this environment — a round trip of the config it was built from.
Built via :meth:from_config, this returns a new instance of the source config's own
class (ReacherConfig, not EdenRLConfig), carrying every field the env never
receives — runner_options, language_instructions, task-specific fields — verbatim,
with every field :attr:_CONFIG_CLASS declares except :attr:_NON_RUNTIME_CONFIG_FIELDS
read off the live env, so runtime mutations (and any None the env replaced with a
default) are reflected. That is what makes env.config.save_as_json() write a file that
reloads into the same task and rebuilds the same env — synthesizing a base config here
instead would drop the runner and task fields with no error, since no env parameter
carries them.
Constructed directly (EnvBase(env_options=..., ...)), there is no source config to
round-trip: this synthesizes a plain :attr:_CONFIG_CLASS from the runtime options only,
and the fields the env does not own take their class defaults.
The returned root is a fresh, unlocked object, but its option children are the live ones
(not copies) — mutating them mutates the environment. Use env.config.clone() for an
independent copy.
fixed_shape_queries
property
¶
fixed_shape_queries: bool
Whether a query must take its fixed-shape, device-only form now: inside :meth:fixed_shape_query_scope.
A query with a data-dependent size (a contact query trimmed to the most contacts any env has) reads that
size back to the host and is shaped by it. Its fixed-shape form (the padded contact query, see
:meth:~eden.entities.base.Entity._query_contacts) does neither.
Methods:¶
from_config
classmethod
¶
Create an environment from a configuration object.
Inherited by every env class rather than reimplemented per leaf: a hand-copied list of
option groups drops a forgotten group in silence, the config fully valid and the env
simply never told. Reading the field list off :meth:_runtime_option_fields instead makes
forwarding a property of the structure: that is the same list :attr:config reads back
off the live env, so the two directions are symmetric by construction, and a group added
to a config leaf later is forwarded without anyone remembering to. Task-specific fields
are not swept in — the list comes from this env's leaf, not from type(cfg) — and
:attr:config carries them across via the recorded source instead.
| PARAMETER | DESCRIPTION |
|---|---|
cfg
|
The configuration object. Must be the leaf this env class reads — see
:meth:
TYPE:
|
show_viewer
|
Whether to show the viewer.
TYPE:
|
eval_mode
|
Whether to run in eval mode.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
env
|
The constructed environment, unbuilt — call
TYPE:
|
Source code in eden/envs/base.py
register_post_build_hook
¶
register_post_build_hook(hook: Callable[[], None]) -> None
Queue hook to run once at the end of :meth:post_build_setup.
| PARAMETER | DESCRIPTION |
|---|---|
hook
|
Zero-argument callable, invoked after every entity/camera
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If :meth: |
Source code in eden/envs/base.py
register_substep_callback
¶
Run callback around every scene.step() of :meth:step (decimation times per control step).
For a term that has to act on the simulation state between sim steps — clamp what the solver just did,
before the next step integrates it — which neither the action manager (it writes controls before each
step) nor a per-control-step hook can do. A before callback runs right before scene.step(), after the
action manager has applied its controls; the rest run right after it. Each runs in registration order, with
no arguments, on every env; keep them cheap and sync-free, since they sit on the physics hot path.
One scene.step() advances EnvOptions.sim_dt; Genesis' own sim_substeps run inside it, so a
callback never sees them.
A setter that overwrites an env's state clears the error flags its solver latched for it (the MochiSolver's and Genesis' particle solvers' do), so a callback calling one would hide the error of that sim step. While a callback is registered, the env keeps the flags of a misconfiguration after every sim step, which the next control step still raises; a corrupt state the setter overwrote is gone with its flag, as Genesis intends.
| PARAMETER | DESCRIPTION |
|---|---|
callback
|
Zero-argument callable.
TYPE:
|
before
|
Run it before each
TYPE:
|
Source code in eden/envs/base.py
build
¶
build(env_spacing: Vec2FType | None = None, center_envs_at_origin: bool | None = None)
Build the underlying Genesis scene and finalize all entities.
Runs :meth:pre_build_setup, builds the vectorized scene, then runs
:meth:post_build_setup. Must be called once before stepping the environment.
| PARAMETER | DESCRIPTION |
|---|---|
env_spacing
|
Spacing between environments in the xy-plane. Falls back to
|
center_envs_at_origin
|
Whether to center the grid of environments at the world origin.
Falls back to
TYPE:
|
Source code in eden/envs/base.py
pre_build_setup
¶
Source code in eden/envs/base.py
post_build_setup
¶
Source code in eden/envs/base.py
destroy
¶
Source code in eden/envs/base.py
summary
¶
summary() -> str
Return a human-readable summary of the environment and its managers.
Source code in eden/envs/base.py
seed
staticmethod
¶
Seed all RNGs used by the environment.
Applies exactly the seed given: no DDP rank offset, and no write-back to any
config. Seeding a run is :func:eden.utils.random.apply_run_seed's job — the
training wrappers call it from from_config, before the env is built.
| PARAMETER | DESCRIPTION |
|---|---|
seed
|
The seed to set. Must be non-negative;
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The seed that was actually applied. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in eden/envs/base.py
get_solver_error_envs_mask
¶
Envs a physics solver flagged since their last reset, (num_envs,) bool.
The rigid solver's errors (a NaN contact force) and, in a Mochi scene, the Mochi solver's (a diverged implicit solve). The termination manager truncates these envs, and the reward and metric managers drop what their terms read of them, so no value of the corrupt state reaches the learner; the reset clears the flag before the next error check would raise for the whole scene.
A misconfiguration of the scene (a contact capacity overflow, an unsupported collision pair, a NaN gradient
under requires_grad; see _RECOVERABLE_SOLVER_ERRORS) is reset and dropped the same way, but the env
keeps its flag across the reset, and the next control step raises it with the message that names the option to
change (on CUDA, whose check does not wait for the device, the one after).
Source code in eden/envs/base.py
set_global_sol_params
¶
Set constraint solver parameters.
Reference: https://mujoco.readthedocs.io/en/latest/modeling.html#solver-parameters
| PARAMETER | DESCRIPTION |
|---|---|
sol_params
|
array of length 7 in which each element corresponds to (timeconst, dampratio, dmin, dmax, width, mid, power)
|
Source code in eden/envs/base.py
set_sol_params
¶
Set constraint solver parameters.
Reference: https://mujoco.readthedocs.io/en/latest/modeling.html#solver-parameters
| PARAMETER | DESCRIPTION |
|---|---|
sol_params
|
array of length 7 in which each element corresponds to (timeconst, dampratio, dmin, dmax, width, mid, power)
|
geoms_idx
|
Scene-global indices of the geoms to set parameters for —
DEFAULT:
|
envs_idx
|
Indices of the environments to set parameters for. If None, all environments are used. Defaults to None.
DEFAULT:
|
joints_idx
|
Indices of the joints to set parameters for. If None, no joints are targeted. Defaults to None.
DEFAULT:
|
eqs_idx
|
Indices of the equality constraints to set parameters for. If None, none are targeted. Defaults to None.
DEFAULT:
|
Source code in eden/envs/base.py
compute_once
¶
producer(), evaluated at most once per pass for each key.
For terms that derive different values from one intermediate — a body-position and a body-rotation
error from the same anchor-relative transform, say — so a pass computes it once rather than once per
term. A pass (:meth:compute_pass) spans code that only reads the simulation, so the first result holds
for the rest of it: each manager's term loop opens one, and RLEnvBase.step opens one across its whole
graded phase (metrics, the observation tick, terminations, rewards), which grades one post-physics
state. The memo is dropped when the pass ends, and the next pass starts empty. Outside a pass (a term's
compute() called on its own) producer simply runs, so a result is never served stale. Every term
sharing key receives the same object: treat it as read-only.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
Names the intermediate, including every argument it depends on (entity, link names, ...): two calls with one key, from any term of any manager, are assumed to want the same value.
TYPE:
|
producer
|
Computes the intermediate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
T
|
|
Source code in eden/envs/base.py
compute_pass
¶
compute_pass() -> Iterator[None]
Open a :meth:compute_once pass for the duration of the block, unless one is already open.
A pass opened inside another joins it and leaves it open on exit, so a manager's term loop run inside the graded phase shares the phase's memo.
Source code in eden/envs/base.py
fixed_shape_query_scope
¶
fixed_shape_query_scope() -> Iterator[None]
Make every query in the block take its fixed-shape form (:attr:fixed_shape_queries).
The CUDA graph of the graded phase (EnvOptions.cuda_graph_options) runs each graded step in one, the
warm-up, the eager validation runs and the capture alike: a capture cannot record a host read, and the
runs it compares bit for bit must reduce over the same shapes. A scope opened inside another leaves it
open on exit.
Source code in eden/envs/base.py
get_entity
¶
get_entity(name: str) -> 'Entity'
Return the entity registered under name, or raise naming the ones that exist.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The entity's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Entity
|
The matching entity. |
| RAISES | DESCRIPTION |
|---|---|
KeyError
|
If no entity is registered under |
Source code in eden/envs/base.py
get_entities
¶
Get entities by name(s) with regex pattern matching support.
This method uses re.match() which matches patterns from the beginning
of the entity name. To match entities containing a pattern anywhere,
prefix with .* (e.g., ".*arm" to match entities containing "arm"; add $ to anchor the end).
| PARAMETER | DESCRIPTION |
|---|---|
names
|
A single regex pattern string or a list of regex pattern strings to match against entity names. Patterns are matched from the beginning of entity names. |
| RETURNS | DESCRIPTION |
|---|---|
list[Entity]
|
A list of entities whose names match any of the provided regex patterns. |
Examples:
>>> # Match all entities starting with "robot"
>>> env.get_entities("robot.*")
>>> # Match entities containing "_<number>" (won't match "robot" without a suffix)
>>> env.get_entities(".*_[0-9]+")
>>> # Match multiple patterns
>>> env.get_entities(["robot_[0-9]+", "box.*"])
>>> # Exact match
>>> env.get_entities("^robot$") # or simply "robot$"
Source code in eden/envs/base.py
get_camera
¶
get_camera(name: str) -> 'Camera'
reset
¶
reset(envs_idx: slice | Tensor | None = None, *, seed: int | None = None) -> VecEnvReset
Reset the given environments and return their fresh observations.
| PARAMETER | DESCRIPTION |
|---|---|
envs_idx
|
The environments to reset. If None, all environments are reset.
TYPE:
|
seed
|
If given, seed the RNGs before resetting.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
VecEnvReset
|
A |
Source code in eden/envs/base.py
step
¶
step(action: Tensor | dict[str, Tensor] | None = None) -> VecEnvStep
Advance the environment by one control step.
Applies action through the action manager, runs decimation physics
sub-steps, and computes observations. EnvBase itself has no reward or
termination; subclasses (:class:RLEnvBase) extend this.
| PARAMETER | DESCRIPTION |
|---|---|
action
|
The action to apply. If None, no action is applied (the sim still steps). |
| RETURNS | DESCRIPTION |
|---|---|
VecEnvStep
|
A |
Source code in eden/envs/base.py
RLEnvBase
¶
RLEnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, observation_options: ObservationManagerOptions | None = None, reward_options: RewardManagerOptions | None = None, termination_options: TerminationManagerOptions | None = None, event_options: EventManagerOptions | None = None, curriculum_options: CurriculumManagerOptions | None = None, command_options: CommandManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: EnvBase[EdenRLConfig]
Base class for all RL environments.
| PARAMETER | DESCRIPTION |
|---|---|
env_options
|
Environment options.
TYPE:
|
scene_options
|
Scene options.
TYPE:
|
observation_options
|
Observation manager options.
TYPE:
|
reward_options
|
Reward manager options.
TYPE:
|
termination_options
|
Termination manager options.
TYPE:
|
event_options
|
Event manager options.
TYPE:
|
curriculum_options
|
Curriculum manager options.
TYPE:
|
command_options
|
Command manager options.
TYPE:
|
action_options
|
Action manager options.
TYPE:
|
metric_options
|
Metric manager options.
TYPE:
|
recorder_options
|
Recorder manager options.
TYPE:
|
cameras_options
|
Cameras options.
TYPE:
|
sensors_options
|
Sensors options.
TYPE:
|
renderer_options
|
Renderer options.
TYPE:
|
show_viewer
|
Whether to show the viewer.
TYPE:
|
eval_mode
|
Whether to run in eval mode.
TYPE:
|
**kwargs
|
Forwarded to
DEFAULT:
|
Source code in eden/envs/base.py
Attributes¶
curriculum_manager
class-attribute
instance-attribute
¶
curriculum_manager: CurriculumManager | None = None
termination_options
instance-attribute
¶
termination_options = termination_options or TerminationManagerOptions()
curriculum_options
instance-attribute
¶
curriculum_options = curriculum_options or CurriculumManagerOptions()
max_episode_length
instance-attribute
¶
max_episode_length = int(np.ceil(self.max_episode_length_s / self.dt))
common_step_counter
instance-attribute
property
writable
¶
common_step_counter: int = 0
Control steps taken since construction, one count shared by every env.
Reading it while the graded phase is captured (EnvOptions.cuda_graph_options) raises
:class:~eden.envs.graded_graph.BakedHostReadError: the graph would replay the count it read on every
later step.
unwrapped
property
¶
The underlying environment (returns self; provided for wrapper compatibility).
Methods:¶
graded_capture_scope
¶
graded_capture_scope() -> Iterator[None]
Refuse reads of :attr:common_step_counter in the block, which captures the graded phase.
:class:~eden.envs.graded_graph.GradedPhaseGraph captures in one: the graph would replay the count a
term read there on every later step. Leaving it restores the guard as it found it, so a nested scope
leaves the outer one open.
Source code in eden/envs/base.py
summary
¶
summary() -> str
Return a human-readable summary, including RL managers (reward, termination, etc.).
Source code in eden/envs/base.py
step
¶
step(action: Tensor | dict[str, Tensor] | None = None) -> VecEnvStep
Advance the RL environment by one control step.
Applies action, runs decimation physics sub-steps, then computes
metrics, terminations, and rewards. Done environments are auto-reset
after reward/termination but before observation, so the returned
observations reflect the fresh post-reset state for those environments.
| PARAMETER | DESCRIPTION |
|---|---|
action
|
The action to apply. If None, no action is applied (the sim still steps). |
| RETURNS | DESCRIPTION |
|---|---|
VecEnvStep
|
A |
Source code in eden/envs/base.py
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 | |
post_build_setup
¶
MimicRLEnvBase
¶
MimicRLEnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, observation_options: ObservationManagerOptions | None = None, reward_options: RewardManagerOptions | None = None, termination_options: TerminationManagerOptions | None = None, event_options: EventManagerOptions | None = None, curriculum_options: CurriculumManagerOptions | None = None, command_options: CommandManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, motion_options: MotionManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: RLEnvBase, EnvBase[EdenMimicConfig]
Base class for all Mimic RL environments.
The extra EnvBase[EdenMimicConfig] base is how this leaf re-binds its config: RLEnvBase
is itself instantiable so it binds EdenRLConfig outright rather than staying generic, which
leaves it unsubscriptable — a plain MimicRLEnvBase(RLEnvBase) would inherit that binding.
Source code in eden/envs/base.py
Attributes¶
Methods:¶
step
¶
step(action: Tensor | dict[str, Tensor] | None = None) -> VecEnvStep
Advance the motion-imitation environment by one control step.
Updates the motion reference for the current step, then delegates to
:meth:RLEnvBase.step.
| PARAMETER | DESCRIPTION |
|---|---|
action
|
The action to apply. If None, no action is applied (the sim still steps). |
| RETURNS | DESCRIPTION |
|---|---|
VecEnvStep
|
A |
Source code in eden/envs/base.py
env_class_for_config
¶
env_class_for_config(cfg: EdenConfig) -> type[EnvBase]
Return the env class that builds cfg.
Maps each config leaf to its env class, mirroring the parallel hierarchies:
EdenMimicConfig→MimicRLEnvBaseEdenSplatRLConfig→SplatRLEnvBaseEdenSplatConfig→SplatEnvBaseEdenRLConfig→RLEnvBaseEdenNyxSplatConfig→NyxSplatEnvBaseEdenConfig→EnvBase
The single dispatch point for config→env-class, shared by the from_config
wrappers, the CLI play path, and the smoke harness. The configs form an inheritance chain
(EdenMimicConfig, EdenSplatRLConfig ⊂ EdenRLConfig ⊂ EdenConfig, and
EdenSplatConfig / EdenNyxSplatConfig ⊂ EdenConfig), so the pairs are checked
most-specific first — EdenSplatRLConfig before the generic EdenRLConfig branch that
would otherwise shadow it, and EdenSplatConfig before the EdenConfig fallback.
The splat env classes are imported lazily: they pull optional renderer dependencies, and a
config that is not a splat config must not require them. A splat config that is passed
while those dependencies are missing gets the ImportError — that is the actionable
failure, and far better than a silent downgrade to RLEnvBase, which would build an env
with no splat renderer and no error.
The reverse direction is not stated here: each env declares its own leaf as
:attr:EnvBase._CONFIG_CLASS, following the definition-site convention Eden uses for
tasks rather than keeping a second central index. Deduplicating the two would mean
deriving one by reflection over __subclasses__ — import-order dependent — so they are
pinned to each other by
tests/envs/test_base.py::test_every_leaf_accepts_its_own_config_and_only_the_two_keywords
instead. A new config leaf must therefore update both, and that test says so if it doesn't.
Source code in eden/envs/base.py
2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 | |
Gaussian-splat environments¶
Environments that composite a Gaussian-splat background behind the simulated scene, with the gsplat backend
(SplatEnvBase, SplatRLEnvBase) or the Nyx path tracer (NyxSplatEnvBase). They pair with the splat configs on
the configs page.
SplatEnvBase
¶
SplatEnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, splat_options: SplatOptions | None = None, observation_options: ObservationManagerOptions | None = None, event_options: EventManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: _SplatEnvMixin, EnvBase[EdenSplatConfig]
Non-RL environment with a gsplat splat background (viewer / teleop / inference / data collection).
A sibling of :class:SplatRLEnvBase with no reward/termination/command/curriculum surface, as
EnvBase is of RLEnvBase. The EnvBase[EdenSplatConfig] base re-binds the config leaf.
Source code in eden/envs/splat.py
Methods:¶
SplatRLEnvBase
¶
SplatRLEnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, splat_options: SplatOptions | None = None, observation_options: ObservationManagerOptions | None = None, reward_options: RewardManagerOptions | None = None, termination_options: TerminationManagerOptions | None = None, event_options: EventManagerOptions | None = None, curriculum_options: CurriculumManagerOptions | None = None, command_options: CommandManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: _SplatEnvMixin, RLEnvBase, EnvBase[EdenSplatRLConfig]
RL environment with a gsplat splat background (splat scene + full RL surface).
The RL counterpart of :class:SplatEnvBase, sharing its splat plumbing via
:class:_SplatEnvMixin; the extra EnvBase[EdenSplatRLConfig] base re-binds the config leaf,
the same way :class:~eden.envs.base.MimicRLEnvBase does.
Source code in eden/envs/splat.py
Methods:¶
NyxSplatEnvBase
¶
NyxSplatEnvBase(env_options: EnvOptions | None = None, scene_options: SceneOptions | None = None, splat_options: NyxSplatOptions | None = None, observation_options: ObservationManagerOptions | None = None, event_options: EventManagerOptions | None = None, action_options: ActionManagerOptions | None = None, metric_options: MetricManagerOptions | None = None, recorder_options: RecorderManagerOptions | None = None, cameras_options: CamerasOptions | None = None, sensors_options: SensorsOptions | None = None, renderer_options: RendererOptions | None = None, *, show_viewer: bool = False, eval_mode: bool = False, **kwargs)
Bases: EnvBase[EdenNyxSplatConfig]
Env (no RL managers) with the Nyx renderer for photorealistic background rendering using gaussian splats.
Drives the official gs_nyx_plugin (see gs_nyx_plugin.NyxCameraSensor)
so gaussian splats render as native LightFieldAsset instances inside the
path-traced scene, with proper lighting interaction between splat
backgrounds and Genesis entities.
Source code in eden/envs/nyx_splat.py
Debug drawing¶
DrawDebugMixin
¶
Mixin providing debug drawing pass-throughs to the Genesis scene.
Methods:¶
draw_debug_line
¶
Draws a line in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
start
|
The starting point of the line.
TYPE:
|
end
|
The ending point of the line.
TYPE:
|
radius
|
The radius of the line (represented as a cylinder)
TYPE:
|
color
|
The color of the line in RGBA format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_arrow
¶
Draws an arrow in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
pos
|
The starting position of the arrow.
TYPE:
|
vec
|
The vector of the arrow.
TYPE:
|
radius
|
The radius of the arrow body (represented as a cylinder).
TYPE:
|
color
|
The color of the arrow in RGBA format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_frame
¶
Draws a 3-axis coordinate frame in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
T
|
The transformation matrix of the frame.
TYPE:
|
axis_length
|
The length of the axes.
TYPE:
|
origin_size
|
The size of the origin point (represented as a sphere).
TYPE:
|
axis_radius
|
The radius of the axes (represented as cylinders).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_frames
¶
Draws 3-axis coordinate frames in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
Ts
|
The transformation matrices of frames.
TYPE:
|
axis_length
|
The length of the axes.
TYPE:
|
origin_size
|
The size of the origin point (represented as a sphere).
TYPE:
|
axis_radius
|
The radius of the axes (represented as cylinders).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_mesh
¶
Draws a mesh in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
mesh
|
The mesh to be drawn.
TYPE:
|
pos
|
The position of the mesh in the scene.
TYPE:
|
T
|
The transformation matrix of the mesh. If None, the mesh will be drawn at the position specified by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_sphere
¶
Draws a sphere in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
pos
|
The center position of the sphere.
TYPE:
|
radius
|
radius of the sphere.
TYPE:
|
color
|
The color of the sphere in RGBA format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_spheres
¶
Draws multiple spheres in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
poss
|
The positions of the spheres.
TYPE:
|
radius
|
The radius of the spheres.
TYPE:
|
color
|
The color of the spheres in RGBA format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_box
¶
Draws a box in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
bounds
|
The bounds of the box, specified as [[min_x, min_y, min_z], [max_x, max_y, max_z]].
TYPE:
|
color
|
The color of the box in RGBA format.
TYPE:
|
wireframe
|
Whether to draw the box as a wireframe.
TYPE:
|
wireframe_radius
|
The radius of the wireframe lines.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_points
¶
Draws points in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
poss
|
The positions of the points.
TYPE:
|
colors
|
The color of the points in RGBA format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object.
TYPE:
|
Source code in eden/envs/draw_debug_mixin.py
draw_debug_path
¶
Draws a planned joint trajectory in the scene for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
qposs
|
The joint positions of the planned points. N is the number of configurations (i.e., trajectory points). M is the number of degrees of freedom for the entity (i.e., joint dimensions).
TYPE:
|
entity
|
The rigid entity whose forward kinematics are used to compute the trajectory path.
TYPE:
|
link_idx
|
The link id of the rigid entity to visualize. Default is -1.
TYPE:
|
density
|
Controls the sampling density of the trajectory points to visualize. Default is 0.3.
TYPE:
|
frame_scaling
|
Scaling factor for the visualization frames' size. Affects the length and thickness of the debug frames. Default is 1.0.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node
|
The created debug object representing the visualized trajectory.
TYPE:
|
Notes
The function uses forward kinematics (FK) to convert joint positions to Cartesian space and render debug frames. The density parameter reduces FK computational load by sampling fewer points, with 1.0 representing the whole trajectory.
Source code in eden/envs/draw_debug_mixin.py
clear_debug_object
¶
CUDA-graph replay of the graded phase¶
EnvOptions.cuda_graph_options replays the metric, observation-refresh, termination and reward phase of
RLEnvBase.step from a CUDA graph. GradedPhaseGraph is the implementation; BakedHostReadError is what it raises
when a term reads a value back to the host during capture.
CUDA-graph replay of the graded phase of RLEnvBase.step (EnvOptions.cuda_graph_options).
Between the physics step and the auto-reset, RLEnvBase.step grades the post-physics state: the metric
manager, the observation terms' post_physics_refresh tick, the termination manager and the reward
manager. That phase reads the simulation (through Genesis' zero-copy views, plain torch indexing) and writes
only the managers' own buffers, but it does so in hundreds of small kernels, and on a host-bound step their
launches are what it costs: ~3 ms of host time on BeyondMimic at 4096 envs, against ~1 ms of device time.
Replayed from a CUDA graph the same kernels launch in ~5 µs, and the checks before each replay (below)
take ~70 µs.
A graph replays kernels, not Python, so it is only right for code that keeps its state in tensors it writes
in place, and reads no value back to the host — which is the term contract (docs/guides/terms.md).
:class:GradedPhaseGraph does not take that on trust (its settings are
:class:~eden.options.envs.CudaGraphOptions):
- It captures after
warmup_stepseager steps, once every term has built its lazy caches (building one inside a capture is a host-to-device copy, which a capture rejects). -
The capture step and the next
validation_stepsreplays are each also run eagerly and compared bit for bit with the graph: every tensor the phase leaves behind (each one bound to an object the walk follows that it writes or rebinds, and each one it writes that no such binding reaches) and the phase's outputs. A mismatch raises, naming the tensors that differ. The two runs go in a different order on each kind of step: -
On the capture step the eager run goes first (a capture records kernels without running them). It is undone so the capture starts from the same state. Every tensor that existed before it is put back, reached by a binding or not, so the capture's replay does not advance it a second time. One it allocated is not: it may already sit in a cache that outlives the phase (Genesis' contact query), and rolling it back would hand the cache's next reader stale values.
- On a validated replay the graph goes first and is undone (the same tensors), and the eager run's result is the one kept. Run the other way round, work a capture recorded without being able to replay (a kernel launched outside torch's stream runs once, at capture time) would be redone by the eager run just before the replay read it, and agree. Graph-first, the replay reads the stale value and disagrees.
- Before every replay it checks what the graph baked in, and re-captures (and re-validates) when it changed:
the graded terms' configured fields (a curriculum moving a termination threshold), the env's per-run
constants a term may read as Python values (:data:
_ENV_CONSTANTS), and every binding on the way to a tensor the capture read (a term orload_state_dictrebinding the tensor, or replacing the dict or helper that holds it, leaves the graph reading the old address). The fields a manager mirrors on the device (:attr:~eden.managers.base.ManagerBase.device_synced_fields, the reward weights) are the exception: the manager'ssync_device_fieldsruns before every replay, so a weight curriculum needs no re-capture. env.common_step_counterchanges on every step, so it cannot be watched: reading it during a capture raises :class:BakedHostReadError, naming the term's line. Any other Python value a term reads from outside its own configured fields (another manager's term, a module global) is not watched either, and the graph replays what it read at capture. Keep such a value in a tensor written in place.- More than
max_recaptures_per_windowre-captures withinrecapture_windowsteps raise, naming what changed: re-capturing on nearly every step costs more than the eager phase it replaces. A one-off change, such as a curriculum switching stage, re-captures once.
The walk that finds those bindings follows every object reachable from the env through attributes and
containers, however deep, except three kinds: the env itself (every term's back-reference to it), the standard
library's objects, and the objects of :data:_UNWALKED_PACKAGES (the simulator and torch), which hold the
simulation's own state and per-step caches rather than a term's.
Classes¶
GradedPhaseGraph
¶
GradedPhaseGraph(env: RLEnvBase, compute: Callable[[], tuple[Tensor, Tensor]], options: CudaGraphOptions)
Run the graded phase from a CUDA graph, validated against eager runs of it.
| PARAMETER | DESCRIPTION |
|---|---|
env
|
The built env whose graded phase this replays.
TYPE:
|
compute
|
The eager graded phase, returning |
options
|
How to capture, validate and re-capture (
TYPE:
|
Source code in eden/envs/graded_graph.py
Methods:¶
BakedHostReadError
¶
Bases: RuntimeError
A host value that changes on every step was read while the graded phase was being captured.
Raised by RLEnvBase.common_step_counter during a capture: the graph would replay the count it read on
every later step, so a cadence gated on it (counter % n == 0) would stay on the branch the capture took.
RL-library wrappers¶
The wrappers adapt an RLEnvBase to an RL library's vectorized-env interface. They live in eden/envs/wrappers/,
which has no __init__.py, so the API generator cannot render them here; read their docstrings in the source.
| Module | Classes and functions | Library |
|---|---|---|
eden/envs/wrappers/rsl_rl_env.py |
RslRlVecEnvWrapper, make_rsl_rl_runner, load_runner_checkpoint, DDPOnPolicyRunner, MimicOnPolicyRunner |
rsl-rl-lib |
eden/envs/wrappers/rl_games_env.py |
RlGamesVecEnvWrapper |
rl_games |
eden/envs/wrappers/gymnasium_env.py |
GymnasiumVecEnvWrapper, make_vec_env, register_gymnasium_envs |
Gymnasium (gym.make_vec("Eden/<task>")) |
eden/envs/wrappers/sb3_env.py |
Sb3VecEnvWrapper |
Stable-Baselines3 |
eden/envs/wrappers/skrl_env.py |
SkrlVecEnvWrapper |
skrl |
eden/envs/wrappers/vec_env_mixin.py |
VecEnvMixin, shared by the Gymnasium, SB3 and skrl wrappers |
— |
eden/envs/wrappers/core.py |
EnvWrapperMixin, action_space, observation_space, time_outs |
— |
See Training runs and Other RL libraries.
See also¶
- Environments guide — construction, step phases, auto-reset
- Final observations —
EnvOptions.record_final_observationsandextras["final_observations"] - Environment options
- Managers