Commits

German Larrain committed ac1d541

demos.sensors.base.CentrifugalForce: simplified 'set_joint1_speed' and 'apply_friction'.

Comments (0)

Files changed (1)

demos/sensors/base.py

 
 	def set_joint1_speed(self):
 		"""Set joint1's speed."""
-		self.sim.get_joint('r1').joint.set_speed(self.joint1_vel_user,
-			self.JOINT1_FMAX)
+		joint = self.sim.get_joint('r1').joint
+		joint.set_speed(self.joint1_vel_user, self.JOINT1_FMAX)
 
 	def apply_friction(self):
 		"""Calculate friction torque and apply it to joint 'r2'."""
-		torque = -self.JOINT2_ANGLE_RATE_CONTROLLER_KP *\
-			self.sim.get_joint('r2').joint.angle_rate
-		self.sim.get_joint('r2').joint.add_torque(torque)
+		kp = self.JOINT2_ANGLE_RATE_CONTROLLER_KP
+		joint = self.sim.get_joint('r2').joint
+		joint.add_torque(-kp * joint.angle_rate)
 
 
 class CentrifugalForce2(CentrifugalForce):