hopper_torso_6.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:gym-adv 作者: lerrel 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号