49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
from typing import Tuple, Union
|
|
|
|
import numpy as np
|
|
|
|
from fancy_gym.black_box.raw_interface_wrapper import RawInterfaceWrapper
|
|
|
|
|
|
class MPWrapper(RawInterfaceWrapper):
|
|
|
|
mp_config = {
|
|
'ProMP': {
|
|
'controller_kwargs': {
|
|
'p_gains': 0.6,
|
|
'd_gains': 0.075,
|
|
},
|
|
},
|
|
'DMP': {
|
|
'controller_kwargs': {
|
|
'p_gains': 0.6,
|
|
'd_gains': 0.075,
|
|
},
|
|
'trajectory_generator_kwargs': {
|
|
'weights_scale': 50,
|
|
},
|
|
'phase_generator_kwargs': {
|
|
'alpha_phase': 2,
|
|
},
|
|
},
|
|
'ProDMP': {},
|
|
}
|
|
|
|
@property
|
|
def context_mask(self):
|
|
return np.hstack([
|
|
[self.env.random_start] * self.env.n_links, # cos
|
|
[self.env.random_start] * self.env.n_links, # sin
|
|
[self.env.random_start] * self.env.n_links, # velocity
|
|
[True] * 2, # x-y coordinates of target distance
|
|
[False] # env steps
|
|
])
|
|
|
|
@property
|
|
def current_pos(self) -> Union[float, int, np.ndarray, Tuple]:
|
|
return self.env.current_pos
|
|
|
|
@property
|
|
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
|
|
return self.env.current_vel
|