Beispiel #1
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='talker',container=5,ordinal=ordinal)

        self.add_mode2(4,'mode([],role(when,[singular,numeric]),option(using,[instance(~server)]))', self.__mode, self.__query, self.__cancel_mode, self.__attach_mode)
        self.add_mode2(7,'mode([],role(when,[singular,numeric]),role(called,[singular,numeric]),option(using,[instance(~server)]))', self.__cmode, self.__cquery, self.__cancel_mode, self.__attach_mode)
        self.add_verb2(1,'cancel([],None,role(None,[ideal([~server,event])]))', self.__cancel_verb)
        self.add_verb2(8,'cancel([],None,role(None,[singular,numeric]),role(called,[singular,numeric]))', self.__cancel_verb_called)
        self.add_verb2(5,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]))', self.__color_verb)
        self.add_verb2(6,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]),role(from,[singular,numeric]))', self.__all_color_verb)

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

        self[1] = bundles.Output(1,False, names='light output',protocols='revconnect')
        self.light_output = bundles.Splitter(self.domain,self[1])
        self.light_convertor = piw.lightconvertor(self.light_output.cookie())
        self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),self.domain)
        self.controller = piw.controller(self.light_aggregator.get_output(1),utils.pack_str(1))

        self.activation_input = bundles.VectorInput(self.controller.cookie(), self.domain,signals=(1,))

        self[2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.activation_input.local_policy(1,False),names='activation input')
        self[3] = atom.Atom(creator=self.__create,wrecker=self.__wreck)
        self[4] = PhraseBrowser(self.__eventbykey,self.__keylist)
Beispiel #2
0
    def __init__(self, database, master_agent, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             subsystem='controller',
                             container=2,
                             protocols='is_subsys',
                             ordinal=ordinal)
        self.database = database
        self.agent = master_agent
        self.domain = master_agent.domain

        self.add_verb2(1,
                       'control([],None,role(None,[concrete,singular]))',
                       callback=self.__control)
        self.add_verb2(
            2,
            'control([],None,role(None,[concrete,singular]),role(with,[numeric]))',
            callback=self.__controlwith)
        self.add_verb2(3, 'control([un],None)', callback=self.__uncontrol)

        self[4] = atom.Atom(creator=self.__create, wrecker=self.__wreck)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))

        self[1] = atom.Atom()
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(1, False),
                               names='activation input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(2, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(3, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(4, False),
                               names='yaw input')
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='strip position input')
Beispiel #3
0
    def __init__(self,address,ordinal):
        self.domain = piw.clockdomain_ctl()
        vc = atom.VerbContainer(clock_domain=self.domain)

        self.finder = talker.TalkerFinder()

        agent.Agent.__init__(self,signature=version,names='arranger', protocols='bind', container=(9,'agent',vc), ordinal=ordinal)

        self[1] = self.verb_container()

        self.model = arranger_native.model(self.domain)

        self.light_output = bundles.Output(1,False,names='light output',protocols='revconnect')
        self.light_splitter = bundles.Splitter(self.domain, self.light_output)
        self.light_convertor = piw.lightconvertor(True,self.light_splitter.cookie())
        self.view = arranger_native.view(self.model,self.light_convertor.cookie())

        self.ctlr_fb = piw.functor_backend(1,True)
        self.ctlr_fb.set_functor(piw.pathnull(0),self.view.control())
        self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(),self.domain,signals=(1,))
        self[2] = atom.Atom(domain=domain.Aniso(),policy=self.ctlr_input.policy(1,False),names='controller input')

        self.kinput = bundles.VectorInput(self.view.cookie(),self.domain,signals=(1,2,3,5))
        self[3] = atom.Atom(names='key inputs')
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.kinput.vector_policy(1,False),names='pressure input',protocols='nostage')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(2,False),names='roll input',protocols='nostage')
        self[3][3] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(3,False),names='yaw input',protocols='nostage')
        self[3][5] = atom.Atom(domain=domain.Aniso(), policy=self.kinput.vector_policy(5,False),names='key input')
        self[3][4] = self.light_output

        self.cinput = bundles.ScalarInput(self.model.cookie(),self.domain,signals=(1,2))
        self.cinput.add_upstream(self.verb_container().clock)
        self[4] = atom.Atom(names='metronome inputs')
        self[4][1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='song beat input')
        self[4][2] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(2,False),names='running input')

        self[5] = collection.Collection(creator=self.__createtarget,wrecker=self.__wrecktarget,names="row",inst_creator=self.__createtarget_inst,inst_wrecker=self.__wrecktarget_inst,protocols='hidden-connection explicit')

        self[7] = Parameters(self)

        self.__eventlist = EventList(self)
        self.__playstop = node.Server(change=self.__play_change)
        self.__playstop[1] = self.__eventlist
        
        self.set_private(self.__playstop)

        self.add_verb2(1,'play([],None)',create_action=self.__play,clock=True)
        self.add_verb2(2,'play([un],None)',create_action=self.__unplay,clock=True)
        self.add_verb2(3,'cancel([],None,role(None,[numeric]),option(called,[numeric]))',self.__cancel_verb)
        self.add_verb2(4,'clear([],None)',self.__clear_verb)
        self.add_verb2(5,'do([],None,role(None,[abstract]),role(when,[numeric]),option(called,[numeric]))', self.__do_verb)
        self.model.playstop_set(piw.make_change_nb(utils.slowchange(self.__play_set)))
Beispiel #4
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             ordinal=ordinal,
                             protocols='controller')

        self.domain = piw.clockdomain_ctl()

        self[4] = ConnectorList(self)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(False, self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5, 6))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.event_cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6))

        self[1] = atom.Atom(names='inputs')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(3, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(4, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='yaw input')
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(6, False),
                               names='strip position input')
        self[1][6] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.vector_policy(1, False),
                               names='key input')
        self[1][7] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.merge_nodefault_policy(
                                   2, False),
                               names='controller input')

        self.add_verb2(1, 'create([],None,role(None,[mass([connector])]))',
                       self.__create_connector)
        self.add_verb2(2, 'create([un],None,role(None,[mass([connector])]))',
                       self.__uncreate_connector)
Beispiel #5
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='scheduler',
                             container=6,
                             protocols='scheduler',
                             ordinal=ordinal)

        c = dict(c=schedproxy.get_constraints())

        self.add_mode2(
            1,
            'mode([],role(at,%(c)s),option(until,%(c)s),option(every,%(c)s))' %
            c, lambda t, a, u, e: self.__mode(t, tsm(a), tsm(u), tsm(e)),
            lambda a, u, e: self.__query(tsm(a), tsm(u), tsm(e)),
            self.__mode_cancel)
        self.add_mode2(2,
                       'mode([],role(until,%(c)s), option(every,%(c)s))' % c,
                       lambda t, u, e: self.__mode(t, {}, tsm(u), tsm(e)),
                       lambda u, e: self.__query({}, tsm(u), tsm(e)),
                       self.__mode_cancel)
        self.add_mode2(3, 'mode([],role(every,%(c)s))' % c,
                       lambda t, e: self.__mode(t, {}, {}, tsm(e)),
                       lambda e: self.__query({}, {}, tsm(e)),
                       self.__mode_cancel)

        self.add_verb2(4,
                       'cancel([],None,role(None,[ideal([~server,event])]))',
                       self.__verb_cancel)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.scheduler = piw.scheduler(4)
        self.input = bundles.ScalarInput(self.scheduler.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))

        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(1, False),
                               names='running input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(2, False),
                               names='song time input')
        self[2][3] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(3, False),
                               names='bar beat input')
        self[2][4] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(4, False),
                               names='song beat input')
        self[2][5] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(5, False),
                               names='bar input')

        self[3] = atom.Null(creator=self.__create, wrecker=self.__wreck)

        self[4] = atom.Atom(names='controller')
        self[4][1] = bundles.Output(1,
                                    False,
                                    names='light output',
                                    protocols='revconnect')
        self.control_output = bundles.Splitter(self.domain, self[4][1])
        self.light_convertor = piw.lightconvertor(self.control_output.cookie())
        self.controller = piw.controller(self.light_convertor.cookie(),
                                         utils.pack_str(1))
        self.control_input = bundles.VectorInput(self.controller.cookie(),
                                                 self.domain,
                                                 signals=(1, ))

        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.control_input.local_policy(
                                   1, False),
                               names='activation input')

        self[5] = EventBrowser(self.__eventlist)
Beispiel #6
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='talker',
                             ordinal=ordinal,
                             protocols='talker')

        self.add_verb2(
            2,
            'do([],None,role(None,[abstract]),role(when,[numeric]),option(called,[numeric]))',
            self.__do_verb)
        self.add_verb2(
            8, 'cancel([],None,role(None,[numeric]),option(called,[numeric]))',
            self.__cancel_verb)
        self.add_verb2(
            5, 'colour([],None,role(None,[numeric]),role(to,[numeric]))',
            self.__color_verb)
        self.add_verb2(
            6,
            'colour([],None,role(None,[numeric]),role(to,[numeric]),role(from,[numeric]))',
            self.__all_color_verb)
        self.add_verb2(9, 'do([re],None,role(None,[numeric]))',
                       self.__redo_k_verb)
        self.add_verb2(10, 'do([re],None)', self.__redo_all_verb)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.__size = 0
        self.finder = talker.TalkerFinder()

        self[1] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')

        self.light_output = bundles.Splitter(self.domain, self[1])
        self.light_convertor = piw.lightconvertor(False,
                                                  self.light_output.cookie())
        self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),
                                               self.domain)
        self.controller = piw.controller(self.light_aggregator.get_output(1),
                                         utils.pack_str(1, 2))

        self.activation_input = bundles.VectorInput(
            self.controller.event_cookie(), self.domain, signals=(1, 2))

        self[3] = collection.Collection(creator=self.__create,
                                        wrecker=self.__wreck,
                                        names='key',
                                        inst_creator=self.__create_inst,
                                        inst_wrecker=self.__wreck_inst,
                                        protocols='hidden-connection explicit')
        self[4] = PhraseBrowser(self.__eventlist, self.__keylist)

        self[5] = atom.Atom(
            domain=domain.Aniso(),
            policy=self.activation_input.merge_nodefault_policy(2, False),
            names='controller input')
        self[6] = atom.Atom(domain=domain.Aniso(),
                            policy=self.activation_input.vector_policy(
                                1, False),
                            names='key input')