Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
    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)
Exemple #4
0
 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
Exemple #5
0
    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
Exemple #6
0
 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 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)