def do_connect(self, arg): """ connect, Open uArm Port, if more than one uArm Port found, will prompt options to choose. Please connect to uArm before you do any control action """ if self.uarm is None: ports = uarm_ports() if len(ports) > 1: uarm_port = get_uarm_port_cli() try: self.uarm = pyuarm.uArm(uarm_port) except pyuarm.UnknownFirmwareException: print( "Unknown Firmware, please use {}{}uarm-firmware -upgrade{}{} to your firmware" .format(Back.BLACK, Fore.WHITE, Fore.RESET, Back.RESET)) elif len(ports) == 1: self.uarm = pyuarm.uArm() elif len(ports) == 0: print("No uArm ports is found.") else: if self.uarm.is_connected(): print("uArm is already connected, port: {}".format( self.uarm.port)) else: if self.uarm.reconnect(): print("uArm port: {} is reconnected")
def connect(self): try: self.myuArm = pyuarm.uArm(debug=True) print self.myuArm except: print "Couldn't get a connection to the uArm" return
def get_uarm_version(self): if self.uarm_port is not None or self.uarm_port != "": print "Reading Firmware version from uArm..." try: uarm = pyuarm.uArm(port=self.uarm_port) self.uarm_firmware_version = uarm.firmware_version uarm.disconnect() except pyuarm.UnkwonFirmwareException: print "Unknown Firmware version." except pyuarm.NoUArmPortException: print "No uArm is connected."
def do_connect(self, arg): """ connect, Open uArm Port, if more than one uArm Port found, will prompt options to choose. Please connect to uArm before you do any control action """ if self.uarm is None: ports = uarm_ports() if len(ports) > 1: uarm_port = get_uarm_port_cli() try: self.uarm = pyuarm.uArm(uarm_port) except pyuarm.UnknownFirmwareException: print(("Unknown Firmware, please use {}{}uarm-firmware -upgrade{}{} to your firmware" .format(Back.BLACK, Fore.WHITE,Fore.RESET, Back.RESET))) elif len(ports) == 1: self.uarm = pyuarm.uArm() elif len(ports) == 0: print ("No uArm ports is found.") else: if self.uarm.is_connected(): print(("uArm is already connected, port: {}".format(self.uarm.port))) else: if self.uarm.reconnect(): print ("uArm port: {} is reconnected")
def get_uarm(): """ =============================== Get First uArm Port instance =============================== It will return the first uArm Port detected by **pyuarm.tools.list_uarms**, If no available uArm ports, will print *There is no uArm port available* .. raw:python >>> import pyuarm >>> uarm = pyuarm.get_uarm() There is no uArm port available :returns: uArm() Instance """ ports = uarm_ports() if len(ports) > 0: return pyuarm.uArm(port=ports[0]) else: print("There is no uArm port available")
def get_uarm(): """ =============================== Get First uArm Port instance =============================== It will return the first uArm Port detected by **pyuarm.tools.list_uarms**, If no available uArm ports, will print *There is no uArm port available* .. raw:python >>> import pyuarm >>> uarm = pyuarm.get_uarm() There is no uArm port available :returns: uArm() Instance """ ports = uarm_ports() if len(ports) > 0: return pyuarm.uArm(port=ports[0]) else: print("There is no uArm port available") return None
import pyuarm import time arm = pyuarm.uArm() if not arm.is_connected(): raise SystemExit() #fetch card position, at the table fetchCard = [-0.71, -9.72, 8.7] #home position home = [-1.49, -10.03, 18.9] time_spend = 5 arm.move_to(home[0], home[1], home[2], None, pyuarm.ABSOLUTE, time_spend, pyuarm.PATH_LINEAR, pyuarm.INTERP_EASE_INOUT_CUBIC) #INTERP_EASE_INOUT_CUBIC, INTERP_LINEAR, INTERP_EASE_INOUT, INTERP_EASE_IN, INTERP_EASE_OUT arm.move_to(fetchCard[0], fetchCard[1], fetchCard[2], None, pyuarm.ABSOLUTE, time_spend, pyuarm.PATH_LINEAR, pyuarm.INTERP_EASE_INOUT_CUBIC) #time.sleep(0.1) arm.pump_control(1) arm.move_to(home[0], home[1], home[2], None, pyuarm.ABSOLUTE, time_spend, pyuarm.PATH_LINEAR, pyuarm.INTERP_EASE_INOUT_CUBIC) arm.pump_control(0)