Poseidon icon indicating copy to clipboard operation
Poseidon copied to clipboard

State Machine Interface

Open nfcopier opened this issue 8 years ago • 0 comments

Summary

The Brain uses a game loop to run. This loop interfaces with a State Machine, but the interface is entangled. This interface should be made more clear.

--- State Machine Structure --- The sub has individual objectives. A main state machine needs to manage the transitions between individual objectives. Additionally, each object needs its own state machine. To facilitate the development of new objectives, a generic state machine object needs to be created. Each individual objective object (e.g. Gate, Buoy...) will use a instance of the generic state machine to control its actions.

The state machine object should take an array of states and their callback functions. Pseudo code:


States = { Waiting: 4, Moving: 6 } ... controller = StateMachine([[States.Waiting, waiting], [States.Moving, moving]); ... function waiting() { //in waiting state } function moving() { //in moving state }


The state machine needs a way to change the state by passing a new state (integer). Additional, the state machine needs a function to execute one computation. Other functions may be needed to control the state machine.

Acceptance Criteria

  • [ ] Implement generic state machine.
  • [ ] Port the current state machine code to the new structure for future edits.
    • [ ] Create main brain object (using the generic state machine).
    • [ ] Create a gate object (using the generic state machine).
    • [ ] Have the main brain object call only the gate object, for now.

Non-functional Criteria

The sub state machines need to be able to change the main state machine's state.

nfcopier avatar Oct 26 '16 23:10 nfcopier