Skip to content

Decouple Agents and Sensors; default GUI+Bullet#2621

Merged
aclegg3 merged 1 commit intomainfrom
agent-sensor-decoupling
Feb 21, 2026
Merged

Decouple Agents and Sensors; default GUI+Bullet#2621
aclegg3 merged 1 commit intomainfrom
agent-sensor-decoupling

Conversation

@aclegg3
Copy link
Contributor

@aclegg3 aclegg3 commented Feb 19, 2026

Motivation and Context

Agent-Sensor Decoupling:

  • Extract Sensor class from simulator.py into sensors/sensor_wrapper.py, fully decoupled from Agent (no agent reference needed)
  • Flat sensor registry on Simulator (sim.sensors, create_sensor, remove_sensor, get_sensor, render_sensors)
  • Agent.sensors is now a live property backed by C++ subtree propagation
  • Backward-compat aliases preserved (_sensors, add_sensor, get_sensor_observations)

Build Defaults:

  • Default HABITAT_BUILD_GUI_VIEWERS=ON and HABITAT_WITH_BULLET=ON across pyproject.toml, build.sh, and CMakeLists.txt
  • Updated BUILD_FROM_SOURCE.md, setup.py, CONTRIBUTING.md, and viewer example headers to reflect new defaults

Example Migration:

  • Replace all internal API patterns (_sensors, _sensor_object, _spec, _Simulator__sensors) with public API (sensors, sensor_object, spec, node) across all viewer examples, Python tutorials, and Jupyter notebooks

How Has This Been Tested

Tests:

  • New tests for sensor subtree discovery, create/remove lifecycle, render_sensors, registry consistency, and backward-compat aliases

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…public API

Agent-Sensor Decoupling:
- Extract Sensor class from simulator.py into sensors/sensor_wrapper.py,
  fully decoupled from Agent (no agent reference needed)
- Flat sensor registry on Simulator (sim.sensors, create_sensor,
  remove_sensor, get_sensor, render_sensors)
- Agent.sensors is now a live property backed by C++ subtree propagation
- Backward-compat aliases preserved (_sensors, add_sensor,
  get_sensor_observations)

Build Defaults:
- Default HABITAT_BUILD_GUI_VIEWERS=ON and HABITAT_WITH_BULLET=ON across
  pyproject.toml, build.sh, and CMakeLists.txt
- Updated BUILD_FROM_SOURCE.md, setup.py, CONTRIBUTING.md, and viewer
  example headers to reflect new defaults

Example Migration:
- Replace all internal API patterns (_sensors, _sensor_object, _spec,
  _Simulator__sensors) with public API (sensors, sensor_object, spec,
  node) across all viewer examples, Python tutorials, and Jupyter
  notebooks

Tests:
- New tests for sensor subtree discovery, create/remove lifecycle,
  render_sensors, registry consistency, and backward-compat aliases
@aclegg3 aclegg3 requested a review from jturner65 February 19, 2026 21:20
@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 19, 2026
Copy link
Contributor

@jturner65 jturner65 left a comment

Choose a reason for hiding this comment

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

LGTM if it passes all the test and such.

self.step_world(dt)


class Sensor:
Copy link
Contributor

Choose a reason for hiding this comment

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

YAY!

@aclegg3
Copy link
Contributor Author

aclegg3 commented Feb 20, 2026

All tests passing on sim. We expect lab tests to fail as this is a breaking change. I'll put up a lab PR to accompany this one and test off that.

aclegg3 added a commit to facebookresearch/habitat-lab that referenced this pull request Feb 20, 2026
Adapt habitat-lab to the new public sensor API from habitat-sim PR #2621
(agent-sensor-decoupling branch). Key changes:

- Replace all private _sensors dict access with public sim.sensors property
- Replace _sim._sensors[name]._sensor_object with sim.get_sensor(name).sensor_object
- Replace agent._sensors with agent.sensors (live C++ subtree view)
- Simplify instance_image_nav_task sensor lifecycle to use
  sim.remove_sensor() instead of manual multi-dict cleanup
- Remove Python name-mangling (_Simulator__sensors) from debug_visualizer
  and its tests; use sim.sensors registry directly
- Update CI workflow to build habitat-sim from the PR branch

Companion to: facebookresearch/habitat-sim#2621
aclegg3 added a commit to facebookresearch/habitat-lab that referenced this pull request Feb 20, 2026
Adapt habitat-lab to the new public sensor API from habitat-sim PR #2621
(agent-sensor-decoupling branch). Key changes:

- Replace all private _sensors dict access with public sim.sensors property
- Replace _sim._sensors[name]._sensor_object with sim.get_sensor(name).sensor_object
- Replace agent._sensors with agent.sensors (live C++ subtree view)
- Simplify instance_image_nav_task sensor lifecycle to use
  sim.remove_sensor() instead of manual multi-dict cleanup
- Remove Python name-mangling (_Simulator__sensors) from debug_visualizer
  and its tests; use sim.sensors registry directly
- Update CI workflow to build habitat-sim from the PR branch

Companion to: facebookresearch/habitat-sim#2621
@aclegg3 aclegg3 merged commit dd7900b into main Feb 21, 2026
6 of 7 checks passed
@aclegg3 aclegg3 deleted the agent-sensor-decoupling branch February 21, 2026 02:10
aclegg3 added a commit to facebookresearch/habitat-lab that referenced this pull request Feb 21, 2026
* Migrate habitat-lab to habitat-sim agent-sensor-decoupling API

Adapt habitat-lab to the new public sensor API from habitat-sim PR #2621
(agent-sensor-decoupling branch). Key changes:

- Replace all private _sensors dict access with public sim.sensors property
- Replace _sim._sensors[name]._sensor_object with sim.get_sensor(name).sensor_object
- Replace agent._sensors with agent.sensors (live C++ subtree view)
- Simplify instance_image_nav_task sensor lifecycle to use
  sim.remove_sensor() instead of manual multi-dict cleanup
- Remove Python name-mangling (_Simulator__sensors) from debug_visualizer
  and its tests; use sim.sensors registry directly
- Update CI workflow to build habitat-sim from the PR branch

Companion to: facebookresearch/habitat-sim#2621

---------

Co-authored-by: Alexander William Clegg <alexclegg@meta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants