Commits

Trammell Hudson committed aef2c9d

telnet go command handler moved into MDC.move_all()

  • Participants
  • Parent commits 2177320

Comments (0)

Files changed (4)

 	chan.moveto(pos, vel)
 	return True
 
+def move_all(ms, dest):
+	counts = get_counts()
+	for i in range(0,6):
+		if counts[i] == 'X':
+			continue
+		new_pos = dest[i]
+		delta = int(counts[i]) - new_pos
+		if delta < 0:
+			delta = -delta
+		if ms != 0:
+			moveto(i+1, new_pos, delta * 1000 / ms)
+		else:
+			moveto(i+1, new_pos, 0)
 
 class MDC_channel:
 	def __init__(self, mdc, channel, axis):
 	while True:
 		counts = MDC.get_counts()
 		r.update([int(x) for x in counts])
-		print [int(x) for x in counts], [int(x) for x in r.p], [round(x,3) for x in r.s], [round(x,3) for x in r.n]
+		#print [int(x) for x in counts], [int(x) for x in r.p], [round(x,3) for x in r.s], [round(x,3) for x in r.n]
+		print [int(x) for x in r.p], [round(x,3) for x in r.a], [round(x,3) for x in r.s], [round(x,3) for x in r.n]
 		#print [int(x) for x in counts], [int(x*180/pi) for x in r.theta]
 		time.sleep(0.5)
 }
 
 my %points = (
+s1 => [-6736,-10160,11759,-6396,2492,-4085],
+s2 => [-5252,-10021,12731,-7542,3116,-4056],
+s3 => [-2839,-10231,12864,-9750,4291,-3805],
 1 => [-12745,-9431,13189,16345,-11436,39],
 2 => [-6992,-16587,2803,13675,-6883,-2997],
 3 => [-12731,-8874,17593,17647,-11193,2494],
 home => [ 0,0,0,0,0,0],
 );
 
-my $speed = 20000;
+my $speed = 1000;
 
 while(<>)
 {

File mdc-telnet.py

 		if len(args) != 8:
 			return False
 		ms = int(args[1])
-		counts = MDC.get_counts()
-		for i in range(0,6):
-			if counts[i] == 'X':
-				continue
-			new_pos = int(args[i+2])
-			delta = int(counts[i]) - new_pos
-			if delta < 0:
-				delta = -delta
-			if ms != 0:
-				MDC.moveto(i+1, new_pos, delta * 1000 / ms)
-			else:
-				MDC.moveto(i+1, new_pos, 0)
+		dest = [int(x) for x in args[2:]]
+		MDC.move_all(ms, dest)
 		return True
 
 	def tx_loop(self):