Commits

German Larrain committed f2a7e6a

robot.sensors: added 'JointForce', analogous to 'JointTorque'.

  • Participants
  • Parent commits f74fde9
  • Branches dev-sensors

Comments (0)

Files changed (1)

File ars/model/robot/sensors.py

 		return self._sim.sim_time
 
 
+class JointForce(SingleSignalSensor):
+
+	"""Sensor measuring force 'added' to a joint."""
+
+	signal = signals.JOINT_POST_ADD_FORCE
+
+	def __init__(self, sim_joint, sim):
+		super(JointForce, self).__init__(signal=self.signal,
+			sender=sim_joint.joint)
+		self._sim = sim
+
+	def _build_data(self, sender, *args, **kwargs):
+		return SensorData(**{'force': kwargs.get('force')})
+
+	def _get_time(self):
+		return self._sim.sim_time
+
+
 class Laser(Sensor):
 
 	"""Laser scanner."""