Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State Machine Interface #174

Open
5 tasks
nfcopier opened this issue Oct 26, 2016 · 0 comments
Open
5 tasks

State Machine Interface #174

nfcopier opened this issue Oct 26, 2016 · 0 comments
Assignees
Milestone

Comments

@nfcopier
Copy link
Member

nfcopier commented Oct 26, 2016

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 nfcopier added this to the November milestone Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants