2022-06-30 14:20:52 +02:00
|
|
|
from typing import Union, Tuple
|
2022-01-25 15:23:57 +01:00
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
|
2022-06-30 17:33:05 +02:00
|
|
|
from alr_envs.black_box.raw_interface_wrapper import RawInterfaceWrapper
|
2022-01-25 15:23:57 +01:00
|
|
|
|
2022-06-30 14:08:54 +02:00
|
|
|
|
|
|
|
class MPWrapper(RawInterfaceWrapper):
|
2022-01-25 15:23:57 +01:00
|
|
|
|
|
|
|
@property
|
2022-06-30 14:20:52 +02:00
|
|
|
def context_mask(self):
|
2022-01-25 15:23:57 +01:00
|
|
|
return np.concatenate([
|
2022-06-30 14:20:52 +02:00
|
|
|
[False] * self.env.n_links, # cos
|
|
|
|
[False] * self.env.n_links, # sin
|
2022-01-25 15:23:57 +01:00
|
|
|
[True] * 2, # goal position
|
2022-06-30 14:20:52 +02:00
|
|
|
[False] * self.env.n_links, # angular velocity
|
2022-04-07 14:40:43 +02:00
|
|
|
[False] * 3, # goal distance
|
2022-01-25 15:23:57 +01:00
|
|
|
# self.get_body_com("target"), # only return target to make problem harder
|
2022-04-07 14:40:43 +02:00
|
|
|
[False], # step
|
2022-01-25 15:23:57 +01:00
|
|
|
])
|
|
|
|
|
|
|
|
@property
|
2022-06-30 14:20:52 +02:00
|
|
|
def current_pos(self) -> Union[float, int, np.ndarray, Tuple]:
|
|
|
|
return self.env.sim.data.qpos.flat[:self.env.n_links]
|
2022-01-25 15:23:57 +01:00
|
|
|
|
|
|
|
@property
|
2022-06-30 14:20:52 +02:00
|
|
|
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
|
|
|
|
return self.env.sim.data.qvel.flat[:self.env.n_links]
|