当前位置: 首页>>代码示例>>Python>>正文


Python utils.EzPickle方法代码示例

本文整理汇总了Python中gym.utils.EzPickle方法的典型用法代码示例。如果您正苦于以下问题:Python utils.EzPickle方法的具体用法?Python utils.EzPickle怎么用?Python utils.EzPickle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gym.utils的用法示例。


在下文中一共展示了utils.EzPickle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(
        self,
        direction=1,
        maze_length=0.6,
        sparse_reward=False,
        no_reward=False,
        include_vel=False,
        episode_length=100,
    ):
        utils.EzPickle.__init__(self)
        self.sparse_reward = sparse_reward
        self.no_reward = no_reward
        self.include_vel = include_vel
        self.max_episode_length = episode_length
        self.direction = direction
        self.length = maze_length

        self.episode_length = 0

        model = point_mass_maze(direction=self.direction, length=self.length)
        with model.asfile() as f:
            mujoco_env.MujocoEnv.__init__(self, f.name, 5) 
开发者ID:HumanCompatibleAI,项目名称:imitation,代码行数:24,代码来源:point_maze_env.py

示例2: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, reward_type='sparse'):
        initial_qpos = {
            'robot0:slide0': 0.405,
            'robot0:slide1': 0.48,
            'robot0:slide2': 0.0,
            'table0:slide0': 1.05,
            'table0:slide1': 0.4,
            'table0:slide2': 0.0,
            'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
        }
        fetch_env.FetchEnv.__init__(
            self, 'fetch/push.xml', has_object=True, block_gripper=True, n_substeps=20,
            gripper_extra_height=0.0, target_in_the_air=False, target_offset=0.0,
            obj_range=0.15, target_range=0.15, distance_threshold=0.05,
            initial_qpos=initial_qpos, reward_type=reward_type)
        utils.EzPickle.__init__(self) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:18,代码来源:push.py

示例3: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, reward_type='sparse'):
        initial_qpos = {
            'robot0:slide0': 0.405,
            'robot0:slide1': 0.48,
            'robot0:slide2': 0.0,
            'table0:slide0': 1.05,
            'table0:slide1': 0.4,
            'table0:slide2': 0.0,
            'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
        }
        fetch_env.FetchEnv.__init__(
            self, 'fetch/pick_and_place.xml', has_object=True, block_gripper=False, n_substeps=20,
            gripper_extra_height=0.2, target_in_the_air=True, target_offset=0.0,
            obj_range=0.15, target_range=0.15, distance_threshold=0.05,
            initial_qpos=initial_qpos, reward_type=reward_type)
        utils.EzPickle.__init__(self) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:18,代码来源:pick_and_place.py

示例4: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        self.target_obj_sid = 0
        self.S_grasp_sid = 0
        self.obj_bid = 0
        curr_dir = os.path.dirname(os.path.abspath(__file__))
        mujoco_env.MujocoEnv.__init__(self, curr_dir+'/assets/DAPG_relocate.xml', 5)
        
        # change actuator sensitivity
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([10, 0, 0])
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([1, 0, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([0, -10, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([0, -1, 0])

        self.target_obj_sid = self.sim.model.site_name2id("target")
        self.S_grasp_sid = self.sim.model.site_name2id('S_grasp')
        self.obj_bid = self.sim.model.body_name2id('Object')
        utils.EzPickle.__init__(self)
        self.act_mid = np.mean(self.model.actuator_ctrlrange, axis=1)
        self.act_rng = 0.5*(self.model.actuator_ctrlrange[:,1]-self.model.actuator_ctrlrange[:,0]) 
开发者ID:vikashplus,项目名称:mj_envs,代码行数:21,代码来源:relocate_v0.py

示例5: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        self.target_obj_sid = -1
        self.S_grasp_sid = -1
        self.obj_bid = -1
        self.tool_sid = -1
        self.goal_sid = -1
        curr_dir = os.path.dirname(os.path.abspath(__file__))
        mujoco_env.MujocoEnv.__init__(self, curr_dir+'/assets/DAPG_hammer.xml', 5)
        utils.EzPickle.__init__(self)

        # change actuator sensitivity
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([10, 0, 0])
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([1, 0, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([0, -10, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([0, -1, 0])
        
        self.target_obj_sid = self.sim.model.site_name2id('S_target')
        self.S_grasp_sid = self.sim.model.site_name2id('S_grasp')
        self.obj_bid = self.sim.model.body_name2id('Object')
        self.tool_sid = self.sim.model.site_name2id('tool')
        self.goal_sid = self.sim.model.site_name2id('nail_goal')
        self.act_mid = np.mean(self.model.actuator_ctrlrange, axis=1)
        self.act_rng = 0.5 * (self.model.actuator_ctrlrange[:, 1] - self.model.actuator_ctrlrange[:, 0]) 
开发者ID:vikashplus,项目名称:mj_envs,代码行数:25,代码来源:hammer_v0.py

示例6: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        self.door_hinge_did = 0
        self.door_bid = 0
        self.grasp_sid = 0
        self.handle_sid = 0
        curr_dir = os.path.dirname(os.path.abspath(__file__))
        mujoco_env.MujocoEnv.__init__(self, curr_dir+'/assets/DAPG_door.xml', 5)
        
        # change actuator sensitivity
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([10, 0, 0])
        self.sim.model.actuator_gainprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([1, 0, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_WRJ1'):self.sim.model.actuator_name2id('A_WRJ0')+1,:3] = np.array([0, -10, 0])
        self.sim.model.actuator_biasprm[self.sim.model.actuator_name2id('A_FFJ3'):self.sim.model.actuator_name2id('A_THJ0')+1,:3] = np.array([0, -1, 0])

        utils.EzPickle.__init__(self)
        ob = self.reset_model()
        self.act_mid = np.mean(self.model.actuator_ctrlrange, axis=1)
        self.act_rng = 0.5*(self.model.actuator_ctrlrange[:,1]-self.model.actuator_ctrlrange[:,0])
        self.door_hinge_did = self.model.jnt_dofadr[self.model.joint_name2id('door_hinge')]
        self.grasp_sid = self.model.site_name2id('S_grasp')
        self.handle_sid = self.model.site_name2id('S_handle')
        self.door_bid = self.model.body_name2id('frame') 
开发者ID:vikashplus,项目名称:mj_envs,代码行数:24,代码来源:door_v0.py

示例7: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        utils.EzPickle.__init__(self)
        mujoco_env.MujocoEnv.__init__(self, 'reacher.xml', 2)

    # def _step(self, a):
    #     # x = self._get_obs()[None]
    #     # assert np.allclose(self.get_body_com("fingertip")[:2], get_fingertips(x)),\
    #     # str(self.get_body_com("fingertip")) + " "+ str(get_fingertips(x))
    #     vec = self.get_body_com("fingertip")-self.get_body_com("target")
    #     reward_dist = - np.linalg.norm(vec[:2])
    #     reward_ctrl = - np.square(a).sum()*0.01
    #     reward = reward_dist + reward_ctrl
    #     self.do_simulation(a, self.frame_skip)
    #     ob = self._get_obs()
    #     done = False
    #     return ob, reward, done, dict(reward_dist=reward_dist, reward_ctrl=reward_ctrl) 
开发者ID:thanard,项目名称:me-trpo,代码行数:18,代码来源:reacher_env.py

示例8: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, reward_type='sparse', terminate_on_success=False):
        initial_qpos = {
            'robot0:slide0': 0.405,
            'robot0:slide1': 0.48,
            'robot0:slide2': 0.0,
            'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
            'object1:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
        }

        FewShotFetchEnv.__init__(
            self, FEW_SHOT_ENV_XML_PATH, has_object=True, block_gripper=False, n_substeps=20,
            gripper_extra_height=0.2, target_in_the_air=True, target_offset=0.0,
            obj_range=0.15, target_range=0.05, distance_threshold=0.05,
            initial_qpos=initial_qpos, reward_type=reward_type, goal_high_prob=1.0,
            min_goal_extra_height=0.15, max_goal_extra_height=0.2,
            min_dist_between_objs=0.1, same_color_radius=0.5,
            terminate_on_success=terminate_on_success
        )
        gym_utils.EzPickle.__init__(self)
        self._max_episode_steps = 65 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:22,代码来源:few_shot_fetch_env.py

示例9: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, reward_type='sparse', terminate_on_success=False):
        initial_qpos = {
            'robot0:slide0': 0.405,
            'robot0:slide1': 0.48,
            'robot0:slide2': 0.0,
            'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
            'object1:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
        }

        FewShotFetchEnv.__init__(
            self, FEW_SHOT_ENV_XML_PATH, has_object=True, block_gripper=False, n_substeps=20,
            gripper_extra_height=0.2, target_in_the_air=True, target_offset=0.0,
            obj_range=0.15, target_range=0.05, distance_threshold=0.05,
            initial_qpos=initial_qpos, reward_type=reward_type, goal_high_prob=1.0,
            min_goal_extra_height=0.15, max_goal_extra_height=0.2,
            min_dist_between_objs=0.1, same_color_radius=0.3,
            terminate_on_success=terminate_on_success
        )
        gym_utils.EzPickle.__init__(self)
        self._max_episode_steps = 65 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:22,代码来源:old_version_of_color_few_shot_fetch_env.py

示例10: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        self.multipliers = {
            'body_mass_multiplier': np.ones(5),
            'body_inertia_multiplier': np.ones((5,3)),
            'dof_damping_multiplier': np.ones(6),
            'geom_friction_multiplier': np.ones((5,3))
        }
        MetaMujocoEnv.__init__(self, 'hopper.xml', 4)
        utils.EzPickle.__init__(self)

        self.original_params = {
            'body_mass': self.model.body_mass.copy(),
            'body_inertia': self.model.body_inertia.copy(),
            'dof_damping': self.model.dof_damping.copy(),
            'geom_friction': self.model.geom_friction.copy()
        } 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:18,代码来源:hopper_random_dynamics.py

示例11: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, reward_type='sparse'):
        initial_qpos = {
            'robot0:slide0': 0.405,
            'robot0:slide1': 0.48,
            'robot0:slide2': 0.0,
            'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
            'object1:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.],
        }

        FewShotReachEnv.__init__(
            self, FEW_SHOT_ENV_XML_PATH, has_object=True, block_gripper=False, n_substeps=20,
            gripper_extra_height=0.2, target_in_the_air=True, target_offset=0.0,
            obj_range=0.15, target_range=0.0, distance_threshold=0.05,
            initial_qpos=initial_qpos, reward_type=reward_type, goal_high_prob=1.0,
            min_goal_extra_height=0.05, max_goal_extra_height=0.05,
            min_dist_between_objs=0.1, same_color_radius=0.3
        )
        gym_utils.EzPickle.__init__(self)
        self._max_episode_steps = 30 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:21,代码来源:few_shot_reach_env.py

示例12: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, episode_len=499):
        # # 1 x 1 x 8 x 2
        # self.valid_targets = np.array(
        #     [[[
        #         [8.0, 0.0],
        #         [0.0, 8.0],
        #         [-8.0, 0.0],
        #         [0.0, -8.0],
        #     ]]]
        # )

        self.timestep = 0.0
        self.episode_len = episode_len
        # self.init_xy = init_pos.copy()

        xml_path = os.path.join(os.path.dirname(__file__), "assets", 'low_gear_ratio_ant.xml')
        # xml_path = os.path.join(os.path.dirname(__file__), "assets", 's_maze.xml')
        MujocoEnv.__init__(self, xml_path, 5)
        utils.EzPickle.__init__(self) 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:21,代码来源:state_matching_ant_env.py

示例13: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        mujoco_env.MujocoEnv.__init__(self, 'half_cheetah.xml', 1)
        utils.EzPickle.__init__(self) 
开发者ID:xuwd11,项目名称:cs294-112_hws,代码行数:5,代码来源:half_cheetah_env.py

示例14: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self):
        mujoco_env.MujocoEnv.__init__(self, 'half_cheetah.xml', 5)
        utils.EzPickle.__init__(self) 
开发者ID:xuwd11,项目名称:cs294-112_hws,代码行数:5,代码来源:sparse_half_cheetah.py

示例15: __init__

# 需要导入模块: from gym import utils [as 别名]
# 或者: from gym.utils import EzPickle [as 别名]
def __init__(self, verbose=False):
        self.verbose = verbose
        self.max_episode_length = 200
        self.episode_length = 0
        utils.EzPickle.__init__(self)
        TwoDEnv.__init__(
            self,
            get_asset_xml("twod_maze.xml"),
            2,
            xbounds=[-0.3, 0.3],
            ybounds=[-0.3, 0.3],
        ) 
开发者ID:HumanCompatibleAI,项目名称:imitation,代码行数:14,代码来源:twod_maze.py


注:本文中的gym.utils.EzPickle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。