Пример #1
0
 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")
Пример #2
0
    def __init__(self, uarm=None, log_function=None):
        if uarm is not None:
            self.uarm = uarm
        elif len(uarm_ports()) > 0:
            self.uarm = get_uarm()
        else:
            raise NoUArmPortException('No available uArm Founds')

        if log_function is not None:
            self.log_function = log_function
        else:
            self.log_function = self.default_log
        self.servo_calibrate_timeout = 300
        self.is_all_calibrated = False
        self.is_linear_calibrated = False
        self.is_manual_calibrated = False
        self.is_stretch_calibrated = False
Пример #3
0
    def __init__(self, uarm=None, log_function=None):
        if uarm is not None:
            self.uarm = uarm
        elif len(uarm_ports()) > 0:
            self.uarm = get_uarm()
        else:
            raise NoUArmPortException('No available uArm Founds')

        if log_function is not None:
            self.log_function = log_function
        else:
            self.log_function = self.default_log
        self.servo_calibrate_timeout = 300
        self.is_all_calibrated = False
        self.is_linear_calibrated = False
        self.is_manual_calibrated = False
        self.is_stretch_calibrated = False
Пример #4
0
 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")
Пример #5
0
 def get_uarm_port(self):
     uarm_list = uarm_ports()
     if len(uarm_list) > 0:
         self.uarm_port = uarm_list[0]
     else:
         print "No uArm is connected."
Пример #6
0
 def get_uarm_port(self):
     uarm_list = uarm_ports()
     if len(uarm_list) > 0:
         self.uarm_port = uarm_list[0]
     else:
         print "No uArm is connected."
Пример #7
0
def get_uarm_port():
    uarm_list = uarm_ports()
    if len(uarm_list) > 0:
        return uarm_list[0]
    else:
        print "No uArm is connected."