Commits

Anonymous committed 499522b

Tweak EPPR to be more realistic, limit speeds to 1000 and handle hold better

Comments (0)

Files changed (2)

 		if delta < 0:
 			delta = -delta
 		if ms != 0:
-			moveto(i+1, new_pos, delta * 1000 / ms + 1)
+			moveto(i+1, new_pos, delta * 100 / ms + 1)
 		else:
 			moveto(i+1, new_pos, 0)
 
 
 	def moveto(self, count, speed=0):
 		if speed is not None and speed != 0:
-			if speed > 30000:
-				speed = 30000
-			if speed < 100:
-				speed = 100
+			if speed > 1000:
+				speed = 1000
+			if speed < 1:
+				speed = 1
 			self.mdc.send("!S " + self.channel + " " + str(int(speed)))
 		print str(self.axis) + ": " + str(int(count)) + " @ " + str(int(speed))
 		self.mdc.send("!P " + self.channel + " " + str(int(count)))
 		for channel in ['1','2']:
 			self.send("^CLERD " + channel + " 0")
 			time.sleep(0.1)
-			self.send("^KP " + channel + " 20")
+			self.send("^EPPR " + channel + " 1000")
 			time.sleep(0.1)
-			self.send("^KD " + channel + " 60")
+			self.send("^KP " + channel + " 2")
+			time.sleep(0.1)
+			self.send("^KD " + channel + " 0")
 			time.sleep(0.1)
 			self.send("^KI " + channel + " 0")
 			time.sleep(0.1)
-			self.send("!s " + channel + " 4000")
+			self.send("!s " + channel + " 100")
 			time.sleep(0.1)
-			self.send("!ac " + channel + " 40000")
+			self.send("!ac " + channel + " 2000")
 			time.sleep(0.1)
-			self.send("!dc " + channel + " 40000")
+			self.send("!dc " + channel + " 2000")
 			time.sleep(0.1)
 
 		# Configure the telemetry stream
 	def home(self):
 		self.move_raw(10000, [0,0,0,0,0,0])
 	def start(self):
-		self.move_raw(20000, [4552, 3893, -16821, 23999, -11607, -4646])
+		self.move_raw(20000, [0, 5278, -10299, 26100, -6638, -5703])
+
+	def hold(self):
+		counts = self.counts[:]
+		for i in range(0,6):
+			self.moveto(i+1, counts[i], 1000)
 
 	def swing(self, speed):
 		cur = self.counts[5]
 			r.swing(10000)
 			continue
 		if line == "hold":
-			r.move_raw(1000, r.counts)
+			r.hold()
 			r.last_xyz = False
 			print "Holding " + str(r.counts) + ": xyz " + str([int(x) for x in r.fk.p])
 			continue