-
Notifications
You must be signed in to change notification settings - Fork 0
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
FW[157] Generate State Machine from ADJ #33
base: main
Are you sure you want to change the base?
Conversation
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.
Just one nitpick:
Nitpick:
could you change the name of the GeneratedStateMachine class to include information about the board, maybe add some info in the json and then just use that? Same goes for the nested state machine, or just GeneralStateMachine and something descriptive for the nested one.
I assume you have tested and it works fine, so I approve, next time it would be great if you added the generated example.
Great work on the PR description! 🎁
You mean changing the standard name with something like |
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.
Added state_machine_object_descriptions.py with the structure of each object and the functions to parse the info from the json. Adapted all the code generation to follow the new logic and also removed the template.hpp file, as it wasn't necessary for the new approach.
Added:
The json follows a structure with:
1. States
2. Transitions
3. Actions
Enter: an array of actions that contain the state name and an array with the action names if there is more than one action to add. If the state is not a general state, it follows the same structure as the transitions, rewrite it as a dictionary with the nested state machine name and the substate name. If you want to add a description to a specific action, instead of only writing the name of the action, include a dictionary with two fields, the name and the description.
Cyclic (low/mid/high precision): an array of actions that contain an array of states to apply the cyclic actions (if a state is not a general state, it follows the same structure described above) and an array of state actions which are dictionaries with the action name and the desired period (f.e. 30ms), if you want to add a description just add a third field for that description. Each state action in the array is added to each state in the states array, low/mid/high precision work exactly the same way.
Exit: work exactly as enter actions
state_machine.json includes an example of almost every case, visual representation down below