FunctionalStateMachine.StateMachineType
mutable struct StateMachine{T}

Generic state machine functor type.

Example

bar!(usrdata) = IncrementalInference.exitStateMachine
foo!(usrdata) = bar!

sm = StateMachine(next=foo!)
usrdata = nothing
while st(usrdata); end

Notes

  • Also see IncrementalInference/test/testStateMachine.jl
FunctionalStateMachine.StateMachineMethod

Run state machine function (as functor).

Notes

  • timeout::Union{Real,Nothing} is optional with default =nothing.
    • this code is skipped in lowered and llvm code if not used
    • subroutine will use pollinterval::Real [seconds] to interrogate during timeout::Real [seconds] period.
  • can stop FSM early by using any of the following:
    • breakafter, iterlimit.
  • Can injectDelayBefore a function st.next to help with debugging.
  • can print FSM steps with verbose=true.
    • verbosefid::IOStream is used as destination for verbose output, default is stdout.
  • FSM steps and userdata can be recorded in standard history format using recordhistory=true.
  • housekeeping_cb is callback to give user access to StateMachine internals and opportunity to insert bespoke operations.

Example

bar!(usrdata) = IncrementalInference.exitStateMachine
foo!(usrdata) = bar!

sm = StateMachine(next=foo!)
usrdata = nothing
while st(usrdata); end
FunctionalStateMachine.animateStateMachineHistoryByTimeFunction

Draw simultaneously separate time synchronized frames from each of the desired state machines. These images can be produced into synchronous side-by-side videos which allows for easier debugging and comparison of concurrently running state machines.

FunctionalStateMachine.histGraphStateMachineTransitionsFunction

Create a Graphs.incdict object and populate with nodes (states) and edges (transitions) according to the contents of parameters passed in.

Notes:

  • Current implementation repeats duplicate transitions as new edges.