Skip to content

unienv_interface.remote.proxies

Local Env / World / WorldNode / DataTransformation views of objects hosted by a server.

Every method is one remote call. Spaces, timings and metadata come from the server's descriptor; spaces are refreshed whenever a reset changed them. close() on a proxy does nothing: hosted objects belong to the server.

Components mode is a plain local WorldEnv over remote proxies (host them with server.register_recursive("sim", env))::

env = WorldEnv(client.world("sim/world"), client.node("sim/node"))

RemoteEnv

RemoteEnv(client: RemoteClient, name: str)

Bases: _Remote, Env

An Env hosted by a :class:RemoteServer.

rng instance-attribute

rng = self.backend.random.random_number_generator(device=self.device)

metadata class-attribute instance-attribute

metadata: dict[str, Any] = {'render_modes': []}

render_mode class-attribute instance-attribute

render_mode: Optional[str] = None

render_fps class-attribute instance-attribute

render_fps: Optional[int] = None

backend instance-attribute

backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]

device instance-attribute

device: Optional[BDeviceType]

batch_size class-attribute instance-attribute

batch_size: Optional[int] = None

action_space instance-attribute

action_space: Space[ActType, BDeviceType, BDtypeType, BRNGType]

observation_space instance-attribute

observation_space: Space[ObsType, BDeviceType, BDtypeType, BRNGType]

context_space class-attribute instance-attribute

context_space: Optional[Space[ContextType, BDeviceType, BDtypeType, BRNGType]] = None

unwrapped property

unwrapped: Env

prev_wrapper_layer property

prev_wrapper_layer: Optional[Env]

client instance-attribute

client: RemoteClient

remote_name instance-attribute

remote_name: str

reset

reset(*, mask: Any = None, seed: Optional[int] = None, **kwargs: Any) -> Any

reload

reload(*, mask: Any = None, seed: Optional[int] = None, **kwargs: Any) -> Any

step

step(action: Any) -> Any

render

render() -> Any

get_node

get_node(nested_keys: Union[str, Sequence[str]]) -> Optional[RemoteWorldNode]

Node proxy by key path, for envs built on a WorldEnv.

close

close() -> None

No-op: the hosted object stays open (it is closed by its server).

sample_space

sample_space(space: Space) -> Any

Sample from space using and updating self.rng.

sample_action

sample_action() -> ActType

Sample one action from action_space.

sample_observation

sample_observation() -> ObsType

Sample one observation from observation_space.

sample_context

sample_context() -> Optional[ContextType]

Sample one context value if context_space is defined.

update_observation_post_reset

update_observation_post_reset(old_obs: ObsType, newobs_masked: ObsType, mask: BArrayType) -> ObsType

Merge masked reset observations back into a full batched observation.

update_context_post_reset

update_context_post_reset(old_context: ContextType, new_context: ContextType, mask: BArrayType) -> ContextType

Merge masked reset contexts back into a full batched context.

has_wrapper_attr

has_wrapper_attr(name: str) -> bool

Checks if the attribute name exists in the environment.

get_wrapper_attr

get_wrapper_attr(name: str) -> Any

Gets the attribute name from the environment.

set_wrapper_attr

set_wrapper_attr(name: str, value: Any)

Sets the attribute name on the environment with value.

RemoteWorld

RemoteWorld(client: RemoteClient, name: str)

Bases: _Remote, World

A World hosted by a :class:RemoteServer.

world_timestep class-attribute instance-attribute

world_timestep: Optional[float] = None

backend instance-attribute

backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]

device instance-attribute

device: Optional[BDeviceType]

The world timestep in seconds, if None, the world is asynchronous (real-time)

world_subtimestep class-attribute instance-attribute

world_subtimestep: Optional[float] = None

The number of parallel environments in this world

batch_size class-attribute instance-attribute

batch_size: Optional[int] = None

client instance-attribute

client: RemoteClient

remote_name instance-attribute

remote_name: str

step

step() -> Any

reset

reset(*, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

reload

reload(*, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

after_reset

after_reset(*, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

after_reload

after_reload(*, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

close

close() -> None

No-op: the hosted object stays open (it is closed by its server).

is_control_timestep_compatible

is_control_timestep_compatible(control_timestep: Optional[float]) -> bool

Check whether a node control period aligns with world_timestep.

RemoteWorldNode

RemoteWorldNode(client: RemoteClient, name: str)

Bases: _Remote, WorldNode

A WorldNode hosted by a :class:RemoteServer.

world instance-attribute

world = None if world is None else client.world(world)

backend property

backend: ComputeBackend

device property

device: Any

nodes property

nodes: List[RemoteWorldNode]

Proxies of the child nodes (empty for a leaf node).

name instance-attribute

name: str

control_timestep class-attribute instance-attribute

control_timestep: Optional[float] = None

update_timestep class-attribute instance-attribute

update_timestep: Optional[float] = None

context_space class-attribute instance-attribute

context_space: Optional[Space[ContextType, BDeviceType, BDtypeType, BRNGType]] = None

observation_space class-attribute instance-attribute

observation_space: Optional[Space[ObsType, BDeviceType, BDtypeType, BRNGType]] = None

action_space class-attribute instance-attribute

action_space: Optional[Space[ActType, BDeviceType, BDtypeType, BRNGType]] = None

has_reward class-attribute instance-attribute

has_reward: bool = False

has_termination_signal class-attribute instance-attribute

has_termination_signal: bool = False

has_truncation_signal class-attribute instance-attribute

has_truncation_signal: bool = False

supported_render_modes class-attribute instance-attribute

supported_render_modes: Sequence[str] = ()

render_mode class-attribute instance-attribute

render_mode: Optional[str] = None

reset_priorities class-attribute instance-attribute

reset_priorities: Set[int] = set()

reload_priorities class-attribute instance-attribute

reload_priorities: Set[int] = set()

after_reset_priorities class-attribute instance-attribute

after_reset_priorities: Set[int] = set()

after_reload_priorities class-attribute instance-attribute

after_reload_priorities: Set[int] = set()

pre_environment_step_priorities class-attribute instance-attribute

pre_environment_step_priorities: Set[int] = set()

post_environment_step_priorities class-attribute instance-attribute

post_environment_step_priorities: Set[int] = set()

can_render property

can_render: bool

Whether the node currently exposes a render mode.

effective_update_timestep property

effective_update_timestep: Optional[float]

Resolved update period, defaulting to control_timestep when unset.

unwrapped property

unwrapped: WorldNode

prev_wrapper_layer property

prev_wrapper_layer: Optional[WorldNode]

client instance-attribute

client: RemoteClient

remote_name instance-attribute

remote_name: str

reset

reset(*, priority: int = 0, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

reload

reload(*, priority: int = 0, seed: Optional[int] = None, mask: Any = None, **kwargs: Any) -> None

after_reset

after_reset(*, priority: int = 0, mask: Any = None) -> None

after_reload

after_reload(*, priority: int = 0, mask: Any = None) -> None

pre_environment_step

pre_environment_step(dt: Any, *, priority: int = 0) -> None

post_environment_step

post_environment_step(dt: Any, *, priority: int = 0) -> None

set_next_action

set_next_action(action: Any) -> None

get_context

get_context() -> Any

get_observation

get_observation() -> Any

get_reward

get_reward() -> Any

get_termination

get_termination() -> Any

get_truncation

get_truncation() -> Any

get_info

get_info() -> Any

render

render() -> Any

get_node

get_node(nested_keys: Union[str, Sequence[str]]) -> Optional[RemoteWorldNode]

get_nodes_by_fn

get_nodes_by_fn(fn: Callable[[WorldNode], bool]) -> List[WorldNode]

get_nodes_by_type

get_nodes_by_type(node_type: Type[WorldNode]) -> list[WorldNode]

Return nodes in this subtree that are instances of node_type.

close

close() -> None

No-op: the hosted object stays open (it is closed by its server).

has_wrapper_attr

has_wrapper_attr(name: str) -> bool

Checks if the attribute name exists in the environment.

get_wrapper_attr

get_wrapper_attr(name: str) -> Any

Gets the attribute name from the environment.

set_wrapper_attr

set_wrapper_attr(name: str, value: Any)

Sets the attribute name on the environment with value.

RemoteDataTransformation

RemoteDataTransformation(client: RemoteClient, name: str)

Bases: _Remote, DataTransformation

A DataTransformation hosted by a :class:RemoteServer.

transform and get_target_space_from_source run on the server: the source space and the data are rebuilt there on the backend / device the transformation was registered with, and the result comes back on the client's. Use it to run a transformation whose dependencies live in another environment (e.g. a grasp synthesizer pinned to an old CUDA toolchain).

The proxy has no inverse and cannot be serialized: it is bound to its connection (serialize the hosted transformation on the server instead).

has_inverse class-attribute instance-attribute

has_inverse = False

client instance-attribute

client: RemoteClient

remote_name instance-attribute

remote_name: str

get_target_space_from_source

get_target_space_from_source(source_space: Any) -> Any

transform

transform(source_space: Any, data: Any) -> Any

serialize

serialize(source_space: Any = None) -> Dict[str, Any]

deserialize_from classmethod

deserialize_from(json_data: Dict[str, Any], source_space: Any = None) -> RemoteDataTransformation

direction_inverse

direction_inverse(source_space: Optional[Space[SourceDataT, SourceBDeviceT, SourceBDTypeT, SourceBDRNGT]] = None) -> Optional[DataTransformation]

Return the inverse transformation when one exists.

close

close() -> None

No-op: the hosted object stays open (it is closed by its server).