def connectFunction(self): ip_adress=self.__ip_entry.get() valid=True try: socket.inet_aton(ip_adress) self.__ip_adress=ip_adress config_file=open("config.txt", "w") config_file.truncate() config_file.write(self.__ip_adress) config_file.close() except (socket.error,AttributeError): self.handleInternalErrors("invalid ip") valid=False if valid: try: self.__gloria=pcModule.pcModule(self.__ip_adress) self.enableButtons(True) self.__screenSaver=False self.__connect_button.config(text="disconnect",command=self.disconnect) except socket.error: self.handleInternalErrors("connection refused")
"""a simple test program for the pcModule to communicate with the glorious Gloria storage robot""" from pcModule import pcModule gloria=pcModule("localhost") gloria.updateSensors() gloria.start() def testAllSensors(): print("error codes:") print(gloria.getErrorCodes()) print("linesensor:") print(gloria.getLineSensor()) print("left distance") print(gloria.getDistanceSensor()[0]) print("right distance") print(gloria.getDistanceSensor()[1]) print("armposition X:") print(gloria.getArmPosition()[0]) print("armposition Y:") print(gloria.getArmPosition()[1]) print("armposition Z:") print(gloria.getArmPosition()[2]) print("armposition Pitch:") print(gloria.getArmPosition()[3]) print("armposition wrist:") print(gloria.getArmPosition()[4]) print("armposition grip:") print(gloria.getArmPosition()[5]) print("latest calibration was done:") print(gloria.getCalibration()) print("motors in auto mode:") print(gloria.getAutoMotor()) print("arm in auto mode: ")
#!/usr/bin/python #motor(L,R), arm(X,Y,Z,W,P,G), calibrate, status #automotor(M), autoarm(M), start? import sys from tkinter import * from tkinter import ttk from tkinter.ttk import * from pcModule import pcModule gloria=pcModule(str(sys.argv[1])) #gloria=pcModule("192.168.99.1") #gloria=pcModule("10.42.0.47") gloria.updateSensors() gloria.start() speed = 0 def main(): def motorL_get(): try: temp = int(motorL_entry.get()) motorL.set(temp) except ValueError: pass def motorR_get(): try: temp = int(motorR_entry.get()) motorR.set(temp)
from pcModule import pcModule import time gloria=pcModule("192.168.99.1") while True: gloria.updateSensors() print(gloria.getLineSensor()) time.sleep(0.1)