SMACC2
sm_dance_bot_warehouse.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
42
44
47
51
53
58using namespace sm_dance_bot_warehouse::cl_led;
59
60//STATE REACTORS
64
65using namespace smacc2::state_reactors;
66
67// ORTHOGONALS
76
78{
79//STATE FORWARD DECLARATIONS
82
86
93
98
99//SUPERSTATE FORWARD DECLARATIONS
100//MODE STATES FORWARD DECLARATIONS
103
104namespace SS1
105{
106class SsRadialPattern1;
107}
108
109namespace SS2
110{
111class SsRadialPattern2;
112}
113
114namespace SS3
115{
116class SsRadialPattern3;
117}
118
119namespace SS4
120{
121class SsFPattern1;
122}
123
124namespace SS5
125{
126class SsSPattern1;
127}
128
129namespace SS6
130{
131class SsSPattern2;
132}
133
134// custom smd_dance_bot event
135struct EvGlobalError : sc::event<EvGlobalError>
136{
137};
138
139} // namespace sm_dance_bot_warehouse
140
141using namespace sm_dance_bot_warehouse;
142using namespace cl_ros_timer;
143using namespace smacc2;
144
146{
149struct SmDanceBotWarehouse : public smacc2::SmaccStateMachineBase<SmDanceBotWarehouse, MsDanceBotRunMode>
150{
153
154 typedef mpl::bool_<false> shallow_history;
155 typedef mpl::bool_<false> deep_history;
156 typedef mpl::bool_<false> inherited_deep_history;
157
158 using SmaccStateMachineBase::SmaccStateMachineBase;
159
160 void onInitialize() override
161 {
162 this->setGlobalSMData("counter_1", counter_1);
163 this->setGlobalSMData("rt_ready_flag", rt_ready_flag);
164
165 this->createOrthogonal<OrNavigation>();
166 this->createOrthogonal<OrObstaclePerception>();
167 this->createOrthogonal<OrLED>();
168 this->createOrthogonal<OrTemperatureSensor>();
169 this->createOrthogonal<OrStringPublisher>();
170 this->createOrthogonal<OrService3>();
171 this->createOrthogonal<OrTimer>();
172 this->createOrthogonal<OrUpdatablePublisher>();
173 }
174};
175
176} // namespace sm_dance_bot_warehouse
177
178//MODE STATES
180
182
183//SUPERSTATES
190
191//STATES
194
196
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