SMACC2
sm_dance_bot_strikes_back.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/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
21#include <smacc2/smacc.hpp>
22
23#include <sensor_msgs/msg/laser_scan.hpp>
24
25// CLIENT BEHAVIORS
26#include <ros_timer_client/client_behaviors/cb_ros_timer.hpp>
27
29
32
33using namespace cl_nav2z;
34
37
40
43
47
49
55
56//STATE REACTORS
60
61using namespace smacc2::state_reactors;
62
63// ORTHOGONALS
72
74{
75//STATE FORWARD DECLARATIONS
76struct StAcquireSensors;
77struct StEventCountDown;
78
82
83struct StRotateDegrees1;
84struct StRotateDegrees2;
85struct StRotateDegrees3;
86struct StRotateDegrees4;
87struct StRotateDegrees5;
88struct StRotateDegrees6;
89
94
95//SUPERSTATE FORWARD DECLARATIONS
96
97// MODE STATES FORWARD DECLARATIONS
100
101namespace SS1
102{
103class SsRadialPattern1;
104}
105
106namespace SS2
107{
108class SsRadialPattern2;
109}
110
111namespace SS3
112{
113class SsRadialPattern3;
114}
115
116namespace SS4
117{
118class SsFPattern1;
119}
120
121namespace SS5
122{
123class SsSPattern1;
124}
125
126// custom smd_dance_bot event
127struct EvGlobalError : sc::event<EvGlobalError>
128{
129};
130
131} // namespace sm_dance_bot_strikes_back
132
133using namespace sm_dance_bot_strikes_back;
134using namespace cl_ros_timer;
135using namespace smacc2;
136
138{
142: public smacc2::SmaccStateMachineBase<SmDanceBotStrikesBack, MsDanceBotRunMode>
143{
146
147 typedef mpl::bool_<false> shallow_history;
148 typedef mpl::bool_<false> deep_history;
149 typedef mpl::bool_<false> inherited_deep_history;
150
151 using SmaccStateMachineBase::SmaccStateMachineBase;
152
153 void onInitialize() override
154 {
155 this->setGlobalSMData("counter_1", counter_1);
156 this->setGlobalSMData("rt_ready_flag", rt_ready_flag);
157
158 this->createOrthogonal<OrNavigation>();
159 this->createOrthogonal<OrObstaclePerception>();
160 this->createOrthogonal<OrLED>();
161 this->createOrthogonal<OrTemperatureSensor>();
162 this->createOrthogonal<OrStringPublisher>();
163 this->createOrthogonal<OrService3>();
164 this->createOrthogonal<OrTimer>();
165 this->createOrthogonal<OrUpdatablePublisher>();
166 }
167};
168
169} // namespace sm_dance_bot_strikes_back
170
171//MODE STATES
173
175
176//SUPERSTATES
182
183//STATES
void setGlobalSMData(std::string name, T value)
Advanced example of state machine with smacc that shows multiple techniques for the development of st...
void onInitialize() override
this function should be implemented by the user to create the orthogonals