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'
        self.xml_path = os.path.join(init_path.get_base_dir(), 'environments',
                                     'assets', xml_name)
        self.xml_path = str(os.path.abspath(self.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
        self._get_joint_names()

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

        utils.EzPickle.__init__(self)
예제 #2
0
    def __init__(self):

        # get the path of the environments
        xml_name = 'WalkersKangaroo.xml'
        xml_name = modify_xml(xml_name)
        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))

        mujoco_env.MujocoEnv.__init__(self, xml_path, 4)
        utils.EzPickle.__init__(self)
예제 #3
0
    def __init__(self, num=None):

        xml_name = 'WalkersFullcheetah.xml'
        xml_name = modify_xml(xml_name, num)
        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 = num

        mujoco_env.MujocoEnv.__init__(self, xml_path, 4)
        utils.EzPickle.__init__(self)
예제 #4
0
    def __init__(self, pod_number=3):

        # get the path of the environments
        xml_name = 'InvPendulum' + 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

        mujoco_env.MujocoEnv.__init__(self, xml_path, 5)
        utils.EzPickle.__init__(self)
예제 #5
0
    def __init__(self):
        xml_path = os.path.join(init_path.get_base_dir(), 'environments',
                                'assets', 'ant_with_goal.xml')
        self.radius = 2.0
        self.xml_path = xml_path
        self._set_goal()
        mujoco_env.MujocoEnv.__init__(self, xml_path, 5)
        utils.EzPickle.__init__(self)
        self._goal_idx = self.sim.model.site_name2id(
            "goal")  # internal usage to randomly reset the location
        """
        For reproducibility, you might want to open these lines to set the goals in advance
        
        self.train_goals = pickle.load(open('./environments/assets/goals/ant_train.pkl', "rb"))
        self.eval_goals = pickle.load(open('./environments/assets/goals/ant_eval.pkl', "rb"))        
        """

        self._get_joint_names()
예제 #6
0
    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)
예제 #7
0
    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)
예제 #8
0
 def __init__(self):
     xml_path = os.path.join(init_path.get_base_dir(), 'environments',
                             'assets', 'ant.xml')
     self.xml_path = xml_path
     mujoco_env.MujocoEnv.__init__(self, xml_path, 5)
     utils.EzPickle.__init__(self)