-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput_help.log
More file actions
370 lines (368 loc) · 20.8 KB
/
output_help.log
File metadata and controls
370 lines (368 loc) · 20.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
Help on class BaseEnv in module mani_skill.envs.sapien_env:
class BaseEnv(gymnasium.core.Env)
| BaseEnv(num_envs: int = 1, obs_mode: Optional[str] = None, reward_mode: Optional[str] = None, control_mode: Optional[str] = None, render_mode: Optional[str] = None, shader_dir: Optional[str] = None, enable_shadow: bool = False, sensor_configs: Optional[dict] = {}, human_render_camera_configs: Optional[dict] = {}, viewer_camera_configs: Optional[dict] = {}, robot_uids: Union[str, mani_skill.agents.base_agent.BaseAgent, List[Union[str, mani_skill.agents.base_agent.BaseAgent]]] = None, sim_config: Union[mani_skill.utils.structs.types.SimConfig, dict] = {}, reconfiguration_freq: Optional[int] = None, sim_backend: str = 'auto', render_backend: str = 'gpu', parallel_in_single_scene: bool = False, enhanced_determinism: bool = False)
|
| Superclass for ManiSkill environments.
|
| Args:
| num_envs: number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1,
| then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of
| GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.
|
| gpu_sim_backend: The GPU simulation backend to use (only used if the given num_envs argument is > 1). This affects the type of tensor
| returned by the environment for e.g. observations and rewards. Can be "torch" or "jax". Default is "torch"
|
| obs_mode: observation mode to be used. Must be one of ("state", "state_dict", "none", "sensor_data", "rgb", "depth", "segmentation", "rgbd", "rgb+depth", "rgb+depth+segmentation", "rgb+segmentation", "depth+segmentation", "pointcloud")
| The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unecesary rendering.
| For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)
|
| reward_mode: reward mode to use. Must be one of ("normalized_dense", "dense", "sparse", "none"). With "none" the reward returned is always 0
|
| control_mode: control mode of the agent.
| "*" represents all registered controllers, and the action space will be a dict.
|
| render_mode: render mode registered in @SUPPORTED_RENDER_MODES.
|
| shader_dir (Optional[str]): shader directory. Defaults to None.
| Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility.
| The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.
|
|
| Previously the options are "default", "rt", "rt-fast". "rt" means ray-tracing which results
| in more photorealistic renders but is slow, "rt-fast" is a lower quality but faster version of "rt".
|
| enable_shadow (bool): whether to enable shadow for lights. Defaults to False.
|
| sensor_configs (dict): configurations of sensors to override any environment defaults.
| If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor.
| Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations
| see the documentation see :doc:`the sensors documentation </user_guide/tutorials/sensors/index>`.
|
| human_render_camera_configs (dict): configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.
|
| viewer_camera_configs (dict): configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.
|
| robot_uids (Union[str, BaseAgent, List[Union[str, BaseAgent]]]): List of robots to instantiate and control in the environment.
|
| sim_config (Union[SimConfig, dict]): Configurations for simulation if used that override the environment defaults. If given
| a dictionary, it can just override specific attributes e.g. ``sim_config=dict(scene_config=dict(solver_iterations=25))``. If
| passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments
| define their own recommended default sim configurations via the ``self._default_sim_config`` attribute that generally should not be
| completely overriden.
|
| reconfiguration_freq (int): How frequently to call reconfigure when environment is reset via `self.reset(...)`
| Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means
| the environment reconfigures upon creation, and never again.
|
| sim_backend (str): By default this is "auto". If sim_backend is "auto", then if ``num_envs == 1``, we use the CPU sim backend, otherwise
| we use the GPU sim backend and automatically pick a GPU to use.
| Can also be "cpu" or "gpu" to force usage of a particular sim backend.
| To select a particular GPU to run the simulation on, you can pass "cuda:n" where n is the ID of the GPU,
| similar to the way PyTorch selects GPUs.
| Note that if this is "cpu", num_envs can only be equal to 1.
|
| render_backend (str): By default this is "gpu". If render_backend is "gpu", then we auto select a GPU to render with.
| It can be "cuda:n" where n is the ID of the GPU to render with. If this is "cpu", then we render on the CPU.
|
| parallel_in_single_scene (bool): By default this is False. If True, rendered images and the GUI will show all objects in one view.
| This is only really useful for generating cool videos showing all environments at once but it is not recommended
| otherwise as it slows down simulation and rendering.
|
| enhanced_determinism (bool): By default this is False and env resets will reset the episode RNG only when a seed / seed list is given.
| If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided.
| Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.
|
| Method resolution order:
| BaseEnv
| gymnasium.core.Env
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, num_envs: int = 1, obs_mode: Optional[str] = None, reward_mode: Optional[str] = None, control_mode: Optional[str] = None, render_mode: Optional[str] = None, shader_dir: Optional[str] = None, enable_shadow: bool = False, sensor_configs: Optional[dict] = {}, human_render_camera_configs: Optional[dict] = {}, viewer_camera_configs: Optional[dict] = {}, robot_uids: Union[str, mani_skill.agents.base_agent.BaseAgent, List[Union[str, mani_skill.agents.base_agent.BaseAgent]]] = None, sim_config: Union[mani_skill.utils.structs.types.SimConfig, dict] = {}, reconfiguration_freq: Optional[int] = None, sim_backend: str = 'auto', render_backend: str = 'gpu', parallel_in_single_scene: bool = False, enhanced_determinism: bool = False)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_to_state_dict_registry(self, object: Union[mani_skill.utils.structs.actor.Actor, mani_skill.utils.structs.articulation.Articulation])
|
| capture_sensor_data(self)
| Capture data from all sensors (non-blocking)
|
| close(self)
| After the user has finished using the environment, close contains the code necessary to "clean up" the environment.
|
| This is critical for closing rendering windows, database or HTTP connections.
| Calling ``close`` on an already closed environment has no effect and won't raise an error.
|
| compute_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict)
|
| compute_normalized_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict)
|
| compute_sparse_reward(self, obs: Any, action: torch.Tensor, info: Dict)
| Computes the sparse reward. By default this function tries to use the success/fail information in
| returned by the evaluate function and gives +1 if success, -1 if fail, 0 otherwise
|
| evaluate(self) -> dict
| Evaluate whether the environment is currently in a success state by returning a dictionary with a "success" key or
| a failure state via a "fail" key
|
| This function may also return additional data that has been computed (e.g. is the robot grasping some object) that may be
| reused when generating observations and rewards.
|
| By default if not overriden this function returns an empty dictionary
|
| get_info(self) -> dict
| Get info about the current environment state, include elapsed steps and evaluation information
|
| get_obs(self, info: Optional[Dict] = None)
| Return the current observation of the environment. User may call this directly to get the current observation
| as opposed to taking a step with actions in the environment.
|
| Note that some tasks use info of the current environment state to populate the observations to avoid having to
| compute slow operations twice. For example a state based observation may wish to include a boolean indicating
| if a robot is grasping an object. Computing this boolean correctly is slow, so it is preferable to generate that
| data in the info object by overriding the `self.evaluate` function.
|
| Args:
| info (Dict): The info object of the environment. Generally should always be the result of `self.get_info()`.
| If this is None (the default), this function will call `self.get_info()` itself
|
| get_reward(self, obs: Any, action: torch.Tensor, info: Dict)
|
| get_sensor_images(self) -> Dict[str, Dict[str, torch.Tensor]]
| Get image (RGB) visualizations of what sensors currently sense. This function calls self._get_obs_sensor_data() internally which automatically hides objects and updates the render
|
| get_sensor_params(self) -> Dict[str, Dict[str, torch.Tensor]]
| Get all sensor parameters.
|
| get_state(self)
| Get environment state as a flat vector, which is just a ordered flattened version of the state_dict.
|
| Users should not override this function
|
| get_state_dict(self)
| Get environment state dictionary. Override to include task information (e.g., goal)
|
| observation_space = <functools.cached_property object>
| the batched observation space of the environment
|
| print_sim_details(self)
| Debug tool to call to simply print a bunch of details about the running environment, including the task ID, number of environments, sim backend, etc.
|
| remove_from_state_dict_registry(self, object: Union[mani_skill.utils.structs.actor.Actor, mani_skill.utils.structs.articulation.Articulation])
|
| render(self)
| Either opens a viewer if ``self.render_mode`` is "human", or returns an array that you can use to save videos.
|
| If ``self.render_mode`` is "rgb_array", usually a higher quality image is rendered for the purpose of viewing only.
|
| If ``self.render_mode`` is "sensors", all visual observations the agent can see is provided
|
| If ``self.render_mode`` is "all", this is then a combination of "rgb_array" and "sensors"
|
| render_all(self)
| Renders all human render cameras and sensors together
|
| render_human(self)
| render the environment by opening a GUI viewer. This also returns the viewer object. Any objects registered in the _hidden_objects list will be shown
|
| render_rgb_array(self, camera_name: str = None)
| Returns an RGB array / image of size (num_envs, H, W, 3) of the current state of the environment.
| This is captured by any of the registered human render cameras. If a camera_name is given, only data from that camera is returned.
| Otherwise all camera data is captured and returned as a single batched image. Any objects registered in the _hidden_objects list will be shown
|
| render_sensors(self)
| Renders all sensors that the agent can use and see and displays them in a human readable image format.
| Any objects registered in the _hidden_objects list will not be shown
|
| reset(self, seed: Union[NoneType, int, list[int]] = None, options: Optional[dict] = None)
| Reset the ManiSkill environment with given seed(s) and options. Typically seed is either None (for unseeded reset) or an int (seeded reset).
| For GPU parallelized environments you can also pass a list of seeds for each parallel environment to seed each one separately.
|
| If options["env_idx"] is given, will only reset the selected parallel environments. If
| options["reconfigure"] is True, will call self._reconfigure() which deletes the entire physx scene and reconstructs everything.
| Users building custom tasks generally do not need to override this function.
|
| Returns the first observation and a info dictionary. The info dictionary is of type
|
|
| .. highlight:: python
| .. code-block:: python
|
| {
| "reconfigure": bool # (True if the env reconfigured. False otherwise)
| }
|
|
|
| Note that ManiSkill always holds two RNG states, a main RNG, and an episode RNG. The main RNG is used purely to sample an episode seed which
| helps with reproducibility of episodes and is for internal use only. The episode RNG is used by the environment/task itself to
| e.g. randomize object positions, randomize assets etc. Episode RNG is accessible by using `self._batched_episode_rng` which is numpy based and `torch.rand`
| which can be used to generate random data on the GPU directly and is seeded. Note that it is recommended to use `self._batched_episode_rng`
| if you need to ensure during reconfiguration the same objects are loaded. Reproducibility and seeding when there is GPU and CPU simulation can be tricky and we recommend reading
| the documentation for more recommendations and details on RNG https://maniskill.readthedocs.io/en/latest/user_guide/concepts/rng.html
|
| Upon environment creation via gym.make, the main RNG is set with fixed seeds of 2022 to 2022 + num_envs - 1 (seed is just 2022 if there is only one environment)
| During each reset call, if seed is None, main RNG is unchanged and an episode seed is sampled from the main RNG to create the episode RNG.
| If seed is not None, main RNG is set to that seed and the episode seed is also set to that seed. This design means the main RNG determines
| the episode RNG deterministically.
|
| segmentation_id_map = <functools.cached_property object>
| Returns a dictionary mapping every ID to the appropriate Actor or Link object
|
| set_state(self, state: Union[torch.Tensor, numpy.ndarray, Sequence], env_idx: torch.Tensor = None)
| Set environment state with a flat state vector. Internally this reconstructs the state dictionary and calls `env.set_state_dict`
|
| Users should not override this function
|
| set_state_dict(self, state: Dict, env_idx: torch.Tensor = None)
| Set environment state with a state dictionary. Override to include task information (e.g., goal)
|
| Note that it is recommended to keep around state dictionaries as opposed to state vectors. With state vectors we assume
| the order of data in the vector is the same exact order that would be returned by flattening the state dictionary you get from
| `env.get_state_dict()` or the result of `env.get_state()`
|
| single_observation_space = <functools.cached_property object>
| the unbatched observation space of the environment
|
| step(self, action: Union[NoneType, numpy.ndarray, torch.Tensor, Dict])
| Take a step through the environment with an action. Actions are automatically clipped to the action space.
|
| If ``action`` is None, the environment will proceed forward in time without sending any actions/control signals to the agent
|
| update_obs_space(self, obs: torch.Tensor)
| A convenient function to auto generate observation spaces if you modify them.
| Call this function if you modify the observations returned by env.step and env.reset via an observation wrapper.
|
| The recommended way to use this is in a observation wrapper is as so
|
| .. code-block:: python
|
| import gymnasium as gym
| from mani_skill.envs.sapien_env import BaseEnv
| class YourObservationWrapper(gym.ObservationWrapper):
| def __init__(self, env):
| super().__init__(env)
| self.base_env.update_obs_space(self.observation(self.base_env._init_raw_obs))
| @property
| def base_env(self) -> BaseEnv:
| return self.env.unwrapped
| def observation(self, obs):
| # your code for transforming the observation
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| control_freq
| The frequency (Hz) of the control loop
|
| control_mode
| The control mode of the agent
|
| control_timestep
| The timestep (dt) of the control loop
|
| elapsed_steps
| The number of steps that have elapsed in the environment
|
| gpu_sim_enabled
| Whether the gpu simulation is enabled.
|
| obs_mode
| The current observation mode. This affects the observation returned by env.get_obs()
|
| reward_mode
|
| robot_link_names
| Get link ids for the robot. This is used for segmentation observations.
|
| sim_freq
| The frequency (Hz) of the simulation loop
|
| sim_timestep
| The timestep (dt) of the simulation loop
|
| viewer
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| SUPPORTED_OBS_MODES = ('state', 'state_dict', 'none', 'sensor_data', '...
|
| SUPPORTED_RENDER_MODES = ('human', 'rgb_array', 'sensors', 'all')
|
| SUPPORTED_REWARD_MODES = ('normalized_dense', 'dense', 'sparse', 'none...
|
| SUPPORTED_ROBOTS = None
|
| __annotations__ = {'SUPPORTED_ROBOTS': typing.List[typing.Union[str, t...
|
| __parameters__ = ()
|
| metadata = {'render_modes': ('human', 'rgb_array', 'sensors', 'all')}
|
| scene = None
|
| ----------------------------------------------------------------------
| Methods inherited from gymnasium.core.Env:
|
| __enter__(self)
| Support with-statement for the environment.
|
| __exit__(self, *args: 'Any')
| Support with-statement for the environment and closes the environment.
|
| __str__(self)
| Returns a string of the environment with :attr:`spec` id's if :attr:`spec.
|
| Returns:
| A string identifying the environment
|
| get_wrapper_attr(self, name: 'str') -> 'Any'
| Gets the attribute `name` from the environment.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from gymnasium.core.Env:
|
| unwrapped
| Returns the base non-wrapped environment.
|
| Returns:
| Env: The base non-wrapped :class:`gymnasium.Env` instance
|
| ----------------------------------------------------------------------
| Data descriptors inherited from gymnasium.core.Env:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| np_random
| Returns the environment's internal :attr:`_np_random` that if not set will initialise with a random seed.
|
| Returns:
| Instances of `np.random.Generator`
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from gymnasium.core.Env:
|
| __orig_bases__ = (typing.Generic[~ObsType, ~ActType],)
|
| render_mode = None
|
| reward_range = (-inf, inf)
|
| spec = None
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(params) from builtins.type
|
| __init_subclass__(*args, **kwargs) from builtins.type
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.