gym_utils
GymObservable
Simple class interface for observable objects. These objects should implement a way to grab observations, (get_obs()), and should define an observation space that is created when load_observation_space() is called
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs |
dict, does nothing, used to sink any extraneous arguments during initialization |
{}
|
Source code in omnigibson/utils/gym_utils.py
get_obs(**kwargs)
abstractmethod
Get observations for the object. Note that the shape / nested structure should match that of @self.observation_space!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs |
dict
|
Any keyword args necessary for grabbing observations |
{}
|
Returns:
Name | Type | Description |
---|---|---|
dict | Keyword-mapped observations mapping observation names to nested observations |
Source code in omnigibson/utils/gym_utils.py
load_observation_space()
Load the observation space internally, and also return this value
Returns:
Type | Description |
---|---|
gym.spaces.Dict: Loaded observation space for this object |
Source code in omnigibson/utils/gym_utils.py
recursively_generate_flat_dict(dic, prefix=None)
Helper function to recursively iterate through dictionary / gym.spaces.Dict @dic and flatten any nested elements, such that the result is a flat dictionary mapping keys to values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dic |
dict or gym.spaces.Dict
|
(Potentially nested) dictionary to convert into a flattened dictionary |
required |
prefix |
None or str
|
Prefix to append to the beginning of all strings in the flattened dictionary. None results in no prefix being applied |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict | Flattened version of @dic |