SMACC2
sm_advanced_recovery_1.hpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <rclcpp/rclcpp.hpp>
18#include <smacc2/smacc.hpp>
19
20// CLIENTS
22#include <ros_timer_client/cl_ros_timer.hpp>
23
24// ORTHOGONALS
29
30using namespace cl_ros_timer;
31using namespace cl_ros_publisher;
32using namespace cl_keyboard;
34
35//CLIENT BEHAVIORS
39
42
44
45//#include <ros_timer_client/client_behaviors/cb_ros_timer.hpp>
46#include <ros_timer_client/client_behaviors/cb_timer_countdown_once.hpp>
47
48//STATE REACTORS
50
51using namespace smacc2;
52using namespace smacc2::state_reactors;
53using namespace smacc2::default_events;
54
56{
57//SUPERSTATES
58class SsACycle;
59namespace a_cycle_inner_states
60{
61class StiACycleLoop;
62class StiACycleStep1;
63class StiACycleStep2;
64class StiACycleStep3;
65class StiACycleStep4;
66class StiACycleStep5;
67class StiACycleStep6;
68class StiACycleStep7;
69class StiACycleStep8;
70class StiACycleStep9;
71} // namespace a_cycle_inner_states
72
73class SsBCycle;
74
75namespace b_cyclenner_states
76{
77//FORWARD DECLARATIONS OF ALL INNER STATES
78class StiBCycleLoop;
79class StiBCycleStep1;
80class StiBCycleStep2;
81class StiBCycleStep3;
82class StiBCycleStep4;
83class StiBCycleStep5;
84class StiBCycleStep6;
85class StiBCycleStep7;
86class StiBCycleStep8;
87class StiBCycleStep9;
88} // namespace b_cyclenner_states
89
90class SsCCycle;
91namespace c_cycle_inner_states
92{
93//FORWARD DECLARATIONS OF ALL INNER STATES
94class StiCCycleLoop;
95class StiCCycleStep1;
96class StiCCycleStep2;
97class StiCCycleStep3;
98class StiCCycleStep4;
99class StiCCycleStep5;
100class StiCCycleStep6;
101class StiCCycleStep7;
102class StiCCycleStep8;
103class StiCCycleStep9;
104} // namespace c_cycle_inner_states
105
106//STATES
107class StObserve;
108class StRecoverStep1;
109class StRecoverStep2;
110class StRecoverStep3;
111class StRecoverStep4;
112class StRecoverStep5;
113class StRecoverStep6;
114class StRecoverStep7;
115
116//MODE STATES
117class MsRun;
118class MsRecover;
119
120struct EvToDeep : sc::event<EvToDeep>{};
121struct EvFail : sc::event<EvFail>{};
122
123// STATE MACHINE
124struct SmAdvancedRecovery1 : public smacc2::SmaccStateMachineBase<SmAdvancedRecovery1, MsRun>
125{
126 using SmaccStateMachineBase::SmaccStateMachineBase;
127
128 virtual void onInitialize() override
129 {
130 this->createOrthogonal<OrTimer>();
131 this->createOrthogonal<OrUpdatablePublisher>();
132 this->createOrthogonal<OrKeyboard>();
133 this->createOrthogonal<OrSubscriber>();
134 }
135};
136} // namespace sm_advanced_recovery_1
137
138// MODE STATES
141
142//STATES
150
152
156
157//ss_ac_cycle
168
169//ss_b_cycle
180//ss_c_cycle
virtual void onInitialize() override
this function should be implemented by the user to create the orthogonals