Beispiel #1
0
    def __init__(self, id=None, *args, **kwargs):
        super(VogelPanel, self).__init__(*args, **kwargs)
        self.id = id

        # define interfaces
        self.interfaces['comedi'] = comedi_.ComediInterface(
            device_name=_VOGEL_MAP[self.id][0])
        self.interfaces['pyaudio'] = pyaudio_.PyAudioInterface(
            device_name='dac%i' % self.id)

        # define inputs
        for in_chan in [ii + _VOGEL_MAP[self.id][2] for ii in range(4)]:
            self.inputs.append(
                hwio.BooleanInput(
                    interface=self.interfaces['comedi'],
                    params={
                        'subdevice': _VOGEL_MAP[self.id][1],
                        'channel': in_chan
                    },
                ))
        for out_chan in [ii + _VOGEL_MAP[self.id][4] for ii in range(8)]:
            self.outputs.append(
                hwio.BooleanOutput(
                    interface=self.interfaces['comedi'],
                    params={
                        'subdevice': _VOGEL_MAP[self.id][3],
                        'channel': out_chan
                    },
                ))
        self.speaker = hwio.AudioOutput(interface=self.interfaces['pyaudio'])

        # assemble inputs into components
        self.left = components.PeckPort(IR=self.inputs[0],
                                        LED=self.outputs[0],
                                        name='l')
        self.center = components.PeckPort(IR=self.inputs[1],
                                          LED=self.outputs[1],
                                          name='c')
        self.right = components.PeckPort(IR=self.inputs[2],
                                         LED=self.outputs[2],
                                         name='r')
        self.house_light = components.HouseLight(light=self.outputs[3])
        self.hopper = components.Hopper(IR=self.inputs[3],
                                        solenoid=self.outputs[4])

        # define reward & punishment methods
        self.reward = self.hopper.reward
        self.punish = self.house_light.punish
Beispiel #2
0
    def __init__(self, id=None):
        super(ZogCuePanel, self).__init__(id=id)

        for out_chan in [ii + _ZOG_MAP[self.id][4] for ii in range(5, 8)]:
            self.outputs.append(
                hwio.BooleanOutput(
                    interface=self.interfaces['comedi'],
                    params={
                        'subdevice': _ZOG_MAP[self.id][3],
                        'channel': out_chan
                    },
                ))
        self.cue = components.RGBLight(red=self.outputs[7],
                                       green=self.outputs[5],
                                       blue=self.outputs[6],
                                       name='cue')
Beispiel #3
0
    def __init__(self,id=None, *args, **kwargs):
        super(PiPanel, self).__init__(*args, **kwargs)
        self.id = id
        self.pwm_outputs = []

        # define interfaces
        self.interfaces['raspi_gpio_'] = raspi_gpio_.RaspberryPiInterface(device_name='zog0')
        self.interfaces['pyaudio'] =  pyaudio_.PyAudioInterface()

        # define inputs
        for in_chan in INPUTS:
            self.inputs.append(hwio.BooleanInput(interface=self.interfaces['raspi_gpio_'],
                                                 params = {'channel': in_chan}))
        for out_chan in OUTPUTS:
            self.outputs.append(hwio.BooleanOutput(interface=self.interfaces['raspi_gpio_'],
                                                 params = {'channel': out_chan}))

        for pwm_out_chan in PWM_OUTPUTS:
            self.pwm_outputs.append(hwio.PWMOutput(interface=self.interfaces['raspi_gpio_'],
                                                  params = {'channel': pwm_out_chan}))

        self.speaker = hwio.AudioOutput(interface=self.interfaces['pyaudio'])

        # assemble inputs into components
        # Standard Peckports
        self.left = components.PeckPort(IR=self.inputs[1],LED=self.pwm_outputs[4],name='l', inverted=False)
        self.center = components.PeckPort(IR=self.inputs[2],LED=self.pwm_outputs[5],name='c', inverted=False)
        self.right = components.PeckPort(IR=self.inputs[3],LED=self.pwm_outputs[6],name='r', inverted=False)
        
        # Hopper
        self.hopper = components.Hopper(IR=self.inputs[0],solenoid=self.outputs[0], inverted=True)


        # House Light
        self.house_light = components.LEDStripHouseLight(lights=[self.pwm_outputs[0],
                                                                 self.pwm_outputs[1],
                                                                 self.pwm_outputs[2],
                                                                 self.pwm_outputs[3]])
        # define reward & punishment methods
        self.reward = self.hopper.reward
        self.punish = self.house_light.punish