예제 #1
0
    def __init__(self,names,ordinal,dom,remove,keys):
        self.kbd_keys = keys
        agent.Agent.__init__(self,names=names,ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='browse is_subsys')

        self.remover=remove

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self[1] = bundles.Output(1,False,names='activation output')
        self[2] = bundles.Output(2,False,names='pressure output')
        self[3] = bundles.Output(3,False,names='roll output')
        self[4] = bundles.Output(4,False,names='yaw output')

        self[5] = bundles.Output(1,False,names='strip position output',ordinal=1)

        self[7] = bundles.Output(1,False,names='breath output')
        self[10] = bundles.Output(2,False,names='absolute strip output',ordinal=1)

        self[12] = bundles.Output(1,False,names='pedal output',ordinal=1)
        self[13] = bundles.Output(1,False,names='pedal output',ordinal=2)
        self[14] = bundles.Output(1,False,names='pedal output',ordinal=3)
        self[15] = bundles.Output(1,False,names='pedal output',ordinal=4)

        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[8] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self[100] = VirtualKey(self.kbd_keys)

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.s1output = bundles.Splitter(self.domain,self[5],self[10])
        self.boutput = bundles.Splitter(self.domain,self[7])
        self.poutput1 = bundles.Splitter(self.domain,self[12])
        self.poutput2 = bundles.Splitter(self.domain,self[13])
        self.poutput3 = bundles.Splitter(self.domain,self[14])
        self.poutput4 = bundles.Splitter(self.domain,self[15])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.s1output.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(5,self.boutput.cookie(),piw.first_filter(5)) 
        self.kclone.set_filtered_output(6,self.poutput1.cookie(),piw.first_filter(6))
        self.kclone.set_filtered_output(7,self.poutput2.cookie(),piw.first_filter(7))
        self.kclone.set_filtered_output(8,self.poutput3.cookie(),piw.first_filter(8))
        self.kclone.set_filtered_output(9,self.poutput4.cookie(),piw.first_filter(9))

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.courses())

        self.add_verb2(4,'maximise([],None,role(None,[mass([pedal])]))',self.__maximise)
        self.add_verb2(5,'minimise([],none,role(None,[mass([pedal])]))',self.__minimise)

        self.__timestamp = piw.tsd_time()
        self.update()
예제 #2
0
    def __init__(self,usbname,ordinal,dom,remove):
        agent.Agent.__init__(self,names='keyboard pico',ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='is_subsys')

        self.usbname=usbname
        self.remover=remove

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self[1] = bundles.Output(1,False, names='activation output')
        self[2] = bundles.Output(2,False, names='pressure output')
        self[3] = bundles.Output(3,False, names='roll output')
        self[4] = bundles.Output(4,False, names='yaw output')

        self[5] = bundles.Output(1,False, names='strip position output')
        self[6] = bundles.Output(1,False, names='breath output')
        self[8] = bundles.Output(2,False, names='absolute strip output')
        
        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[7] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.soutput = bundles.Splitter(self.domain,self[5],self[8])
        self.boutput = bundles.Splitter(self.domain,self[6])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.soutput.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(3,self.boutput.cookie(),piw.first_filter(3))
        self.keyboard=pkbd_native.bundle(usbname,self.kclone.cookie(),utils.notify(self.dead),utils.changify(self.signal))

        self[100] = VirtualKey()
        #self[102] = vc

        self[251] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold1(), protocols='input output', names='soft threshold', policy=atom.default_policy(self.keyboard.set_threshold1))
        self[249] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold2(), protocols='input output', names='hard threshold', policy=atom.default_policy(self.keyboard.set_threshold2))
        self[240] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_roll_axis_window(), protocols='input output', names='roll axis window', policy=atom.default_policy(self.keyboard.set_roll_axis_window))
        self[241] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_yaw_axis_window(), protocols='input output', names='yaw axis window', policy=atom.default_policy(self.keyboard.set_yaw_axis_window))
        self[242] = atom.Atom(domain=domain.Bool(), init=False, protocols='input output nostage', names='k logging', policy=atom.default_policy(self.keyboard.enable_key_logging))

        f=self.keyboard.led_functor()
        self.led_backend.set_functor(piw.pathnull(0),f)

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.__courses())