Documnenting merging behavior for mp_configs (and remove TODOs)

This commit is contained in:
Dominik Moritz Roth 2023-10-11 12:35:23 +02:00
parent bc150f5a4d
commit 757072c762
2 changed files with 29 additions and 4 deletions

View File

@ -177,7 +177,7 @@ import numpy as np
class RawInterfaceWrapper(gym.Wrapper):
mp_config = { # Default configurations for MPs can be overitten by defining attributes here.
mp_config = {
'ProMP': {},
'DMP': {},
'ProDMP': {},
@ -222,6 +222,34 @@ class RawInterfaceWrapper(gym.Wrapper):
```
Default configurations for MPs can be overitten by defining attributes in mp_config.
Available parameters are documented in the [MP_PyTorch Userguide](https://github.com/ALRhub/MP_PyTorch/blob/main/doc/README.md).
```python
class RawInterfaceWrapper(gym.Wrapper):
mp_config = {
'ProMP': {
'phase_generator_kwargs': {
'phase_generator_type': 'linear'
# When selecting another generator type, the default configuration will not be merged for the attribute.
},
'controller_kwargs': {
'p_gains': 0.5 * np.array([1.0, 4.0, 2.0, 4.0, 1.0, 4.0, 1.0]),
'd_gains': 0.5 * np.array([0.1, 0.4, 0.2, 0.4, 0.1, 0.4, 0.1]),
},
'basis_generator_kwargs': {
'num_basis': 3,
'num_basis_zero_start': 1,
'num_basis_zero_goal': 1,
},
},
'DMP': {},
'ProDMP': {}.
}
[...]
```
If you created a new task wrapper, feel free to open a PR, so we can integrate it for others to use as well. Without the
integration the task can still be used. A rough outline can be shown here, for more details we recommend having a look
at the [examples](fancy_gym/examples/).

View File

@ -8,7 +8,6 @@ from collections import defaultdict
from collections.abc import Mapping, MutableMapping
from fancy_gym.utils.make_env_helpers import make_bb
# from fancy_gym.utils.utils import nested_update
from fancy_gym.black_box.raw_interface_wrapper import RawInterfaceWrapper
from gymnasium import register as gym_register
@ -238,8 +237,6 @@ def register_mp(id: str, base_id: str, mp_wrapper: RawInterfaceWrapper, mp_type:
MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS[ns][mp_type].append(fancy_id)
MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS[ns]['all'].append(fancy_id)
# TODO: Apply inherit_defaults: False to appropiate places and remove this...
def nested_update(base: MutableMapping, update):
"""