Ejemplo n.º 1
0
    def setPosition(self, position=[None, None, None]):
        self.position.future.set(position)

    def setSpindleSpeed(self, speedFraction):
        #		self.machineControl.pwmRequest(speedFraction)
        pass


#------IF RUN DIRECTLY FROM TERMINAL------
if __name__ == '__main__':
    desktopFactory = virtualMachine(persistenceFile="test.vmp")
    #	desktopFactory.xyzNode.setMotorCurrent(1.1)
    #	desktopFactory.xyzNode.loadProgram('086-005a.hex')
    desktopFactory.xyzNode.setVelocityRequest(2)
    fileReader = rpc.fileRPCDispatch()
    fileReader.addFunctions(
        ('move', desktopFactory.move),
        ('jog', desktopFactory.jog
         ))  #expose these functions on the file reader interface.

    rpcDispatch = rpc.httpRPCDispatch(address='0.0.0.0', port=27272)
    notice(
        desktopFactory, 'Started remote procedure call dispatcher on ' +
        str(rpcDispatch.address) + ', port ' + str(rpcDispatch.port))
    rpcDispatch.addFunctions(
        ('move', desktopFactory.move),
        ('position', desktopFactory.getPosition), ('jog', desktopFactory.jog),
        ('disableMotors', desktopFactory.xyzNode.disableMotorsRequest),
        ('loadFile', fileReader.loadFromURL), ('runFile', fileReader.runFile),
        ('setPosition', desktopFactory.setPosition
Ejemplo n.º 2
0
		binsx = self.x1-self.x0/self.image_sizex
		binsy = self.y1-self.y0/self.image_sizey
		locations = []
		for i in range(0, binsx):
			for j in range(0, binsy):
				locations.append((i*self.image_sizex, j*self.image_sizey))
		return locations
			
#------IF RUN DIRECTLY FROM TERMINAL------
if __name__ == '__main__':
	gigamachine = virtualMachine(persistenceFile = "test.vmp", camnum = 2)
#	gigamachine.xyzNode.setMotorCurrent(1.1)
#	gigamachine.xyzNode.loadProgram(HEXFILE)
	gigamachine.xyzNode.setVelocityRequest(2)
#	gigamachine.xyzNode.setMotorCurrent(1)
	fileReader = rpc.fileRPCDispatch()
	fileReader.addFunctions(('move',gigmachine.move), ('jog', gigmachine.jog))	#expose these functions on the file reader interface.


	# remote procedure call initialization
	# uncomment if you want to use the tq.mit.edu/pathfinder interface
	#rpcDispatch = rpc.httpRPCDispatch(address = '0.0.0.0', port = 27272)
	#notice(gigmachine, 'Started remote procedure call dispatcher on ' + str(rpcDispatch.address) + ', port ' + str(rpcDispatch.port))
	#rpcDispatch.addFunctions(('move',gigmachine.move),
	#			('position', gigmachine.getPosition),
	#			('jog', gigmachine.jog),
	#			('disableMotors', gigmachine.xyzNode.disableMotorsRequest),
	#			('loadFile', fileReader.loadFromURL),
	#			('runFile', fileReader.runFile),
	#			('setPosition', gigmachine.setPosition))	#expose these functions on an http interface
	#rpcDispatch.addOrigins('http://tq.mit.edu', 'http://127.0.0.1:8000')	#allow scripts from these sites to access the RPC interface