Example #1
0
	def sendMsg(self, msg) :
		if self.isConnected :
			(axis, action) = msg
			if axis == 0 :
				if action == 'CALIB' :
					KNI.calibrate(0)
				elif action == 'SETHOME' :
					from KNI import TMovement
					self.home = TMovement()
					KNI.getPosition(self.home.pos)
					self.home.transition = KNI.PTP
					self.home.velocity = 50
					self.home.acceleration = 2
				elif action == 'MOVEHOME' :
					if self.home != None :
						KNI.executeMovement(self.home)

			else :
				if action == 'STOP' :
					KNI.moveMot(axis, KNI.getEncoder(axis), 50, 2)
				elif action == 'RIGHT' :
					if axis in self.minusMotors :
						KNI.moveMot(axis, 0, 50, 2)
					else :
						KNI.moveMot(axis, 31000, 50, 2)

				elif action == 'LEFT' :
					if axis in self.minusMotors :
						KNI.moveMot(axis, -31000, 50, 2)
					else :
						KNI.moveMot(axis, 0, 50, 2)

		else :
			print "Port is not connected"
Example #2
0
KNI.pushMovementToStack(m, stackname)

raw_input("Press [ENTER] to store fourth point (p2p movement).")
m = TMovement()
KNI.getPosition(m.pos)
m.transition = KNI.PTP
m.velocity = 50
m.acceleration = 2
KNI.pushMovementToStack(m, stackname)

raw_input("Press [ENTER] to store fifth and last point (p2p movement).")
m = TMovement()
KNI.getPosition(m.pos)
m.transition = KNI.PTP
m.velocity = 50
m.acceleration = 2
KNI.pushMovementToStack(m, stackname)

raw_input("Press [ENTER] to fix robot.")
KNI.allMotorsOn()

raw_input("Press [ENTER] to loop through the point list robot.")
repetitions = int(raw_input("How many repetitions? "))
KNI.runThroughMovementStack(stackname, repetitions)

KNI.executeMovement(home)

KNI.allMotorsOff()

#############################################################################################