Exemplo n.º 1
0
        def cb_bin_selector(self):

            #stop all motion before switching
            self.running=False
            self.cb_stop()

             # read configuration of target from qcombobox via header
            self.bin = read_bin_config(self.bin_selector.currentText())


            if is_connected_to_device(int(self.bin['stepper_address'],16)):
                self.controls_group.setEnabled(True)
                self.bin_status.addItem('[info] {} ready.'.format(self.bin['name']))
                self.stepper = Stepper(self.bin['name'], int(self.bin['stepper_address'], 16), self.bin['stepper_port'],int(self.bin['io_address'],16)
                                       ,self.bin['pin_low_limit_sns'], self.bin['pin_high_limit_sns'])
            else:
                self.controls_group.setEnabled(False)
                self.bin_status.addItem('[ERR ] {} not ready.'.format(self.bin['name']))

            if self.bin['enabled']:
                self.controls_group.setEnabled(True)
                self.bin_status.addItem('[info] {} enabled.'.format(self.bin['name']))
            else:
                self.controls_group.setEnabled(False)
                self.bin_status.addItem('[info] {} disabled'.format(self.bin['name']))
Exemplo n.º 2
0
        def __init__(self, dialog):
            Ui_Controller.__init__(self)
            self.setupUi(dialog)
            # Step 1a :  register callbacks for user interface events and sensors
            self.pb_clear.clicked.connect(self.cb_clear)
            self.pb_fwd.clicked.connect(self.cb_fwd)
            self.pb_rev.clicked.connect(self.cb_rev)
            self.pb_stop.clicked.connect(self.cb_stop)
            self.pb_reset.clicked.connect(self.cb_reset)
            self.pb_estop.clicked.connect(self.cb_estop)
            self.pb_get_dispensor_status.clicked.connect(
                self.cb_get_dispensor_status)
            # create state machine
            self.belt = Conveyor_FSM()
            self.running = True  #enable state machine

            #threads
            self.pb_conveyor_thread.clicked.connect(self.cb_conveyor_thread)

            # read configuration of default target, default is Bin-1

            # probably use this for  sorting recipes
            self.config = read_bin_config('Bin1')

            # create status update
            self.conveyor_status.addItem('[info] {}'.format("piface ready"))

            # conveyor counter
            self.idxcount = 0
Exemplo n.º 3
0
        def __init__(self, dialog):
            Ui_Controller.__init__(self)
            self.setupUi(dialog)
            self.running=False
        # Step 1a :  register callbacks for user interface events and sensors

            self.pb_to_top.clicked.connect(self.thread_to_top)
            self.pb_up.clicked.connect(self.cb_up)
            self.pb_cycle.clicked.connect(self.thread_cycle)
            self.pb_stop.clicked.connect(self.cb_stop)
            self.pb_down.clicked.connect(self.cb_down)
            self.pb_to_bottom.clicked.connect(self.thread_to_bottom)
            self.pb_clear.clicked.connect(self.cb_clear)
            self.pb_e_stop.clicked.connect(self.cb_e_stop)

            self.bin_selector.currentIndexChanged.connect(self.cb_bin_selector)

        # register 0 to 1 'rising edge'  edge detector callback
            self.detector_high_limit_sns = EdgeTrigger(self.cb_high_limit_sns)
            self.detector_low_limit_sns = EdgeTrigger(self.cb_low_limit_sns)

        # create main hardware object
        # name, stepper_address, stepper_port,servo_address,servo_port,io_address pin_low_level_sns, pin_high_level_sns, pin_top_level_sns,enabled

            #read bin configuration of default target, default is Bin-1
            self.bin=read_bin_config('Bin0')

            # check and create a list of dices
            self.i2c_list = list_of_i2c_steppers()
            self.bin_status.addItem('[info] {}'.format(self.i2c_list))
            self.bin_status.addItem('[info] {} devices detected.'.format(len(self.i2c_list)))
            #check and create default setup
            if self.bin['enabled']:   # from configuration
                self.controls_group.setEnabled(True)
                self.bin_status.addItem('[info] {} enabled'.format(self.bin['name']))
            else:
                self.controls_group.setEnabled(False)
                self.bin_status.addItem('[info] {} disabled'.format(self.bin['name']))

            if is_connected_to_device(int(self.bin['stepper_address'],16)):
                self.controls_group.setEnabled(True)
                self.bin_status.addItem('[info] {} ready.'.format(self.bin['name']))
                self.stepper = Stepper(self.bin['name'],int(self.bin['stepper_address'],16),self.bin['stepper_port'],int(self.bin['io_address'],16)
                                       ,self.bin['pin_low_limit_sns'],self.bin['pin_high_limit_sns'])
                self.stepper.start()
            else:
                self.controls_group.setEnabled(False)
                self.bin_status.addItem('[ERR ] {} not ready.'.format(self.bin['name']))

            # create IO object

            #TODO do as above
            self.expander = PCA9555(int(self.bin['io_address'],16))

            # max counts interleaved mode for progress bar display
            self.cnt_max = 5650 # initil calibration value
            self.cnt = 0
Exemplo n.º 4
0
        def cb_bin_selector(self):
            # read configuration of target from qcombobox via header
            # and convert to hex address
            # add how to get from bin1 to object creation
            self.servo = read_bin_config(self.bin_selector.currentText())

            if is_connected_to_device(int(self.servo['servo_address'], 16)):
                self.ejector_status.addItem('[info] {} ready.'.format(
                    self.servo['name']))
                self.ejector = Ejector(self.servo['name'],
                                       int(self.servo['servo_address'], 16),
                                       self.servo['servo_port'])
                self.led_ready.setEnabled(1)
                self.ejector.start()
            else:
                self.led_ready.setEnabled(0)
                self.ejector_status.addItem('[ERR ] {} not ready.'.format(
                    self.servo['name']))
Exemplo n.º 5
0
        def __init__(self, dialog):
            Ui_Controller.__init__(self)
            self.setupUi(dialog)
            self.running = False
            # Step 1a :  register callbacks for user interface events and sensors
            self.pb_clear.clicked.connect(self.cb_clear)
            self.bin_selector.currentIndexChanged.connect(self.cb_bin_selector)

            #threads
            self.pb_eject.clicked.connect(self.thread_eject)
            self.pb_eject_test.clicked.connect(self.thread_eject_test)

            # register 0 to 1 'rising edge'  edge detector callback

            # read configuration of default target, default is Bin-1
            self.servo = read_bin_config('Bin0')

            # create main hardware object
            # check and create a list of dices
            self.i2c_list = list_of_i2c_servos()

            if self.i2c_list:
                self.led_ready.setEnabled(1)
                self.ejector_status.addItem('[info] {}'.format(self.i2c_list))
                self.ejector_status.addItem(
                    '[info] {} device(s) detected.'.format(len(self.i2c_list)))
                # create a daefault ejector object at first address found
                self.ejector = Ejector("Bin-0", int(self.i2c_list[0], 16), 0)
            else:
                self.led_ready.setEnabled(0)
                self.ejector_status.addItem('[info] no device(s) detected.')

            #quick test eject
            #self.ejector.eject(150,600)
            #print "ejectors initialized and test complete !"

            # set qcombo box to first address
            self.bin_selector.setCurrentText(self.servo['name'])