Пример #1
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.75)
     MJCFBasedRobot.__init__(self,
                             "hopper.xml",
                             "torso",
                             action_dim=3,
                             obs_dim=17)
 def __init__(self):
     WalkerBase.__init__(self, power=0.90)
     MJCFBasedRobot.__init__(self,
                             "half_cheetah.xml",
                             "torso",
                             action_dim=6,
                             obs_dim=26)
Пример #3
0
 def __init__(self):
     WalkerBase.__init__(self, power=2.5)
     MJCFBasedRobot.__init__(self,
                             "ant.xml",
                             "torso",
                             action_dim=8,
                             obs_dim=28 + 1)
Пример #4
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_shoulder1", "right_shoulder2", "right_elbow"]
     self.motor_power += [75, 75, 75]
     self.motor_names += ["left_shoulder1", "left_shoulder2", "left_elbow"]
     self.motor_power += [75, 75, 75]
     self.motors = [self.jdict[n] for n in self.motor_names]
     if self.random_yaw:
         position = [0,0,0]
         orientation = [0,0,0]
         yaw = self.np_random.uniform(low=-3.14, high=3.14)
         if self.random_lean and self.np_random.randint(2) == 0:
             if self.np_random.randint(2) == 0:
                 pitch = np.pi/2
                 position = [0, 0, 0.45]
             else:
                 pitch = np.pi*3/2
                 position = [0, 0, 0.25]
             roll = 0
             orientation = [roll, pitch, yaw]
         else:
             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(p.getQuaternionFromEuler(orientation))
     self.initial_z = 0.8
Пример #5
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.40)
     MJCFBasedRobot.__init__(self,
                             "walker2d.xml",
                             "torso",
                             action_dim=6,
                             obs_dim=22 + 1)
Пример #6
0
 def __init__(self):
     WalkerBase.__init__(self, power=2.9)
     URDFBasedRobot.__init__(
         self,
         "atlas/atlas_description/atlas_v4_with_multisense.urdf",
         "pelvis",
         action_dim=30,
         obs_dim=70)
 def robot_specific_reset(self, bullet_client):
     WalkerBase.robot_specific_reset(self, bullet_client)
     self.jdict["bthigh"].power_coef = 120.0
     self.jdict["bshin"].power_coef = 90.0
     self.jdict["bfoot"].power_coef = 60.0
     self.jdict["fthigh"].power_coef = 140.0
     self.jdict["fshin"].power_coef = 60.0
     self.jdict["ffoot"].power_coef = 30.0
Пример #8
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.90)
     MJCFBasedRobot.__init__(self,
                             "half_cheetah.xml",
                             "torso",
                             action_dim=6 + 1,
                             obs_dim=26 + 1)
     self.aggressive_cube = None
     self.frame = 0
Пример #9
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.40)
     MJCFBasedRobot.__init__(self,
                             "walker2d.xml",
                             "torso",
                             action_dim=6 + 1,
                             obs_dim=22 + 1)
     self.aggressive_cube = None
     self.frame = 0
Пример #10
0
 def robot_specific_reset(self, bullet_client):
     WalkerBase.robot_specific_reset(self, bullet_client)
     self.frame = 0
     if self.aggressive_cube:
         self._p.resetBasePositionAndOrientation(
             self.aggressive_cube.bodies[0], [-1.5, 0, 0.05], [0, 0, 0, 1])
     else:
         self.aggressive_cube = ObjectHelper.get_cube(
             self._p, -1.5, 0, 0.05)
Пример #11
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.75)
     MJCFBasedRobot.__init__(self,
                             "hopper.xml",
                             "torso",
                             action_dim=3 + 1,
                             obs_dim=15 + 1)
     self.aggressive_cube = None
     self.frame = 0
Пример #12
0
 def __init__(self):
     WalkerBase.__init__(self, power=2.5)
     MJCFBasedRobot.__init__(self,
                             "ant.xml",
                             "torso",
                             action_dim=8 + 1,
                             obs_dim=28 + 1)
     self.aggressive_cube = None
     self.frame = 0
Пример #13
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_shoulder1", "right_shoulder2", "right_elbow"
        ]
        self.motor_power += [75, 75, 75]
        self.motor_names += ["left_shoulder1", "left_shoulder2", "left_elbow"]
        self.motor_power += [75, 75, 75]
        self.motors = [self.jdict[n] for n in self.motor_names]
        if self.random_yaw:
            position = [0, 0, 0]
            orientation = [0, 0, 0]
            yaw = self.np_random.uniform(low=-3.14, high=3.14)
            if self.random_lean and self.np_random.randint(2) == 0:
                if self.np_random.randint(2) == 0:
                    pitch = np.pi / 2
                    position = [0, 0, 0.45]
                else:
                    pitch = np.pi * 3 / 2
                    position = [0, 0, 0.25]
                roll = 0
                orientation = [roll, pitch, yaw]
            else:
                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(
                p.getQuaternionFromEuler(orientation))
        self.initial_z = 0.8

        self.frame = 0
        if self.aggressive_cube:
            self._p.resetBasePositionAndOrientation(
                self.aggressive_cube.bodies[0], [-1.5, 0, 0.05], [0, 0, 0, 1])
            self._p.changeDynamics(self.aggressive_cube.bodies[0],
                                   -1,
                                   mass=self.cube_masses[self.reset_count])
        else:
            self.aggressive_cube = ObjectHelper.get_cube(
                self._p, -1.5, 0, 0.05)
            self._p.changeDynamics(self.aggressive_cube.bodies[0],
                                   -1,
                                   mass=self.cube_masses[self.reset_count])
        self.reset_count += 1
Пример #14
0
 def __init__(self, random_yaw=False, random_lean=False):
     WalkerBase.__init__(self, power=0.41)
     MJCFBasedRobot.__init__(self,
                             'humanoid_symmetric.xml',
                             'torso',
                             action_dim=17,
                             obs_dim=44)
     # 17 joints, 4 of them important for walking (hip, knee), others may as well be turned off, 17/4 = 4.25
     self.random_yaw = random_yaw
     self.random_lean = random_lean
Пример #15
0
    def robot_specific_reset(self, bullet_client):
        WalkerBase.robot_specific_reset(self, bullet_client)
        for n in ["foot_joint", "foot_left_joint"]:
            self.jdict[n].power_coef = 30.0

        self.frame = 0
        if self.aggressive_cube:
            self._p.resetBasePositionAndOrientation(
                self.aggressive_cube.bodies[0], [-1.5, 0, 0.05], [0, 0, 0, 1])
        else:
            self.aggressive_cube = ObjectHelper.get_cube(
                self._p, -1.5, 0, 0.05)
Пример #16
0
 def __init__(self):
     WalkerBase.__init__(self, power=0.90)
     MJCFBasedRobot.__init__(self,
                             "half_cheetah.xml",
                             "torso",
                             action_dim=6,
                             obs_dim=26)
     self.aggressive_cube = None
     self.frame = 0
     self.reset_count = 0
     self.cube_masses = np.repeat(
         np.linspace(0.1, 2.2, 50),
         20)  # [0.1 (10 times), 0.15 (10 times), ..., 1.05, 1.05]
Пример #17
0
 def robot_specific_reset(self, bullet_client):
     WalkerBase.robot_specific_reset(self, bullet_client)
     self.frame = 0
     if self.aggressive_cube:
         self._p.resetBasePositionAndOrientation(
             self.aggressive_cube.bodies[0], [-1.5, 0, 0.05], [0, 0, 0, 1])
         self._p.changeDynamics(self.aggressive_cube.bodies[0],
                                -1,
                                mass=self.cube_masses[self.reset_count])
     else:
         self.aggressive_cube = ObjectHelper.get_cube(
             self._p, -1.5, 0, 0.05)
         self._p.changeDynamics(self.aggressive_cube.bodies[0],
                                -1,
                                mass=self.cube_masses[self.reset_count])
     self.reset_count += 1
Пример #18
0
 def __init__(self, random_yaw=False, random_lean=False):
     WalkerBase.__init__(self, power=0.41)
     MJCFBasedRobot.__init__(self,
                             'humanoid_symmetric.xml',
                             'torso',
                             action_dim=17,
                             obs_dim=44)
     # 17 joints, 4 of them important for walking (hip, knee), others may as well be turned off, 17/4 = 4.25
     self.random_yaw = random_yaw
     self.random_lean = random_lean
     self.aggressive_cube = None
     self.frame = 0
     self.reset_count = 0
     self.cube_masses = np.repeat(
         np.linspace(0.1, 2.2, 50),
         20)  # [0.1 (10 times), 0.15 (10 times), ..., 1.05, 1.05]
Пример #19
0
    def robot_specific_reset(self, bullet_client):
        WalkerBase.robot_specific_reset(self, bullet_client)
        self.jdict["bthigh"].power_coef = 120.0
        self.jdict["bshin"].power_coef = 90.0
        self.jdict["bfoot"].power_coef = 60.0
        self.jdict["fthigh"].power_coef = 140.0
        self.jdict["fshin"].power_coef = 60.0
        self.jdict["ffoot"].power_coef = 30.0

        self.frame = 0
        if self.aggressive_cube:
            self._p.resetBasePositionAndOrientation(
                self.aggressive_cube.bodies[0], [-1.5, 0, 0.05], [0, 0, 0, 1])
        else:
            self.aggressive_cube = ObjectHelper.get_cube(
                self._p, -1.5, 0, 0.05)
Пример #20
0
 def __init__(self):
     WalkerBase.__init__(self, power=2.5)
     MJCFBasedRobot.__init__(self,
                             "ant.xml",
                             "torso",
                             action_dim=8,
                             obs_dim=28)
     self.aggressive_cube = None
     self.frame = 0
     self.reset_count = 0
     # self.cube_masses = np.repeat(np.arange(0.1,1.1,0.05),10) # [0.1 (10 times), 0.15 (10 times), ..., 1.05, 1.05]
     self.cube_masses = np.repeat(
         np.arange(0.1, 2.2, 1),
         3)  # [0.1 (10 times), 0.15 (10 times), ..., 1.05, 1.05]
     self.cube_masses = np.repeat(
         np.linspace(0.1, 6.2, 50),
         20)  # [0.1 (10 times), 0.15 (10 times), ..., 1.05, 1.05]
Пример #21
0
 def robot_specific_reset(self, bullet_client):
     WalkerBase.robot_specific_reset(self, bullet_client)
     for n in ["foot_joint", "foot_left_joint"]:
         self.jdict[n].power_coef = 30.0
Пример #22
0
 def robot_specific_reset(self, bullet_client):
     WalkerBase.robot_specific_reset(self, bullet_client)
     self.set_initial_orientation(yaw_center=0, yaw_random_spread=np.pi)
     self.head = self.parts["head"]