Source

puma / mdc-telnet.py

Diff from to

File mdc-telnet.py

 					self.wfile.write("! go error\n")
 				continue
 
+			if line.startswith("move,"):
+				if not self.move(line):
+					self.wfile.write("! move error\n")
+				continue
+
 			m = re.match('^([0-9]),(-?[0-9]+)(?:,([0-9]+))?$', line)
 			if m is None:
 				self.wfile.write("! parse error\n")
 		MDC.move_all(ms, dest)
 		return True
 
+	# Parse a "move" command with the one joint number,
+	# one position and one speed:
+	# move,6,-9000,1000
+	def move(self,line):
+		args = line.split(",")
+		if len(args) != 4:
+			return False
+		
+		axis = int(args[1])
+		pos = int(args[2])
+		vel = int(args[3])
+		return MDC.moveto(axis, pos, vel)
+
 	def tx_loop(self):
 		while self.alive:
 			#counts = MDC.get_volts()
 	allow_reuse_address = True
 
 if __name__ == "__main__":
-	devices = ["/dev/tty.usbmodemfd1231", "/dev/tty.usbmodemfd1241", "/dev/tty.usbmodemfd1271"]
+	devices = ["/dev/tty.usbmodem1d1131", "/dev/tty.usbmodem1d1141", "/dev/tty.usbmodem1d1171"]
 	controllers = [MDC.MDC(dev) for dev in devices]
 
 	log_thread = threading.Thread(target = write_log)