def __init__(self, xml_file='model.xml', reset_noise_scale=0.05, context=np.array([0.68, 0.9, 0.85])): utils.EzPickle.__init__(**locals()) self.p_gains = np.array([200, 300, 100, 100, 10 * 2, 10 * 2, 2.5 * 2]) self.d_gains = np.array([7, 15, 5, 2.5, 0.3 * 1.41, 0.3 * 1.41, 0.05 * 1.41]) self._reset_noise_scale = reset_noise_scale self.context = context xml_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data", "barrett") xml_path = os.path.join(xml_dir, xml_file) self.step = self.dummy_step # We fix the first and third joint so that the robot only moves in the plane self.des_pos = np.zeros(7) self._target_pos = None MujocoEnv.__init__(self, xml_path, 5) self.init_qpos = np.array([0., 0.4, 0., 1.5, 0., 0., 0.]) self.init_qvel = np.array([0., 0., 0., 0., 0., 0., 0.]) self.step = self.real_step self.ball_body_id = self.sim.model._body_name2id["ball"] self.net_body_id = self.sim.model._body_name2id["wam/net"] self.ball_geom_id = self.sim.model._geom_name2id["ball_geom"] self.net_geom_id = self.sim.model._geom_name2id["net_geom"] self.ground_geom_id = self.sim.model._geom_name2id["ground"]
def __init__(self, goal=(0, -1), arm_object_distance_cost_coeff=0, goal_object_distance_cost_coeff=1.0, ctrl_cost_coeff=0.1): """ goal (`list`): List of two elements denoting the x and y coordinates of the goal location. Either of the coordinate can also be a string 'any' to make the reward not to depend on the corresponding coordinate. arm_distance_coeff ('float'): Coefficient for the arm-to-object distance cost. goal_distance_coeff ('float'): Coefficient for the object-to-goal distance cost. """ self._goal_mask = [coordinate != 'any' for coordinate in goal] self._goal = np.array(goal)[self._goal_mask].astype(np.float32) self._arm_object_distance_cost_coeff = arm_object_distance_cost_coeff self._goal_object_distance_cost_coeff = goal_object_distance_cost_coeff self._ctrl_cost_coeff = ctrl_cost_coeff MujocoEnv.__init__(self, model_path=self.MODEL_PATH, frame_skip=5) self.model.stat.extent = 10
def __init__(self, xml_filename="hopper.xml"): utils.EzPickle.__init__(self) assets_path = os.path.join(os.path.dirname(__file__), "assets") xml_path = os.path.join(assets_path, xml_filename) self.direction = [-1, 1][np.random.randint(0, 1)] MujocoEnv.__init__(self, xml_path, 2)
def __init__(self): utils.EzPickle.__init__(self) self._striked = False self._min_strike_dist = np.inf self.strike_threshold = 0.2 MujocoEnv.__init__( self, os.path.join(os.path.dirname(__file__), "assets", 'striker3dof_backlash.xml'), 5)
def render(self, mode='human', width=1024, height=600, camera_id=None, camera_name=None): return MujocoEnv.render(self, mode, width, height, camera_id, camera_name)
def __init__(self, xml_filename="hopper.xml"): utils.EzPickle.__init__(self) assets_path = os.path.join(os.path.dirname(__file__), "assets") xml_path = os.path.join(assets_path, xml_filename) self.direction = [-1, 1][np.random.randint(1, 2)] MujocoEnv.__init__(self, xml_path, 2) self.body_mass_length = len(self.model.body_mass) self.geom_friction_length = len(self.model.geom_friction) self.geom_size_length = len(self.model.geom_size) # Example environment randomizations self.random_mass() self.random_gravity() self.random_friction() self.random_thickness()
def __init__(self, params, num_balls=None, particle_size=0.05, ctrl=0.1, seed=0): seed = seeding.create_seed(seed) rng = np.random.RandomState(seed) self.rewards = create_reward(params, rng) if num_balls is None: num_balls = len(self.rewards) self.num_targets = num_balls self.particle_size = particle_size self.ctrl = ctrl num_cats = len(self.rewards) assert num_cats >= num_balls model = billiards_model(num_cats, particle_size=particle_size) with model.asfile() as f: MujocoEnv.__init__(self, f.name, 5) utils.EzPickle.__init__(self, params, num_balls, particle_size, seed)
def __init__(self, model_path: str = "hopper.xml", frame_skip: int = 4): MujocoEnv.__init__(self, model_path=model_path, frame_skip=frame_skip)
def __init__(self, model_path: str = "half_cheetah.xml", frame_skip: int = 5): MujocoEnv.__init__(self, model_path=model_path, frame_skip=frame_skip)
def __init__(self, xml_filename="hopper.xml"): utils.EzPickle.__init__(self) assets_path = os.path.join(os.path.dirname(__file__), "assets") xml_path = os.path.join(assets_path, xml_filename) MujocoEnv.__init__(self, xml_path, 2)