SMACC2
sm_dance_bot_warehouse_2.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
59
60//STATE REACTORS
64
65using namespace smacc2::state_reactors;
66
67// ORTHOGONALS
76
78{
79//STATE FORWARD DECLARATIONS
82
86
93
94class StNavigateReverse1;
97class StForwardAisle;
101
102//SUPERSTATE FORWARD DECLARATIONS
103//MODE STATES FORWARD DECLARATIONS
106
107namespace SS1
108{
109class SsRadialPattern1;
110}
111
112namespace SS2
113{
114class SsRadialPattern2;
115}
116
117namespace SS3
118{
119class SsRadialPattern3;
120}
121
122namespace SS4
123{
124class SsFPattern1;
125}
126
127namespace SS5
128{
129class SsSPattern1;
130}
131
132namespace SS6
133{
134class SsSPattern2;
135}
136
137// custom smd_dance_bot event
138struct EvGlobalError : sc::event<EvGlobalError>
139{
140};
141
142} // namespace sm_dance_bot_warehouse_2
143
144using namespace sm_dance_bot_warehouse_2;
145using namespace cl_ros_timer;
146using namespace smacc2;
147
149{
152struct SmDanceBotWareHouse2 : public smacc2::SmaccStateMachineBase<SmDanceBotWareHouse2, MsDanceBotRunMode>
153{
156
157 typedef mpl::bool_<false> shallow_history;
158 typedef mpl::bool_<false> deep_history;
159 typedef mpl::bool_<false> inherited_deep_history;
160
161 using SmaccStateMachineBase::SmaccStateMachineBase;
162
163 void onInitialize() override
164 {
165 this->setGlobalSMData("counter_1", counter_1);
166 this->setGlobalSMData("rt_ready_flag", rt_ready_flag);
167
168 this->createOrthogonal<OrNavigation>();
169 this->createOrthogonal<OrObstaclePerception>();
170 this->createOrthogonal<OrLED>();
171 this->createOrthogonal<OrTemperatureSensor>();
172 this->createOrthogonal<OrStringPublisher>();
173 this->createOrthogonal<OrService3>();
174 this->createOrthogonal<OrTimer>();
175 this->createOrthogonal<OrUpdatablePublisher>();
176 }
177};
178
179} // namespace sm_dance_bot_warehouse_2
180
181//MODE STATES
183
185
186//SUPERSTATES
193
194//STATES
197
199
204
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