Source

puma / Puma.py

Diff from to
 		self.joints = joints
 		self.counts = [0,0,0,0,0]
 		self.last_xyz = False
+		self.volts = 0
 		self.fk = PumaFK(joints)
 		self.ik = PumaIK(False, True, joints)
 		self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 				break
 			line = line.strip()
 			counts = line.split(",")
-			if len(counts) != 6:
+			if len(counts) != 7:
 				print "Parse error: " + line
 				continue
-			self.counts = [int(x) for x in counts]
+			volts = int(counts[0]) / 10.0
+			self.counts = [int(x) for x in counts[1:]]
 			#print "rx: " + line
 			self.fk.update(self.counts)
 			#print [int(x) for x in r.fk.p]
 
+			if volts < 12.0 and self.volts > 12.0:
+				print "NO VOLTAGE"
+			elif volts > 12.0 and self.volts < 12.0:
+				print "DANGER: Motors are live: " + str(round(volts,2)) + " volts"
+			self.volts = volts
+
 		print "RX THREAD EXITED"
 		self.live = False