unilab.base.entity.EntityScene

class unilab.base.entity.EntityScene[source]

Bases: Mapping[str, Entity]

Read-only name-addressable collection of backend-bound entities.

Parameters:

Methods

__init__(entities, backend[, ...])

bind_gravity_write(*, term_name)

Bind immutable backend gravity for a reset event on the cold path.

bind_gravity_write_tensor(*, term_name, device)

Bind immutable backend gravity as a tensor table for tensor events.

bind_sensor_data(names)

Bind existing backend sensors for a manager term on the cold path.

compile_tensor_reads(device, specs)

Compile the scene's only packed tensor read layout for one device.

env_origins(device)

Return immutable per-environment origins as a cached tensor table.

from_scene_cfg(cfg, backend[, ...])

get(k[,d])

items()

keys()

reset_to_default(reset_mask, *, term_name)

Stage a full-scene default state in the active mask transaction.

values()

write_gravity_to_sim(values, env_ids, *, ...)

Stage gravity values in the exactly-once reset transaction.

Attributes

entities

Pinned community-style read-only entity mapping.

__init__(entities, backend, control_buffer=None, *, reset_state=None, default_qpos=None)[source]
Parameters:
classmethod from_scene_cfg(cfg, backend, control_buffer=None, *, reset_state=None, default_qpos=None)[source]
Parameters:
Return type:

EntityScene

property entities: Mapping[str, Entity]

Pinned community-style read-only entity mapping.

env_origins(device)[source]

Return immutable per-environment origins as a cached tensor table.

Parameters:

device (str | device)

Return type:

Tensor

compile_tensor_reads(device, specs)[source]

Compile the scene’s only packed tensor read layout for one device.

HOST_BRIDGE execution aggregates every entity’s sensors and canonical body views into one public TensorIOSpec, so a read phase performs one H2D transfer. DEVICE_RESIDENT execution keeps stable backend views but exposes the same phase API; manager terms therefore do not branch on the backend topology.

Parameters:
Return type:

SceneTensorReadPlan

reset_to_default(reset_mask, *, term_name)[source]

Stage a full-scene default state in the active mask transaction.

Parameters:
Return type:

None

bind_gravity_write(*, term_name)[source]

Bind immutable backend gravity for a reset event on the cold path.

Parameters:

term_name (str)

Return type:

ndarray

bind_gravity_write_tensor(*, term_name, device)[source]

Bind immutable backend gravity as a tensor table for tensor events.

Parameters:
Return type:

Tensor

get(k[, d]) → D[k] if k in D, else d.  d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values
write_gravity_to_sim(values, env_ids, *, term_name)[source]

Stage gravity values in the exactly-once reset transaction.

Parameters:
Return type:

None

bind_sensor_data(names)[source]

Bind existing backend sensors for a manager term on the cold path.

The returned view owns the backend-specific reader. Terms retain that view and only call SensorView.read() while stepping, so the scene facade never exposes a backend model, data object, or native handle.

Parameters:

names (Sequence[str])

Return type:

SensorView

__getitem__(name)[source]
Parameters:

name (str)

Return type:

Entity

__len__()[source]
Return type:

int