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