コード例 #1
0
 def tick(self):
     print("  Clock tick")
     tb = self.data(TOP)
     tb.decrementTimer()
     if tb.getRemainingTime() == 0:
         print("  Finished")
         self.set_state(StaticFSM.State(Idle))
     else:
         tb.printTimer()
コード例 #2
0
    def onInitialize(self):
        self._fsm = StaticFSM.Machine(MicrowaveFsm.TOP, self)
        self._eventIn = EventPort.EventInPort("event", self._fsm)

        self.addInPort("event", self._eventIn)
        self._eventIn.bindEvent0("open", MicrowaveFsm.TOP.open)
        self._eventIn.bindEvent0("close", MicrowaveFsm.TOP.close)
        self._eventIn.bindEvent1("minute", MicrowaveFsm.TOP.minute,
                                 RTC.TimedLong(RTC.Time(0, 0), 0))
        self._eventIn.bindEvent0("start", MicrowaveFsm.TOP.start)
        self._eventIn.bindEvent0("stop", MicrowaveFsm.TOP.stop)
        self._eventIn.bindEvent0("tick", MicrowaveFsm.TOP.tick)

        return RTC.RTC_OK
コード例 #3
0
    def onInitialize(self):
        # Bind variables and configuration variable

        # Set InPort buffers

        # Set OutPort buffers

        # Set service provider to Ports

        # Set service consumers to Ports

        # Set CORBA Service Ports
        self._fsm = StaticFSM.Machine(testFSMpyFSM.Top, self)
        self._eventIn = EventPort.EventInPort("event", self._fsm)
        self.addInPort("event", self._eventIn)
        self._eventIn.bindEvent0("event1", testFSMpyFSM.Top.event1)
        self._eventIn.bindEvent0("event2", testFSMpyFSM.Top.event2)

        return RTC.RTC_OK
コード例 #4
0
ファイル: ModuleName.py プロジェクト: n-kawauchi/OpenRTP-aist
    def onInitialize(self):
        # Bind variables and configuration variable

        # Set InPort buffers

        # Set OutPort buffers

        # Set service provider to Ports

        # Set service consumers to Ports

        # Set CORBA Service Ports
        # Set FSM Ports
        self._fsm = StaticFSM.Machine(ModuleNameFSM.Top, self)
        self._FSMEventVarIn = EventPort.EventInPort("FSMEventPort", self._fsm)
        self.addInPort("FSMEventPort", self._FSMEventVarIn)

        return RTC.RTC_OK

        ###
        ##
        ## The finalize action (on ALIVE->END transition)
        ##
        ## @return RTC::ReturnCode_t
        #
        ##
        #def onFinalize(self):
        #
        #    self._fsm.shutdown()
        #    return RTC.RTC_OK

        ###
        ##
        ## The startup action when ExecutionContext startup
        ##
        ## @param ec_id target ExecutionContext Id
        ##
        ## @return RTC::ReturnCode_t
        ##
        ##
        #def onStartup(self, ec_id):
        #
        #    return RTC.RTC_OK

        ###
        ##
        ## The shutdown action when ExecutionContext stop
        ##
        ## @param ec_id target ExecutionContext Id
        ##
        ## @return RTC::ReturnCode_t
        ##
        ##
        #def onShutdown(self, ec_id):
        #
        #    return RTC.RTC_OK

        ###
        ##
        ## The activated action (Active state entry action)
        ##
        ## @param ec_id target ExecutionContext Id
        ##
        ## @return RTC::ReturnCode_t
        ##
        ##
        #def onActivated(self, ec_id):
        #
        #    return RTC.RTC_OK

        ###
        ##
        ## The deactivated action (Active state exit action)
        ##
        ## @param ec_id target ExecutionContext Id
        ##
        ## @return RTC::ReturnCode_t
        ##
        ##
        #def onDeactivated(self, ec_id):
        #
        #    return RTC.RTC_OK

        ###
        ##
        ## The execution action that is invoked periodically
        ##
        ## @param ec_id target ExecutionContext Id
        ##
        ## @return RTC::ReturnCode_t
        ##
        ##
        #def onExecute(self, ec_id):
        #
        self._fsm.run_event()
コード例 #5
0
 def minute(self, time_):
     self.set_state(StaticFSM.State(Programmed))
     self.dispatch(StaticFSM.Event(TOP.minute, time_))
コード例 #6
0
 def onInit(self):
     self.set_state(StaticFSM.State(Idle))
     return RTC.RTC_OK
コード例 #7
0
 def stop(self):
     self.set_state(StaticFSM.State(Idle))
コード例 #8
0
 def open(self):
     self.set_state(StaticFSM.State(Disabled))
コード例 #9
0
 def close(self):
     # self.setStateHistory(OpenRTM_aist.Macho.State(Operational))
     self.set_state(StaticFSM.State(Operational))
コード例 #10
0
 def onInit(self):
     self.set_state(StaticFSM.State(Operational))
     return RTC.RTC_OK
コード例 #11
0
 def start(self):
     self.set_state(StaticFSM.State(Cooking))
コード例 #12
0
 def Event02_Final(self, data):
     self.set_state(StaticFSM.State(FinalState))
コード例 #13
0
 def Event01_02(self, data):
     self.set_state(StaticFSM.State(State02))
コード例 #14
0
 def event2(self):
     self.set_state(StaticFSM.State(node3))
コード例 #15
0
 def event1(self):
     self.set_state(StaticFSM.State(node2))