Skip to content

Fixes drone navigation, camera benchmark, and kitless shutdown errors… - #5900

Merged
kellyguo11 merged 2 commits into
isaac-sim:release/3.0.0-beta2from
kellyguo11:cherry-pick-drone
Jun 2, 2026
Merged

kellyguo11 merged 2 commits into
isaac-sim:release/3.0.0-beta2from
kellyguo11:cherry-pick-drone

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

… (#5882)

Description

Environment shutdown fix (isaaclab/envs/) All three env classes (DirectRLEnv, DirectMARLEnv, ManagerBasedEnv) had a race condition in del: the lazy import sys inside the destructor could fail or produce a spurious traceback once Python's import machinery had already finalized at interpreter shutdown. The fix captures sys.is_finalizing as a default argument at class definition time (before finalization), so the check always works safely.

Drone ARL navigation default env count (isaaclab_tasks/) Reduced the default num_envs for Isaac-Navigation-3DObstacles-ARL-Robot-1-v0 from 4096/8192 to 1024 in both the env config and the rl_games PPO config. Users can override with --num_envs or env.scene.num_envs.

Camera benchmark fix (scripts/benchmarks/benchmark_cameras.py) Moved prim creation and prim_path assignment to after the camera config object is built, so class_type is resolved from the instantiated config rather than the unresolved camera_cfg callable. Also uses the config's class_type (not the original camera_cfg.class_type) when calling the constructor, fixing a subtle bug when the config overrides the class.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

…isaac-sim#5882)

# Description

Environment shutdown fix (isaaclab/envs/) All three env classes
(DirectRLEnv, DirectMARLEnv, ManagerBasedEnv) had a race condition in
__del__: the lazy import sys inside the destructor could fail or produce
a spurious traceback once Python's import machinery had already
finalized at interpreter shutdown. The fix captures sys.is_finalizing as
a default argument at class definition time (before finalization), so
the check always works safely.

Drone ARL navigation default env count (isaaclab_tasks/) Reduced the
default num_envs for Isaac-Navigation-3DObstacles-ARL-Robot-1-v0 from
4096/8192 to 1024 in both the env config and the rl_games PPO config.
Users can override with --num_envs or env.scene.num_envs.

Camera benchmark fix (scripts/benchmarks/benchmark_cameras.py) Moved
prim creation and prim_path assignment to after the camera config object
is built, so class_type is resolved from the instantiated config rather
than the unresolved camera_cfg callable. Also uses the config's
class_type (not the original camera_cfg.class_type) when calling the
constructor, fixing a subtle bug when the config overrides the class.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jun 1, 2026

@isaaclab-review-bot isaaclab-review-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Isaac Lab Review Bot

Summary

This PR cherry-picks three independent bug fixes to the release/3.0.0-beta2 branch: (1) a race condition fix in environment destructors during Python interpreter shutdown, (2) a reduction of the default num_envs for the drone ARL navigation task from 4096/8192 to 1024, and (3) a camera benchmark script fix that resolves class_type from the instantiated config rather than the unresolved callable.

Update (6c78a50): The PR scope has expanded significantly beyond the original three cherry-picks. The new commit adds:

  • Documentation infrastructure overhaul: New Sphinx extension (docs/_extensions/isaaclab_docs.py) that provides custom directives (isaaclab-clone-commands, isaaclab-clone-https, isaaclab-kitless-install-snippet, isaaclab-quickstart-install) to DRY up clone/install commands across docs and pin them to the release branch via isaaclab_latest_branch config.
  • Auto-generated environment table: New tooling (tools/environ_docs.py, tools/update_environments_rst.py) that regenerates the comprehensive environment list in environments.rst from the Gym registry. Includes proper test coverage (tools/test/test_environ_docs.py).
  • Branch reference migration: All docs updated from develop/main references to release/3.0.0-beta2 — links, installation instructions, Newton backend docs, etc.
  • MJCF Converter fix: Enables the isaacsim.asset.importer.mjcf extension automatically before importing, preventing failures when the extension is not pre-loaded.
  • README updates: Added compatibility warning, updated documentation links to point at release/3.0.0-beta2, version table updates.
  • Installation docs restructure: Consolidated selective install documentation into include/selective_install.rst, simplified pip installation page, removed deprecated warnings about Isaac Sim develop branch compatibility.
  • CONTRIBUTORS.md: Added Yize Wang.
  • Minor fixes: Quadcopter demo uses robot.data.body_mass.torch instead of deprecated root_view.get_masses(), H1 locomotion demo calls handle_deprecated_rsl_rl_cfg, asset converter docs add --viz kit flag.
  • Wheel builder: Comment clarification in python_packages.toml.

Design Assessment

Sphinx Extension (isaaclab_docs.py) — Well-structured extension that eliminates branch-name duplication across documentation. The directives are minimal, composable, and properly registered with Sphinx's parallel read/write safety. The isaaclab_latest_branch config value provides a single source of truth. Good use of nested_parse for generating RST from within directives.

Environment Docs Automation (environ_docs.py) — Solid design with clear separation between data collection, formatting, and RST patching. The PresetTarget-based categorization correctly separates physics/renderer/domain presets. The filtering of physics-backend mirror names from domain presets is a thoughtful detail that prevents confusing duplication in the docs. Test coverage is comprehensive.

MJCF Converter Fix — Clean fix with proper test. Using set_extension_enabled_immediate is the correct approach for enabling extensions at runtime. The test properly validates the behavior by checking extension state before/after converter construction.

Branch Migration — Systematic and consistent. All hardcoded develop/main branch references in docs are updated to release/3.0.0-beta2.

Findings

🟡 Minor Issues

  1. docs/source/setup/installation/include/selective_install.rst uses core token but the source install page (src_build_isaaclab.rst) references :ref:\installation-selective-install`for details. Thecorevsnonenaming was previously inconsistent — this commit usescore` consistently, which is an improvement.

  2. environ_docs.py — _infer_implicit_physics_names imports at function level: This imports PhysxCfg, PhysicsCfg, and task utilities inside the function body. While this avoids circular imports, it means every call to collect_environment_doc_rows pays repeated import overhead. Acceptable for a docs-generation tool that runs infrequently.

  3. docs/source/overview/environments.rst — Very large auto-generated section: The generated table is ~800+ lines. The marker-based approach (START-AUTO-GENERATED / END-AUTO-GENERATED) is clean, but reviewers should be aware that diffs touching this file will be noisy in future PRs that add environments.

  4. Removed DGX Spark JAX limitation note (docs/source/setup/installation/index.rst): The previous note stated JAX GPU was unavailable on aarch64. The new JAX docs section in rl_existing_scripts.rst now shows CUDA 13 wheel support for aarch64 — this is a genuine improvement that reflects JAX's expanded platform support.

  5. tools/update_environments_rst.py has experimental import: The with contextlib.suppress(ImportError): import isaaclab_tasks_experimental pattern is forward-looking but the comment says "PLACEHOLDER: Extension template (do not remove this comment)" — this seems like scaffolding that should be documented or removed before merging to a release branch.

🟢 No Issues

  1. Original three fixes remain intact — The shutdown fix, drone num_envs reduction, and camera benchmark fix from the previous review are unchanged.

  2. Test coverage — test_environ_docs.py provides good unit test coverage for the documentation generation helpers. test_mjcf_converter.py properly tests the auto-enable behavior.

  3. Copy button CSS — Making sphinx-copybutton always visible (opacity: 1) is a UX improvement for code blocks in docs.

Test Coverage

The new changes include:

  • tools/test/test_environ_docs.py — 12 test functions covering the environment docs generation pipeline
  • source/isaaclab/test/sim/test_mjcf_converter.py — New test for extension auto-enabling

Verdict

No blocking issues — The PR has grown substantially from a simple cherry-pick to include significant documentation infrastructure improvements. All changes are well-structured and properly tested. The documentation overhaul is a valuable improvement for the release branch, ensuring installation instructions and environment listings stay in sync with the codebase. Safe to merge.


Reviewed commits: 92d3b39..6c78a50

@greptile-apps

greptile-apps Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR bundles three bug fixes: a race-condition in __del__ across all three env classes, a high-memory-footprint default for the drone navigation task, and a class-resolution bug in the camera benchmark script.

  • Env shutdown fix (direct_rl_env.py, direct_marl_env.py, manager_based_env.py): replaces the lazy import sys inside __del__ with a default-argument capture of sys.is_finalizing at class-definition time — a standard CPython idiom that reliably survives interpreter finalization.
  • Drone nav defaults (navigation_env_cfg.py, rl_games_rough_ppo_cfg.yaml): drops num_envs from 4096/8192 → 1024 so the task is runnable on hardware with less VRAM out of the box.
  • Camera benchmark (benchmark_cameras.py): moves the validity guard before prim and config construction in create_camera_base, adds _get_camera_class_name to read class_type from dataclass field metadata (safe for both default and default_factory cases), and switches the instantiation call to cfg.class_type so a subclass that overrides class_type is honoured correctly.

Confidence Score: 4/5

Safe to merge — all three fixes address real, reproducible defects and the changes are narrow in scope.

The env destructor pattern is a well-established CPython idiom and works correctly. The drone nav default change is a simple integer override with no downstream logic impact. The camera benchmark fix correctly moves the validity guard before side-effecting prim creation and resolves the class_type lookup from the instantiated config. The only lingering gap is that create_ray_caster_cameras still creates prims before its own validity guard, and the _get_camera_class_name dictionary access raises KeyError rather than AttributeError for a missing field. Both are minor benchmark-script-only issues that don't affect production training paths.

scripts/benchmarks/benchmark_cameras.py warrants a second look for the two style inconsistencies noted; all other changed files look straightforward.

Important Files Changed

Filename Overview
scripts/benchmarks/benchmark_cameras.py Refactored create_camera_base to validate inputs first, build the config instance before prim creation, and use cfg.class_type instead of camera_cfg.class_type; added _get_camera_class_name helper.
source/isaaclab/isaaclab/envs/direct_rl_env.py del now captures sys.is_finalizing as a default argument at class-definition time, avoiding the race condition where the lazy import sys could fail during interpreter shutdown.
source/isaaclab/isaaclab/envs/direct_marl_env.py Same del shutdown-safety fix as direct_rl_env.py applied to DirectMARLEnv.
source/isaaclab/isaaclab/envs/manager_based_env.py Same del shutdown-safety fix applied to ManagerBasedEnv.
source/isaaclab_tasks/isaaclab_tasks/manager_based/drone_arl/navigation/config/arl_robot_1/navigation_env_cfg.py Default num_envs reduced from 4096 to 1024 to lower the barrier for initial training runs.
source/isaaclab_tasks/isaaclab_tasks/manager_based/drone_arl/navigation/config/arl_robot_1/agents/rl_games_rough_ppo_cfg.yaml rl_games env_config num_envs reduced from 8192 to 1024, keeping in sync with the env config change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["create_camera_base(camera_cfg, num_cams, ...)"] --> B{num_cams<=0 or\ndata_types empty or\nheight/width<=0?}
    B -- Yes --> C[return None]
    B -- No --> D["_get_camera_class_name(camera_cfg)\n→ reads __dataclass_fields__"]
    D --> E["cfg = camera_cfg(prim_path, height, width, ...)"]
    E --> F{instantiate?}
    F -- Yes --> G["create_prim x num_cams\n/World/{name}_{idx:02d}"]
    G --> H["return cfg.class_type(cfg=cfg)\n← uses instance class_type"]
    F -- No --> I["return cfg\n(config only, no prims)"]

    subgraph Env Shutdown Fix
        J["class DirectRLEnv:\n  def __del__(self,\n    _sys_is_finalizing=sys.is_finalizing):"]
        J --> K["if not _sys_is_finalizing(): self.close()"]
    end
Loading

Comments Outside Diff (1)

  1. scripts/benchmarks/benchmark_cameras.py, line 365-369 (link)

    P2 create_ray_caster_cameras still creates prims unconditionally before the validity guard, leaving orphaned Xform prims in the scene when data_types is empty or height/width is zero — the exact problem the refactored create_camera_base now avoids. The guard and prim creation should be reordered here for consistency.

Reviews (1): Last reviewed commit: "Fixes drone navigation, camera benchmark..." | Re-trigger Greptile

Comment on lines +283 to +284
class_type_field = camera_cfg.__dataclass_fields__["class_type"]
if class_type_field.default is not MISSING:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Accessing __dataclass_fields__["class_type"] with a plain dict lookup raises KeyError (not AttributeError) if the field is absent, which breaks the except AttributeError contract implied by the raise on the last line and may confuse callers. Using .get() with an explicit check gives a cleaner error path.

Suggested change
class_type_field = camera_cfg.__dataclass_fields__["class_type"]
if class_type_field.default is not MISSING:
class_type_field = camera_cfg.__dataclass_fields__.get("class_type")
if class_type_field is None:
raise AttributeError(f"{camera_cfg.__name__} has no 'class_type' dataclass field.")
if class_type_field.default is not MISSING:

@isaaclab-review-bot

Copy link
Copy Markdown
Contributor

Re-review Update (6c78a50): Reviewed 3 new commits since my last review.

Previous concern status:

  • The benchmark_cameras.py issue about __dataclass_fields__["class_type"] dict access remains open — the file was not modified in these commits.

New changes reviewed:

  • ✅ Documentation updates (README links, installation guides, environments.rst auto-generation)
  • ✅ MJCF converter fix for extension enabling (enables isaacsim.asset.importer.mjcf before import)
  • ✅ Quadcopter demo fix (uses .data.body_mass.torch instead of deprecated .root_view.get_masses())
  • ✅ H1 locomotion demo fix (handles deprecated RSL-RL config via handle_deprecated_rsl_rl_cfg)
  • ✅ New tools/environ_docs.py and tools/update_environments_rst.py for auto-generating environment documentation

No new issues found in the incremental changes. The existing inline comment on benchmark_cameras.py still applies.

@kellyguo11
kellyguo11 merged commit 709ea2a into isaac-sim:release/3.0.0-beta2 Jun 2, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant