SMACC2
st_state_2.hpp
Go to the documentation of this file.
1// Copyright 2021 MyName/MyCompany Inc.
2// Copyright 2021 RobosoftAI Inc. (template)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//
17// Author: Denis Štogl (template)
18//
19
20#pragma once
21
22#include "rclcpp/rclcpp.hpp"
23#include "smacc2/smacc.hpp"
24
25// STATE DECLARATION
26using namespace std::chrono;
27
28namespace $sm_name$
29{
30// SMACC2 clases
33
34// STATE MACHINE SHARED VARIABLES (used in this state)
35extern unsigned int _counter_;
36
37// STATE DECLARATION
38struct State2 : smacc2::SmaccState<State2, $SmName$>
39{
40 using SmaccState::SmaccState;
41 // TRANSITION TABLE
42 typedef boost::mpl::list<
43
45
46 >
48
49 // STATE FUNCTIONS
50 static void staticConfigure() {}
51
53
54 void onEntry()
55 {
56 // only update counter in this state
57 ++_counter_;
58
59 this->postEvent<EvStateRequestFinish<State2>>();
60 }
61
62 void onExit() {}
63};
64} // namespace $sm_name$
static unsigned int _counter_
Definition: sm_name.hpp:30
static void staticConfigure()
Definition: st_state_2.hpp:50
boost::mpl::list< Transition< EvStateRequestFinish< State2 >, State1 > > reactions
Definition: st_state_2.hpp:47
void runtimeConfigure()
Definition: st_state_2.hpp:52