def __init__(self, xml): WalkerBase.__init__(self, xml, "torso", action_dim=8, obs_dim=28, power=2.5)
def _robo_init(self, model_xml, robot_name, action_dim, obs_dim): WalkerBase.__init__(self, model_xml, robot_name, action_dim, obs_dim, power=0.40)
def __init__(self, xml, param, env, powercoeffs=[1., 1., 1.]): self.step_num = 0 self.env = env self.xml = xml self.param = param self.powercoeffs = powercoeffs WalkerBase.__init__(self, xml, "torso", action_dim=6, obs_dim=22, power=0.40)
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) # Adjust power coefficients so that motors won't exert power that is too large or too small. # Power that is too large will cause PyBullet to have the "fly-away" bug. # Power that is too small won't be possible to achieve the locomotion task. empirical_c1 = 2e4 empirical_c2 = 2e4 # the torso is especially prone to the "fly-away" bug, so this number should keep small. # power coefficients is proportional to the volume of adjacent parts. thigh_joint_power_coef = (self.param["volume_torso"] + self.param["volume_thigh"]) * empirical_c1 leg_joint_power_coef = (self.param["volume_thigh"] + self.param["volume_leg"]) * empirical_c1 foot_joint_power_coef = (self.param["volume_leg"] + self.param["volume_foot"]) * empirical_c1 # avoid too large torso_max_power_coef = self.param["volume_torso"] * empirical_c2 thigh_joint_power_coef = min(torso_max_power_coef, thigh_joint_power_coef) # set them joint_names = ["thigh", "leg", "foot"] joint_powers = [ thigh_joint_power_coef, leg_joint_power_coef, foot_joint_power_coef ] for joint_name, joint_power, coef in zip(joint_names, joint_powers, self.powercoeffs): self.jdict[f"{joint_name}_joint"].power_coef = joint_power * coef self.jdict[ f"{joint_name}_left_joint"].power_coef = joint_power * coef
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) self.motor_names = ["abdomen_z", "abdomen_y", "abdomen_x"] self.motor_power = [100, 100, 100] self.motor_names += ["right_hip_x", "right_hip_z", "right_hip_y", "right_knee"] self.motor_power += [100, 100, 300, 200] self.motor_names += ["left_hip_x", "left_hip_z", "left_hip_y", "left_knee"] self.motor_power += [100, 100, 300, 200] self.motor_names += ["right_shoulder_x", "right_shoulder_y", "right_elbow"] self.motor_power += [75, 75, 75] self.motor_names += ["left_shoulder_x", "left_shoulder_y", "left_elbow"] self.motor_power += [75, 75, 75] self.motor_names += ["right_ankle_y"] self.motor_power += [200] self.motor_names += ["left_ankle_y"] self.motor_power += [200] self.motors = [self.jdict[n] for n in self.motor_names] if self.random_yaw: yaw = self.np_random.uniform(low=-3.14, high=3.14) position = [0, 0, 1.4] orientation = [ 0, 0, yaw, ] # just face random direction, but stay straight otherwise self.robot_body.reset_position(position) self.robot_body.reset_orientation(orientation) self.initial_z = 0.8
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) self.jdict["leg_joint"].set_position(self.init_pos[0] * 180 / pi) self.jdict["thigh_joint"].set_position(self.init_pos[2] * 180 / pi) self.jdict["leg_left_joint"].set_position(-self.init_pos[1] * 180 / pi) self.jdict["thigh_left_joint"].set_position(self.init_pos[3] * 180 / pi)
def __init__(self, xml, param, render=False): self.param = param WalkerBase.__init__(self, xml, "torso", action_dim=6, obs_dim=22, power=0.40)
def __init__(self): # change obs_dim from 22 to 23 WalkerBase.__init__(self, "walker2d.xml", "torso", action_dim=6, obs_dim=23, power=0.40)
def __init__(self): WalkerBase.__init__( self, "humanoid_symmetric_2.xml", "torso", action_dim=19, obs_dim=44, power=0.41, )
def __init__(self): WalkerBase.__init__(self, getResourcePath() + "/Walker2d_five.xml", "torso", action_dim=4, obs_dim=18, power=0.40) self.init_pos = [-0.86647779, -5.57969548, 4.56618282, -0.86647779] self.init_vel = [-0.08985754, 2.59193943, -0.48066481, 1.88797459]
def __init__(self, xml, powercoeffs=[1., 1., 1.]): self.step_num = 0 self.powercoeffs = powercoeffs WalkerBase.__init__(self, xml, "torso", action_dim=6, obs_dim=22, power=0.40)
def __init__(self, design=None, design_mode='24lr'): self.design_mode = design_mode self.design = design self._adapted_xml_file = tempfile.NamedTemporaryFile(delete=False, prefix='ant_', suffix='.xml') self._adapted_xml_filepath = self._adapted_xml_file.name file = self._adapted_xml_filepath self._adapted_xml_file.close() atexit.register(cleanup_func_for_tmp, self._adapted_xml_filepath) self.adapt_xml(self._adapted_xml_filepath, design) WalkerBase.__init__(self, file, "torso", action_dim=8, obs_dim=28, power=2.5)
def __init__(self, scale=1): WalkerBase.__init__(self, "ant.xml", "torso", action_dim=8, obs_dim=30, power=2.5) self.walk_target_x = 0 self.walk_target_y = 0 self.SCALE = scale
def __init__(self, xml, param): self.param = param WalkerBase.__init__(self, xml, "torso", action_dim=6, obs_dim=22, power=0.5) self.height_using_knees = ( self.param["z0"] + self.param["z1"]) / 2 - self.param["z2"] + 0.1
def __init__(self): WalkerBase.__init__(self, "ant.xml", "torso", action_dim=8, obs_dim=34, power=2.5) self.walk_target_x = 0 self.walk_target_y = 0 self.init_ball_pos = [0, 0, .25] self.init_robot_pos = [0, -1.5, .5]
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) torso_length = 4 torso_width = 5 torso_max_power_coef = torso_length * torso_width * torso_width joint_names = ["thigh", "leg", "foot"] joint_powers = [torso_max_power_coef, 100, 30] # where is 80? for joint_name, joint_power, coef in zip(joint_names, joint_powers, self.powercoeffs): self.jdict[f"{joint_name}_joint"].power_coef = joint_power * coef self.jdict[ f"{joint_name}_left_joint"].power_coef = joint_power * coef
def __init__(self, xml, param, name, env, powercoeffs=[1., 1., 1.]): self.step_num = 0 self.env = env self.xml = xml # remove private params private_keys = [] for key in param: if key.startswith("_"): private_keys.append(key) for key in private_keys: del param[key] self.param = param self.name = name self.powercoeffs = powercoeffs self.sqrt2 = np.sqrt(2) WalkerBase.__init__(self, xml, "torso", action_dim=8, obs_dim=28, power=2.5) # larger power? because we have larger bodies in variation. original = 2.5
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) # power coefficient should be proportional to the min possible volume of that part. (Avoid pybullet fly-away bug.) self.jdict["thigh_joint"].power_coef = 65 self.jdict["leg_joint"].power_coef = 31 self.jdict["foot_joint"].power_coef = 18 self.jdict["thigh_left_joint"].power_coef = 65 self.jdict["leg_left_joint"].power_coef = 31 self.jdict["foot_left_joint"].power_coef = 18 # I deleted ignore_joints in mujoco xml files, so i need to place the robot at an appropriate initial place manually. robot_id = self.objects[0] # is the robot pybullet_id bullet_client.resetBasePositionAndOrientation( bodyUniqueId=robot_id, posObj=[0, 0, self.param["torso_center_height"] + 0.1], ornObj=[0, 0, 0, 1]) # Lift the robot higher above ground
def __init__(self): self.p = None self.camera_width = 256 self.camera_height = 256 self.camera_channel = 3 self.gravity = -9.8 super().__init__() # Reset the robot XML file: total_joints = 18 WalkerBase.__init__(self, f'{os.getcwd()}/erl/envs/xmls/humanoid_symmetric.xml', 'torso', action_dim=total_joints, # 10 real numbers of basic information # each joint has 2 real numbers (position, velocity) # WxHxC from camera image obs_dim=10 + total_joints*2 + self.camera_width*self.camera_height*self.camera_channel, power=0.41)
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) # Robot to initial position self.robot_body.reset_position(self.init_robot_pos)
def robot_specific_reset(self, bullet_client): WalkerBase.robot_specific_reset(self, bullet_client) body_pose = self.robot_body.pose() x, y, z = body_pose.xyz() self._initial_z = z
def __init__(self, xml): WalkerBase.__init__( self, xml, "torso", action_dim=0, obs_dim=0, power=0.75 ) # action_dim and obs_dim will be set automatically in function reset_spaces() self.body_parts = None