Tekkotsu State Machines Drill

  1. A state machine is a collection of ____ and ____.
    Answer
    nodes and transitions
  2. What is the most basic state machine node class called?
    Answer
    StateNode
  3. What is the most basic state machine transition class called?
    Answer
    Transition
  4. What is the parent class of StateNode?
    Answer
    BehaviorBase
  5. What is the parent class of Transition?
    Answer
    BehaviorBase
  6. What action does a StateNode take?
    Answer
    None; it just sits there waiting for a transition to fire.
  7. What type of node is used to play a sound?
    Answer
    SoundNode
  8. What type of node is used to make LEDs flash?
    Answer
    LedNode
  9. What type of node is used to make the robot walk?
    Answer
    WalkNode
  10. What method is used to construct the nodes of a state machine?
    Answer
    setup()
  11. What method is used to destroy the nodes of a state machine?
    Answer
    teardown()
  12. How does a SoundNode indicate that it has finished playing the sound?
    Answer
    It posts a status event
  13. How does a LedNode indicate that it has finished a flash operation?
    Answer
    It posts a status event
  14. How does a WalkNode indicate that it has finished walking?
    Answer
    It posts a status event
  15. What type of transition checks for completion of a state node's action?
    Answer
    CompletionTrans
  16. What kind of event does a CompletionTrans look for?
    Answer
    A status event posted by the transition's source state node
  17. What does a NullTrans do?
    Answer
    Null transition: it fires immediately rather than waiting for a condition to become true.
  18. How do you tell a state machine to wait for 3 seconds?
    Answer
    Set up a TimeOutTrans that will fire after 3 seconds.
  19. In what units is time measured when specifying a TimeOutTrans?
    Answer
    milliseconds
  20. How do you get a transition to play a sound when it fires?
    Answer
    Call its setSound method.
  21. What does an EventTrans do?
    Answer
    Waits for the specified event to occur, then fires.
  22. What is the shorthand notation for a NullTrans?
    Answer
    =N=>
  23. What is the shorthand notation for a CompletionTrans?
    Answer
    =C=>
  24. What is the shorthand notation for a 3 second TimeOutTrans?
    Answer
    =T(3000)=>
  25. What does the $ mean in this expression: foo: SoundNode($,"barkmed.wav")
    Answer
    The $ is a place-holder for the name of the node, which is "foo".
  26. What does the $ mean in this expression: >==CompletionTrans($, $$, 1)==> bar
    Answer
    The $ is a place-holder for the name of the transition, which is probably something like "completiontrans1"
  27. What does the $$ mean in this expression: >==CompletionTrans($, $$, 1)==> bar
    Answer
    The $$ refers to the target of the transition, which is the node bar.
  28. If your behavior is called PoodleBehavior, and it uses the state machine shorthand notation, what should your source file be called?
    Answer
    PoodleBehavior.cc.fsm
  29. What line is used to signal the beginning of state machine shorthand notation?
    Answer
    #statemachine
  30. What line is used to signal the end of state machine shorthand notation?
    Answer
    #endstatemachine
  31. Where in your behavior's source file should the state machine shorthand notation go?
    Answer
    Inside the definition of setup()
  32. How can you use the event logger to monitor state machine execution?
    Answer
    Tell the event logger to display stateMachineEGID and stateTransitionEGID events.
  33. When node foo completes its action, we want to transition simultaneously to nodes bar and baz. How do you write this in shorthand notation?
    Answer
    foo =C=> {bar, baz}
  34. When at least two of the nodes foo, bar, and baz have completed their actions, we want to transition to node xam. Write this in shorthand nodtation.
    Answer
    {foo, bar, baz} =C(2)=> xam
  35. When a node posts an event to indicate that its action is complete, what is the EGID (event generator ID)?
    Answer
    stateMachineEGID
  36. When a node posts an event to indicate that its action is complete, what is the source ID?
    Answer
    the address of the node
  37. When a node posts an event to indicate that its action is complete, what is the ETID (event type ID)?
    Answer
    statusETID
  38. When a transition fires, it posts an event. What is the event generator ID?
    Answer
    stateTransitionEGID
  39. What does RandomTrans do?
    Answer
    Fires immediately and transitions to one of its multiple destinations, at random.
  40. What type of state node is used for visual routines behaviors?
    Answer
    VisualRoutinesStateNode
  41. What tool is used to graphically display a state machine execution trace?
    Answer
    the Storyboard
  42. What do the square brackets mean in this expression:
    CompletionTrans($,$$,1)[setSound("barkmed.wav");]
    Answer
    The square brackets indicate an initializer expression which will be executed when the state machine is constructed.