Skip to content

feat(gym): allow configured sensors to be disabled - #697

Merged
yuecideng merged 1 commit into
mainfrom
codex/disable-sensor-capture
Sep 26, 2026
Merged

yuecideng merged 1 commit into
mainfrom
codex/disable-sensor-capture

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

This PR adds an opt-out path for sensor acquisition in Gym deployments.

  • Add enable_sensor: false to keep an embodiment sensor declaration while skipping sensor creation and image acquisition.
  • Add --disable_sensor / --disable-sensor launcher overrides.
  • Omit sensor image allocation from the online-data rollout buffer when acquisition is disabled.
  • Remove sensor-dependent event and observation functors before their managers are initialized, including nested SceneEntityCfg, all_sensors, sensor output paths, and camera-keyed descriptors.
  • Add focused coverage using the existing CobotMagic tableware embodiment and manager-level tests.

Dependencies: None.

Validation

  • pytest -q tests/gym/envs/test_sensor_acquisition.py tests/gym/utils/test_gym_utils.py — 132 passed
  • black --check --diff --color ./
  • python docs/scripts/check_api_docs.py
  • python .agents/skills/project-dev-context/scripts/context.py check

The Python 3.10 environment could not collect pytest because its installed SciPy/Scikit-learn binaries have an ABI signature mismatch; the same tests pass under Python 3.11.

Allow embodiment sensor suites to remain configured while disabling sensor creation and image buffers. Filter dependent event and observation functors before manager initialization.
@yuecideng yuecideng added enhancement New feature or request sensor Virtual sensor for computing observation from simulation gym robot learning env and its related features labels Sep 26, 2026
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds optional sensor disable switch to environment configuration.

The PR appears safe to merge, though disabled sensor add-mode observations can still consume rollout-buffer memory.

Fix All in CodexFindings

  1. P2 Disabled images still allocated ▶
Fix with agent prompt
### Issue 1
embodichain/lab/gym/utils/gym_utils.py:1515
When a disabled sensor has an `add`-mode observation with an image-shaped `extra.shape`, the buffer allocates that observation before this sensor check. Environment initialization removes the observation functor, so the allocated image buffer cannot be populated and can retain the memory cost this switch is meant to avoid. Please apply the disabled-sensor check to extra-observation allocation too.

---

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

Summary

The PR adds a Gym configuration and launcher switch to skip configured sensor acquisition, filters sensor-dependent event and observation functors, and omits configured sensor entries from the online rollout buffer.

  • Adds focused tests and updates environment-framework guidance.
  • Image-shaped extra observations can still be allocated when their sensor functors are disabled.

Reviews (1) · Last reviewed commit: "feat(gym): disable configured sensor acq..."


if cfg.get("sensor_type", "Camera") == "StereoCamera":
desc["color_right"] = torch.zeros(
if config.get("enable_sensor", True):

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 Disabled images still allocated

When a disabled sensor has an add-mode observation with an image-shaped extra.shape, the buffer allocates that observation before this sensor check. Environment initialization removes the observation functor, so the allocated image buffer cannot be populated and can retain the memory cost this switch is meant to avoid. Please apply the disabled-sensor check to extra-observation allocation too.

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/gym/utils/gym_utils.py
Line: 1515

Comment:
**Disabled images still allocated**

When a disabled sensor has an `add`-mode observation with an image-shaped `extra.shape`, the buffer allocates that observation before this sensor check. Environment initialization removes the observation functor, so the allocated image buffer cannot be populated and can retain the memory cost this switch is meant to avoid. Please apply the disabled-sensor check to extra-observation allocation too.

---

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

Fix in Codex Fix in Claude Code

@yuecideng
yuecideng merged commit fd6c589 into main Sep 26, 2026
9 checks passed
@yuecideng
yuecideng deleted the codex/disable-sensor-capture branch September 26, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gym robot learning env and its related features sensor Virtual sensor for computing observation from simulation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant