def __init__(self,
                 task='hfield',
                 reset_every_episode=False,
                 reward=True,
                 max_timesteps=1000,
                 *args,
                 **kwargs):
        Serializable.quick_init(self, locals())

        self.cripple_mask = None
        self.reset_every_episode = reset_every_episode
        self.first = True
        self.timesteps = 0
        self.max_timesteps = max_timesteps
        MujocoEnv.__init__(
            self,
            os.path.join(os.path.abspath(os.path.dirname(__file__)), "assets",
                         "half_cheetah_hfield.xml"))

        task = None if task == 'None' else task

        self._init_geom_rgba = self.model.geom_rgba.copy()
        self._init_geom_contype = self.model.geom_contype.copy()
        self._init_geom_size = self.model.geom_size.copy()
        self._init_geom_pos = self.model.geom_pos.copy()
        self.dt = self.model.opt.timestep

        assert task in [None, 'hfield', 'hill', 'basin', 'steep', 'gentle']

        self.task = task
        self.x_walls = np.array([250, 260, 261, 270, 280, 285])
        self.height_walls = np.array([0.2, 0.2, 0.2, 0.2, 0.2, 0.2])
        self.height = 0.8
        self.width = 15
    def __init__(self,
                 task='force',
                 reset_every_episode=False,
                 fixed_goal=False):
        Serializable.quick_init(self, locals())

        self.reset_every_episode = reset_every_episode
        self.first = True
        self.fixed_goal = fixed_goal
        MujocoEnv.__init__(
            self,
            os.path.join(os.path.abspath(os.path.dirname(__file__)), "assets",
                         "arm_7dof.xml"))
        task = None if task == 'None' else task

        self.cripple_mask = np.ones(self.action_space.shape)

        self._init_geom_rgba = self.model.geom_rgba.copy()
        self._init_geom_contype = self.model.geom_contype.copy()
        self._init_geom_size = self.model.geom_size.copy()
        self._init_body_pos = self.model.body_pos.copy()
        self._init_body_masses = self.model.body_mass.copy()
        self._init_geom_pos = self.model.geom_pos.copy()
        self.dt = self.model.opt.timestep

        assert task in [None, 'cripple', 'damping', 'mass', 'force']

        self.task = task
    def __init__(self,
                 task='damping',
                 reset_every_episode=False,
                 max_timesteps=1000):
        Serializable.quick_init(self, locals())

        self.reset_every_episode = reset_every_episode
        self.first = True
        self.timesteps = 0
        self.max_timesteps = max_timesteps
        MujocoEnv.__init__(
            self,
            os.path.join(os.path.abspath(os.path.dirname(__file__)), "assets",
                         "half_cheetah_blocks.xml"))
        task = None if task == 'None' else task

        self.cripple_mask = np.ones(self.action_space.shape)

        self._init_geom_rgba = self.model.geom_rgba.copy()
        self._init_geom_contype = self.model.geom_contype.copy()
        self._init_geom_size = self.model.geom_size.copy()
        self._init_geom_pos = self.model.geom_pos.copy()
        self.dt = self.model.opt.timestep

        assert task in [None, 'damping']

        self.task = task
Esempio n. 4
0
 def reset(self, mode='train'):
     self.prev_qpos = None
     self.mode = mode
     if mode == 'train':
         self.reset_task(value=np.random.randint(1, self.action_dim - 1))
     else:
         self.reset_task(value=self.action_dim - 1)
     return MujocoEnv.reset(self)
Esempio n. 5
0
    def __init__(self, task='cripple', reset_every_episode=False):
        Serializable.quick_init(self, locals())
        self.cripple_mask = None
        self.first = True

        self.task = 'cripple'
        self.crippled_leg = 0
        self.prev_torso = None
        self.prev_qpos = None
        self.first = True
        MujocoEnv.__init__(
            self,
            os.path.join(os.path.abspath(os.path.dirname(__file__)), "assets",
                         "half_cheetah_disabled.xml"))
        self._init_geom_rgba = self.model.geom_rgba.copy()
        self._init_geom_contype = self.model.geom_contype.copy()
        self._init_geom_size = self.model.geom_size.copy()
        self._init_geom_pos = self.model.geom_pos.copy()
        self.dt = self.model.opt.timestep

        self.cripple_mask = np.ones(self.action_space.shape)
        self.reward_range = (-np.inf, np.inf)
        utils.EzPickle.__init__(self, locals())