def robot_specific_reset(self): self.rewards_progress = [] self.reward_angleDiff = [] self.reward_alive = [] self.ordered_joints = [] self.jdict = {} self.jointToUse = [ "fl1", "fl2", "fl3", "fr1", "fr2", "fr3", "bl1", "bl2", "bl3", "br1", "br2", "br3" ] for j in self.urdf.joints: if j.name in self.jointToUse: #print("\tJoint '%s' limits = %+0.2f..%+0.2f effort=%0.3f speed=%0.3f" % ((j.name,) + j.limits()) ) j.servo_target = 0.0 j.set_servo_target(j.servo_target, self.servo_kp, self.servo_kd, self.servo_maxTorque) j.power_coef, j.max_velocity = j.limits()[2:4] self.ordered_joints.append(j) self.jdict[j.name] = j continue self.iklinks_fl = [ self.jdict["fl1"], self.jdict["fl2"], self.jdict["fl3"] ] self.iklinks_fr = [ self.jdict["fr1"], self.jdict["fr2"], self.jdict["fr3"] ] self.iklinks_bl = [ self.jdict["bl1"], self.jdict["bl2"], self.jdict["bl3"] ] self.iklinks_br = [ self.jdict["br1"], self.jdict["br2"], self.jdict["br3"] ] self.setupEnergyCost("fl") self.setupEnergyCost("fr") self.setupEnergyCost("bl") self.setupEnergyCost("br") RoboschoolForwardWalker.robot_specific_reset(self) self.body_xyz = [-0.3, 0, 0.18] RoboschoolForwardWalker.move_robot(self, self.body_xyz[0], self.body_xyz[1], self.body_xyz[2]) self.numStepsPerSecond = 1.0 / self.physics_time_step self.numSecondsToTrack = 1.0 self.walked_distance = deque(maxlen=int(self.numSecondsToTrack * self.numStepsPerSecond)) self.progressHistory = deque(maxlen=int(self.numSecondsToTrack * self.numStepsPerSecond)) if settings.history1Len > 0.0: self.history1 = deque(maxlen=int(settings.history1Len * self.numStepsPerSecond)) if settings.history2Len > 0.0: self.history2 = deque(maxlen=int(settings.history2Len * self.numStepsPerSecond)) if settings.history3Len > 0.0: self.history3 = deque(maxlen=int(settings.history3Len * self.numStepsPerSecond)) if self.robotLibOn: self.robotLib.executeCommand("cmd#zero")
def _robot_specific_reset(self): if self.servo: RoboschoolForwardWalkerServo.robot_specific_reset(self) else: RoboschoolForwardWalker.robot_specific_reset(self) self.set_initial_orientation(yaw_center=0, yaw_random_spread=np.pi)
def robot_specific_reset(self): RoboschoolForwardWalker.robot_specific_reset(self) self.set_initial_orientation(yaw_center=0, yaw_random_spread=np.pi) self.head = self.parts["head"]