SMACC2
smacc2_performance_tools
_smacc2_sm_template
include
sm_name
states
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
26
using namespace
std::chrono;
27
28
namespace
$sm_name$
29
{
30
// SMACC2 clases
31
using
smacc2::EvStateRequestFinish
;
32
using
smacc2::Transition
;
33
34
// STATE MACHINE SHARED VARIABLES (used in this state)
35
extern
unsigned
int
_counter_
;
36
37
// STATE DECLARATION
38
struct
State2
:
smacc2::SmaccState
<State2, $SmName$>
39
{
40
using
SmaccState::SmaccState;
41
// TRANSITION TABLE
42
typedef
boost::mpl::list<
43
44
Transition<EvStateRequestFinish<State2>
,
State1
>
45
46
>
47
reactions
;
48
49
// STATE FUNCTIONS
50
static
void
staticConfigure
() {}
51
52
void
runtimeConfigure
() {}
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$
smacc2::SmaccState
Definition:
smacc_state_base.hpp:41
smacc2::Transition
Definition:
smacc_transition.hpp:32
$sm_name$
Definition:
sm_name.hpp:24
$sm_name$::_counter_
static unsigned int _counter_
Definition:
sm_name.hpp:30
smacc.hpp
$sm_name$::State1
Definition:
st_state_1.hpp:39
$sm_name$::State2
Definition:
st_state_2.hpp:39
$sm_name$::State2::staticConfigure
static void staticConfigure()
Definition:
st_state_2.hpp:50
$sm_name$::State2::reactions
boost::mpl::list< Transition< EvStateRequestFinish< State2 >, State1 > > reactions
Definition:
st_state_2.hpp:47
$sm_name$::State2::onExit
void onExit()
Definition:
st_state_2.hpp:62
$sm_name$::State2::onEntry
void onEntry()
Definition:
st_state_2.hpp:54
$sm_name$::State2::runtimeConfigure
void runtimeConfigure()
Definition:
st_state_2.hpp:52
smacc2::default_events::EvStateRequestFinish
Definition:
smacc_default_events.hpp:111
Generated by
1.9.4