Exemplo n.º 1
0
 def init_ctrl(self):
     if self.ctrl == 'test':
         cam = None
         rb = None
         stepper = None
     else:
         print('Init. Cam..')
         self.cam = ELP_Camera(0)
         print('Init. Relay..')
         self.rb = init_rb()
         print('Init. Stepper..')
         if self.ctrl == 'stepper':
             self.stepper = Stepper(pulse_time=0.00050)
         elif self.ctrl == 'spinspin':
             self.stepper = SpinSpin(config_file='spinspin_config.json',
                                     pulse_time=0.0005)
         print('Init. Control...')
         self.control = AsiController(config_file='./asi_config.yml',
                                      init_xy=False)
Exemplo n.º 2
0
    def camera_test(self, ch='all', callback=None):
        from capture_msi import init_rb, STD_EXPOSURE
        import numpy as np
        from time import time, sleep

        def show_frame():
            _, frame = self.cap.read()
            print(frame.mean())
            cv2.imshow('', frame)
            if callback is not None:
                callback(frame)
        rb = init_rb()
        if ch == 'all':
            for n in range(8):
                sleep(.1)
                state = np.zeros(8)
                state[n] = 1
                rb.set_state(state)
                t0 = time()
                while time() < t0 + 1:
                    show_frame()
                    if cv2.waitKey(1) & 0xFF == ord('q'):
                        break
        else:
            state = np.zeros(8)
            state[ch - 1] = 1
            rb.set_state(state)
            while True:
                show_frame()
                if cv2.waitKey(1) & 0xFF == ord('q'):
                    break
        state = np.zeros(8)
        rb.set_state(state)
        self.cap.release()
        cv2.destroyAllWindows()
        assert False
Exemplo n.º 3
0
from capture_msi import init_rb
from stepper_control import Stepper
from elp_usb_cam import ELP_Camera
import numpy as np
import time

rb = init_rb()
led_ch = {
    'g' : 1, 
    'b' : 2,
    'w' : 5,
    'r' : 6,
    'o' : 7
}

state = np.ones(8)
rb.set_state(state)