SMACC2
sm_three_some.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 <smacc2/smacc.hpp>
18
19// CLIENTS
21#include <ros_timer_client/cl_ros_timer.hpp>
22
23// ORTHOGONALS
28
29using namespace cl_ros_timer;
30using namespace cl_ros_publisher;
31using namespace cl_keyboard;
32using namespace sm_three_some::cl_subscriber;
33
34// CLIENT BEHAVIORS
41
42//#include <ros_timer_client/client_behaviors/cb_ros_timer.hpp>
43#include <ros_timer_client/client_behaviors/cb_timer_countdown_once.hpp>
44
45// STATE REACTORS
47
48using namespace smacc2;
49using namespace smacc2::state_reactors;
50using namespace smacc2::default_events;
51
52namespace sm_three_some
53{
54// SUPERSTATES
55namespace SS1
56{
57class Ss1;
58} // namespace SS1
59
60// SUPERSTATES
61namespace SS2
62{
63class Ss2;
64} // namespace SS2
65
66// STATES
67class StState1; // first state specially needs a forward declaration
68class StState2;
69class StState3;
70class StState4;
71
72class MsRun;
73class MsRecover;
74
75struct EvToDeep : sc::event<EvToDeep>
76{
77};
78
79struct EvFail : sc::event<EvFail>
80{
81};
82
83// STATE MACHINE
84struct SmThreeSome : public smacc2::SmaccStateMachineBase<SmThreeSome, MsRun>
85{
86 using SmaccStateMachineBase::SmaccStateMachineBase;
87
88 void onInitialize() override
89 {
90 this->createOrthogonal<OrTimer>();
91 this->createOrthogonal<OrUpdatablePublisher>();
92 this->createOrthogonal<OrKeyboard>();
93 this->createOrthogonal<OrSubscriber>();
94 }
95};
96} // namespace sm_three_some
97
98// MODE STATES
100
102
103// STATES
void onInitialize() override
this function should be implemented by the user to create the orthogonals