def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'hopper.xml', 4)
utils.EzPickle.__init__(self)
## Adversarial setup
self._adv_f_bname = [b'foot', b'torso'] #Byte String name of body on which the adversary force will be applied
bnames = self.model.body_names
self._adv_bindex = [bnames.index(i) for i in self._adv_f_bname] #Index of the body on which the adversary force will be applied
adv_max_force = 5.0
high_adv = np.ones(2*len(self._adv_bindex))*adv_max_force
low_adv = -high_adv
self.adv_action_space = spaces.Box(low_adv, high_adv)
self.pro_action_space = self.action_space
mass_ind = self.model.body_names.index(b'torso')
me = np.array(self.model.body_mass)
me[mass_ind,0] = 6.0
self.model.body_mass = me
评论列表
文章目录