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


Python mujoco_env.MujocoEnv方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [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.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, direction=1, maze_length=0.6,
                 sparse_reward=False, no_reward=False, episode_length=100, grayscale=True,
                 width=64, height=64):
        utils.EzPickle.__init__(self)
        self.sparse_reward = sparse_reward
        self.no_reward = no_reward
        self.max_episode_length = episode_length
        self.direction = direction
        self.length = maze_length

        self.width = width
        self.height = height
        self.grayscale=grayscale

        self.episode_length = 0

        model = point_mass_maze(direction=self.direction, length=self.length, borders=False)
        with model.asfile() as f:
            mujoco_env.MujocoEnv.__init__(self, f.name, 5)

        if self.grayscale:
            self.observation_space = Box(0, 1, shape=(width, height))
        else:
            self.observation_space = Box(0, 1, shape=(width, height, 3)) 
开发者ID:ahq1993,项目名称:inverse_rl,代码行数:26,代码来源:visual_pointmass.py

示例3: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [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

示例4: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, CentipedeLegNum=4, is_crippled=False):

        # get the path of the environments
        if is_crippled:
            xml_name = 'CpCentipede' + self.get_env_num_str(CentipedeLegNum) + \
                '.xml'
        else:
            xml_name = 'Centipede' + self.get_env_num_str(CentipedeLegNum) + \
                '.xml'
        xml_path = os.path.join(init_path.get_base_dir(),
                                'environments', 'assets',
                                xml_name)
        xml_path = str(os.path.abspath(xml_path))
        self.num_body = int(np.ceil(CentipedeLegNum / 2.0))
        self._control_cost_coeff = .5 * 4 / CentipedeLegNum
        self._contact_cost_coeff = 0.5 * 1e-3 * 4 / CentipedeLegNum

        self.torso_geom_id = 1 + np.array(range(self.num_body)) * 5
        # make sure the centipede is not born to be end of episode
        self.body_qpos_id = 6 + 6 + np.array(range(self.num_body)) * 6
        self.body_qpos_id[-1] = 5

        mujoco_env.MujocoEnv.__init__(self, xml_path, 5)

        utils.EzPickle.__init__(self) 
开发者ID:WilsonWangTHU,项目名称:neural_graph_evolution,代码行数:27,代码来源:centipede_env.py

示例5: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, pod_number=3, is_crippled=False):

        # get the path of the environments
        if is_crippled:
            xml_name = 'CrippledSnake' + self.get_env_num_str(pod_number) + \
                '.xml'
        else:
            xml_name = 'Snake' + self.get_env_num_str(pod_number) + '.xml'
        xml_path = os.path.join(os.path.join(init_path.get_base_dir(),
                                'environments', 'assets', xml_name))
        xml_path = str(os.path.abspath(xml_path))
        self.num_body = pod_number
        self._direction = 0
        self.ctrl_cost_coeff = 0.0001 / pod_number * 3

        mujoco_env.MujocoEnv.__init__(self, xml_path, 4)
        utils.EzPickle.__init__(self) 
开发者ID:WilsonWangTHU,项目名称:neural_graph_evolution,代码行数:19,代码来源:snake_env.py

示例6: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, pod_number=2):

        # get the path of the environments
        xml_name = 'Reacher' + self.get_env_num_str(pod_number) + '.xml'
        xml_path = os.path.join(os.path.join(init_path.get_base_dir(),
                                'environments', 'assets', xml_name))
        xml_path = str(os.path.abspath(xml_path))

        # the environment coeff
        self.num_body = pod_number + 1
        self._task_indicator = -1.0

        self._ctrl_coeff = 2.0 / (self.num_body / 2 + 1)
        # norm the max penalty to be 1, max norm is self.num_body * 0.1 * 2
        self._dist_coeff = 2.0 / self.num_body

        mujoco_env.MujocoEnv.__init__(self, xml_path, 2)
        utils.EzPickle.__init__(self) 
开发者ID:WilsonWangTHU,项目名称:neural_graph_evolution,代码行数:20,代码来源:reacher_env.py

示例7: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self,
                 xml_file='swimmer.xml',
                 forward_reward_weight=1.0,
                 ctrl_cost_weight=1e-4,
                 reset_noise_scale=0.1,
                 exclude_current_positions_from_observation=True):
        utils.EzPickle.__init__(**locals())

        self._forward_reward_weight = forward_reward_weight
        self._ctrl_cost_weight = ctrl_cost_weight

        self._reset_noise_scale = reset_noise_scale

        self._exclude_current_positions_from_observation = (
            exclude_current_positions_from_observation)

        mujoco_env.MujocoEnv.__init__(self, xml_file, 4) 
开发者ID:hust512,项目名称:DQN-DDPG_Stock_Trading,代码行数:19,代码来源:swimmer_v3.py

示例8: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [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

示例9: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [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

示例10: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, max_timesteps=1000, disabled=False, gear=150):
        self.timesteps = 0
        self.max_timesteps = max_timesteps

        if disabled:
            model = angry_ant_crippled(gear=gear)
        else:
            model = ant_env(gear=gear)

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

示例11: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self, sparse_reward=False, no_reward=False, episode_length=200):
        utils.EzPickle.__init__(self)
        self.sparse_reward = sparse_reward
        self.no_reward = no_reward
        self.max_episode_length = episode_length
        self.goal_pos = np.asarray([0.0, 0.0])

        self.episode_length = 0

        model = pusher(goal_pos=[self.goal_pos[0], self.goal_pos[1], -0.323])
        with model.asfile() as f:
            mujoco_env.MujocoEnv.__init__(self, f.name, 5) 
开发者ID:HumanCompatibleAI,项目名称:imitation,代码行数:14,代码来源:pusher_env.py

示例12: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self):
        mujoco_env.MujocoEnv.__init__(self, 'inverted_double_pendulum.xml', 5)
        utils.EzPickle.__init__(self) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:5,代码来源:inverted_double_pendulum.py

示例13: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self):
        mujoco_env.MujocoEnv.__init__(self, 'humanoidstandup.xml', 5)
        utils.EzPickle.__init__(self) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:5,代码来源:humanoidstandup.py

示例14: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self):
        mujoco_env.MujocoEnv.__init__(self, 'ant.xml', 5)
        utils.EzPickle.__init__(self) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:5,代码来源:ant.py

示例15: __init__

# 需要导入模块: from gym.envs.mujoco import mujoco_env [as 别名]
# 或者: from gym.envs.mujoco.mujoco_env import MujocoEnv [as 别名]
def __init__(self):
        utils.EzPickle.__init__(self)
        mujoco_env.MujocoEnv.__init__(self, 'pusher.xml', 5) 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:5,代码来源:pusher.py


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