Repository navigation
feat: route sensors by entity_name (M3.6 / ADR-0012 S4) - #138
Merged
Merged
Conversation
Sensors gain SensorCfg.entity_name (default "robot") and attach to / read from the named scene entity instead of the singular accessors. - sensor/_entity.py (new): entity_handle / entity_state / entity_articulation resolve env.articulations[entity_name] with a primary fallback (env.robot / env.robot_state / env.articulation, then env itself for minimal fakes). Lives in the sensor layer because mdp._helpers imports sensor.contact — a sensor importing it back would cycle. - All nine sensors (camera, force_torque, contact, self_contact, imu, ray_cast, body_velocity, frame_transformer, angular_momentum) reach their entity's gs_handle / RobotState / articulation via entity_name, and resolve link/joint indices against that entity's name tables (not the primary's) for heterogeneous-multi-robot correctness. Backward-compatible: entity_name defaults to primary "robot"; single-robot scenes unchanged (managers/scene wire sensors as before). Test fakes: the FT fake articulation gains joint_names (real entity has it); camera/FT error-message wording dropped the "env." prefix. Gates: ruff ✓, ruff format ✓ (full repo), pyright 0/0/0, lint-imports 6 kept / 0 broken, full suite 464 passed (+2). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KraHsu
added a commit
that referenced
this pull request
Jun 5, 2026
feat: route sensors by entity_name (M3.6 / ADR-0012 S4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Slice S4 — sensors gain
SensorCfg.entity_name(default"robot") and attach to / readfrom the named scene entity. Backward-compatible (default → primary; single-robot
scenes unchanged).
sensor/_entity.py(new):entity_handle/entity_state/entity_articulationresolve
env.articulations[entity_name]with a primary fallback. It lives in the sensorlayer on purpose —
mdp._helpersimportssensor.contact, so a sensor importing it backwould form a cycle.
camera,force_torque,contact,self_contact,imu,ray_cast,body_velocity,frame_transformer,angular_momentum) now reach their entity'sgs_handle/RobotState/ articulation and resolve their link/joint indicesagainst that entity's name tables (not the primary's) — correct for heterogeneous robots.
Reviewer-caught regressions (fixed)
The full suite earned its keep again:
entity_articulationfirst fell back toenv.articulationdirectly → 67 failures fromminimal fakes that expose
link_namesat env-level. Fixed togetattr(env, "articulation", env)(matching
mdp.resolve_articulation).joint_names(FT now resolves joints against the entity) → gaveit
joint_names.env.link_names→link_names).Tests
tests/test_multi_robot.py+2 — resolver selection/fallback + aForceTorqueSensorwithentity_name="robot_b"resolving/reading that entity. All sensor suites green.Gates
🤖 Generated with Claude Code