-
Notifications
You must be signed in to change notification settings - Fork 366
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
Build state machines from type definition #771
base: master
Are you sure you want to change the base?
Conversation
I have no ideas what that stuff is about. @AndreasHeine isn'it the kind of things you are working on? |
s += '\n-----------------------------------------------------' | ||
print(s) | ||
|
||
print() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty print?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not? It's just for prettier prtinting ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f-string would be better!
The original intention was to use this for implementing skills. Here are a few references describing the skill concept:
However, I thought it could be helpful for implementing all kinds of state machines that are defined by its type. I will make additional changes and give some more explanation soon. @AndreasHeine the parameter set class could be used with a server or a client ( |
@oroulet after a while and recap what i did ^^ the FiniteStatmachineType is abstract... so it should not be possible to instantiate it only subtypes... maybe we need to add a check for that in instantiate-method!? some refactoring is required as well... |
To simplify the creation of a state machine I added an initial implementation to build a state machine based on its type definition. Currently an existing node of a state machine type needs to be passed to the constructor. The
StateMachineClass
will then browse the type definition of this node to add the states, transitions, and causes defined by the type.For executing a state, each
State
object provides anon_entry
andon_exit
method. These are executed on each state change for the current state and the next one. These methods can be overwritten to execute a certain behaviour.Base classes for the
ProgramStateMachine
,FileTransferStateMachine
, andExclusiveLimitStateMachine
have been added. However, none of these are fully implemented. TheProgramStateMachine
is missing some functionality as it is described by the specification but can be used in a simple form (see example). About theFileTransferStateMachine
and theExclusiveLimitStateMachine
I'm not sure how these are intenden to be used. At least there are some references missing, I guess coming from theTemporaryFileTransferType
and aConditoinAlarmType
.In addition to the state machine a
ParameterSet
implementation has been added. A parameter set is a flat list of parameters/variables. These are used e.g. within the device specification to organize the parameters of a device. Optionally the values of the parameters in the set can be subscribed.There is the example
server_typed_state_machine.py
using a custom nodeset with several predefined state machines and parameter sets.There is still some more work needed. However, would be glad if you guys can tell me what you think.