... | @@ -6,9 +6,6 @@ State machines can _transition_ from one state to the other and perform addition |
... | @@ -6,9 +6,6 @@ State machines can _transition_ from one state to the other and perform addition |
|
|
|
|
|
In the OBSW, an FSM is a class that implements the `FSM` interface. This interface defines an _ActiveObject_(i.e. an object that runs a thread) with its own _SynchronizedQueue_(event queue). The AO thread continuously checks the event queue: when a new event is received, the FSM will execute a particular function (_StateHandler_) which encodes the current state of the FSM. At the end of the StateHandler, the FSM can either undergo a _transition_ (changes the current state handler) or remain in the same state.
|
|
In the OBSW, an FSM is a class that implements the `FSM` interface. This interface defines an _ActiveObject_(i.e. an object that runs a thread) with its own _SynchronizedQueue_(event queue). The AO thread continuously checks the event queue: when a new event is received, the FSM will execute a particular function (_StateHandler_) which encodes the current state of the FSM. At the end of the StateHandler, the FSM can either undergo a _transition_ (changes the current state handler) or remain in the same state.
|
|
|
|
|
|
Examples of the implementation of the state machines can be found in the examples folder in the skyward-boardcore repository:
|
|
|
|
`skyward-boarcore/src/entrypoints/examples/`.
|
|
|
|
Link: [Here](https://git.skywarder.eu/r2a/skyward-boardcore/tree/master/src/entrypoints/examples).
|
|
|
|
|
|
|
|
## Rules & Best Practices
|
|
## Rules & Best Practices
|
|
These are rules & best practices referring to the particular implementation of state machines use in skyward-boardcore. These practices are aimed at improving readability and at avoiding common causes of error when writing state machines. Se also the [Events Cheatsheet](Events-Cheatsheet).
|
|
These are rules & best practices referring to the particular implementation of state machines use in skyward-boardcore. These practices are aimed at improving readability and at avoiding common causes of error when writing state machines. Se also the [Events Cheatsheet](Events-Cheatsheet).
|
... | @@ -170,7 +167,7 @@ printf("%d", counter.getCount(Event{EV_B})); // 1 |
... | @@ -170,7 +167,7 @@ printf("%d", counter.getCount(Event{EV_B})); // 1 |
|
|
|
|
|
### Examples:
|
|
### Examples:
|
|
An example of test for state machines can be found in skyward-boardcore at:
|
|
An example of test for state machines can be found in skyward-boardcore at:
|
|
`src/tests/examples/`.
|
|
`src/tests/events/fsm/`.
|
|
|
|
|
|
## Links
|
|
## Links
|
|
Practical UML Statecharts in C/C++, 2nd Edition: https://www.state-machine.com/psicc2/ |
|
Practical UML Statecharts in C/C++, 2nd Edition: https://www.state-machine.com/psicc2/ |
|
|
|
\ No newline at end of file |