Categories > Logic > rex_gfsm

Introduction

Describe finite state machine.

Links


Categories > Logic > rex_gfsmIntroductionLinksDependenceUsageFlow chartGo to next stateState changing actionsInitial stateDebug

Dependence

None

Usage

Sample capx

Flow chart

State changing action On exit On enter Go to next state Transfer logicYesNoYesNoYesNo+Condition:On state changed----PreState --> CurStateHas+Condition:On transferin event sheet+Condition:On transfer----PreState --> CurStateHas+Condition:On exitin event sheet+Condition:On exit----PreStateHas+Condition:On enterin event sheet+Condition:On default exit+Condition:On enter----CurState+Condition:On default enterAction:Go to stateAction:Request+Condition:On transfer logic(CurState)Subevent:-Action:Set next state

Go to next state

State changing actions

Add actions under these conditions, which will be triggered when state is changed from Expression:PreState to Expression:CurState

  1. Condition:On state changed

  2. If Condition:On transfer is in event sheet,

    • Condition:On state changed

    • Else

      1. If Condition:On exit is in event sheet,

        • Condition:On exit
        • Else Condition:On default exit
      2. If Condition:On enter is in event sheet,

        • Condition:On enter
        • Else Condition:On default enter

DO NOT change state (Action:Request or Action:Go to state) under these conditions directly, or inserts a System action: wait (0) above Action:Request or Action:Go to state, which could suspend remaining actions until next tick.

Initial state

Set initial state in property Initial state.

Debug

Dump current state by Expression:CurState under Condition:On state changed, to track the state changing.