Enable randomized reset for Humanoid.

This commit is contained in:
Benelot
2017-09-14 12:53:12 +02:00
parent 2e8a86462f
commit 3f57fb655a

View File

@@ -152,23 +152,25 @@ class Humanoid(WalkerBase):
self.motor_names += ["left_shoulder1", "left_shoulder2", "left_elbow"] self.motor_names += ["left_shoulder1", "left_shoulder2", "left_elbow"]
self.motor_power += [75, 75, 75] self.motor_power += [75, 75, 75]
self.motors = [self.jdict[n] for n in self.motor_names] self.motors = [self.jdict[n] for n in self.motor_names]
# if self.random_yaw: # TODO: Make leaning work as soon as the rest works if self.random_yaw:
# cpose = cpp_household.Pose() position = [0,0,0]
# yaw = self.np_random.uniform(low=-3.14, high=3.14) orientation = [0,0,0]
# if self.random_lean and self.np_random.randint(2)==0: yaw = self.np_random.uniform(low=-3.14, high=3.14)
# cpose.set_xyz(0, 0, 1.4) if self.random_lean and self.np_random.randint(2)==0:
# if self.np_random.randint(2)==0: cpose.set_xyz(0, 0, 1.4)
# pitch = np.pi/2 if self.np_random.randint(2)==0:
# cpose.set_xyz(0, 0, 0.45) pitch = np.pi/2
# else: position = [0, 0, 0.45]
# pitch = np.pi*3/2 else:
# cpose.set_xyz(0, 0, 0.25) pitch = np.pi*3/2
# roll = 0 position = [0, 0, 0.25]
# cpose.set_rpy(roll, pitch, yaw) roll = 0
# else: orientation = [roll, pitch, yaw]
# cpose.set_xyz(0, 0, 1.4) else:
# cpose.set_rpy(0, 0, yaw) # just face random direction, but stay straight otherwise position = [0, 0, 1.4]
# self.cpp_robot.set_pose_and_speed(cpose, 0,0,0) 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 self.initial_z = 0.8
random_yaw = False random_yaw = False