clenup fakerobot script

This commit is contained in:
Olivier R-D 2015-05-17 11:41:02 +02:00
parent d6f1408c2c
commit 54d6a312cf

View File

@ -41,12 +41,11 @@ class Server(socketserver.ThreadingMixIn, socketserver.TCPServer):
self.shutdown() self.shutdown()
class FakeRobot(object):
def run(self):
if __name__ == "__main__": host = "localhost"
# Port 0 means to select an arbitrary unused port port = 30002
host, port = "localhost", 30002 # this is the standard secondary port for a UR robot
server = Server((host, port), RequestHandler) server = Server((host, port), RequestHandler)
server.init() server.init()
server_thread = threading.Thread(target=server.serve_forever) server_thread = threading.Thread(target=server.serve_forever)
@ -64,3 +63,11 @@ if __name__ == "__main__":
finally: finally:
print("Shutting down server") print("Shutting down server")
server.close() server.close()
if __name__ == "__main__":
r = FakeRobot()
r.run()