Commits

Anonymous committed 8757da3

allow adjustments to be made on the fly to the runtime offsets

Comments (0)

Files changed (2)

 			time.sleep(dt * 0.4)
 		self.last_xyz = xyz[:]
 
+	def adjust(self,axis,delta_theta):
+		new_theta = self.joints[axis].theta + delta_theta * pi / 180.0
+		print "axis " + str(axis) + ": " + str(round(new_theta,2)) + "=" + str(round(self.joints[axis].theta,2)) + " + " + str(round(delta_theta,2))
+		self.joints[axis].theta = new_theta
 
 if __name__ == "__main__":
 	import PumaConfig
 				vel = 1
 			continue
 
+		g = re.match("^adjust ([1-6]+) (-?[0-9.]+)", line)
+		if g is not None:
+			r.adjust(int(g.group(1))-1, float(g.group(2)))
+			continue
+
 		g = re.match("^(-?[0-9]+ -?[0-9]+ -?[0-9]+)$", line)
 		if g is not None:
 			xyz = [int(x) for x in g.group(1).split(" ")]
 			if g is not None:
 				r.swing(int(g.group(1)))
 				continue
+			g = re.match("^adjust ([1-6]+) (-?[0-9.]+)", line)
+			if g is not None:
+				r.adjust(int(g.group(1)-1), float(g.group(2)))
+				continue
+
 
 			self.wfile.write("?\r\n")
 		self.alive = False