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

FW[157] Generate State Machine from ADJ #33

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Core/Inc/template_state_machine.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
#include "ST-LIB.hpp"
using namespace std::chrono_literals;

// AUTOGENERATED CODE, DO NOT EDIT MANUALLY

class GeneratedStateMachine{

public:
//%FUNCTION_HEADERS%
//%STATE_DEFINITION%
//%TRANSITION_DEFINITION%
//%ACTION_DEFINITION%

};

122 changes: 122 additions & 0 deletions state_machine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"states" : [
"name_1",
{
"name" : "Nested_sm",
"sub-states":[
"nested_name_1",
"nested_name_2"
]
},
"name_2"

],

"transitions" : [
{
"old_state" : "name_1",
"new_state" : "name_2",
"transition_name": "from_1_to_2"
},
jdmarmen marked this conversation as resolved.
Show resolved Hide resolved
{
"old_state" : "name_1",
"new_state" : "name_2",
"transition_name": "from_1_to_2",
"description" : "Transitioning from 1 to 2"
},
{
"old_state" : "name_1",
"new_state" : {
"name" : "Nested_sm",
"sub-state" : "nested_name_1"
},
"transition_name": "from_1_to_nested_1"
}


],

"actions" : {
"enter" : [
{
"state" : "name_1",
"state_actions" : [
"enter_action_1",
"enter_action_2"
]
},
{
"state" : "name_2",
"state_actions" : [
{
"name" : "enter_action_3",
"description" : "Description of enter_action_3"
},
"enter_action_4"
]
}
],

"cyclic" : {
"low_precision" : [
{
"states" : [
"name_1",
"name_2"
],
"state_actions" : [
{
"action_name" : "low_precision_action",
"action_period" : "30ms"
}
]
}
],
"mid_precision" : [
{
"states" : [
"name_1",
{
"name" : "Nested_sm",
"sub-state" : "nested_name_1"
}
],
"state_actions" : [
{
"action_name" : "mid_precision_action_to_nested_state",
"action_period" : "60ms"
}
]
}
],
"high_precision" : [
{
"states" : [
"name_1",
"name_2"
],
"state_actions" : [
{
"action_name" : "high_precision_action_with_description",
"action_period" : "90ms",
"description" : "Cyclic action example with description"
}
]
}
]
},

"exit" : [
{
"state" : {
"name" : "Nested_sm",
"sub-state" : "nested_name_2"
},
"state_actions" : [
"exit_action_1",
"exit_action_2"
]
}
]
}
}
Loading
Loading