feat(gym): allow configured sensors to be disabled - #697
Conversation
Allow embodiment sensor suites to remain configured while disabling sensor creation and image buffers. Filter dependent event and observation functors before manager initialization.
|
|
|
||
| if cfg.get("sensor_type", "Camera") == "StereoCamera": | ||
| desc["color_right"] = torch.zeros( | ||
| if config.get("enable_sensor", True): |
There was a problem hiding this 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.
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.
Description
This PR adds an opt-out path for sensor acquisition in Gym deployments.
enable_sensor: falseto keep an embodiment sensor declaration while skipping sensor creation and image acquisition.--disable_sensor/--disable-sensorlauncher overrides.SceneEntityCfg,all_sensors, sensor output paths, and camera-keyed descriptors.Dependencies: None.
Validation
pytest -q tests/gym/envs/test_sensor_acquisition.py tests/gym/utils/test_gym_utils.py— 132 passedblack --check --diff --color ./python docs/scripts/check_api_docs.pypython .agents/skills/project-dev-context/scripts/context.py checkThe 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.