SMACC2
smacc2_sm_reference_library
sm_dance_bot_strikes_back
include
sm_dance_bot_strikes_back
states
radial_motion_states
sti_radial_loop_start.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
namespace
sm_dance_bot_strikes_back
22
{
23
namespace
radial_motion_states
24
{
25
// STATE DECLARATION
26
struct
StiRadialLoopStart
:
smacc2::SmaccState
<StiRadialLoopStart, SS>
27
{
28
using
SmaccState::SmaccState;
29
30
// TRANSITION TABLE
31
typedef
mpl::list<
32
33
Transition<EvLoopContinue<StiRadialLoopStart>,
StiRadialRotate
,
CONTINUELOOP
>
34
35
>
reactions
;
36
37
// STATE FUNCTIONS
38
static
void
staticConfigure
() {}
39
40
void
runtimeConfigure
() {}
41
42
bool
loopWhileCondition
()
43
{
44
auto
& superstate = this->context<SS>();
45
46
RCLCPP_INFO(
47
getLogger
(),
"Loop start, current iterations: %d, total iterations: %d"
,
48
superstate.iteration_count, superstate.total_iterations());
49
return
superstate.iteration_count++ < superstate.total_iterations();
50
}
51
52
void
onEntry
()
53
{
54
RCLCPP_INFO(
getLogger
(),
"LOOP START ON ENTRY"
);
55
checkWhileLoopConditionAndThrowEvent
(&
StiRadialLoopStart::loopWhileCondition
);
56
}
57
};
58
}
// namespace radial_motion_states
59
}
// namespace sm_dance_bot_strikes_back
smacc2::ISmaccState::getLogger
rclcpp::Logger getLogger()
Definition:
smacc_state.hpp:36
smacc2::SmaccState
Definition:
smacc_state_base.hpp:41
smacc2::SmaccState< StiRadialLoopStart, SS >::checkWhileLoopConditionAndThrowEvent
void checkWhileLoopConditionAndThrowEvent(bool(MostDerived::*conditionFn)())
Definition:
smacc_state_base.hpp:321
sm_dance_bot_strikes_back
Definition:
cl_led.hpp:22
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart
Definition:
sti_radial_loop_start.hpp:27
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart::runtimeConfigure
void runtimeConfigure()
Definition:
sti_radial_loop_start.hpp:40
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart::loopWhileCondition
bool loopWhileCondition()
Definition:
sti_radial_loop_start.hpp:42
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart::onEntry
void onEntry()
Definition:
sti_radial_loop_start.hpp:52
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart::reactions
mpl::list< Transition< EvLoopContinue< StiRadialLoopStart >, StiRadialRotate, CONTINUELOOP > > reactions
Definition:
sti_radial_loop_start.hpp:35
sm_dance_bot_strikes_back::radial_motion_states::StiRadialLoopStart::staticConfigure
static void staticConfigure()
Definition:
sti_radial_loop_start.hpp:38
sm_dance_bot_strikes_back::radial_motion_states::StiRadialRotate
Definition:
sti_radial_rotate.hpp:27
smacc2::default_transition_tags::CONTINUELOOP
Definition:
smacc_types.hpp:90
Generated by
1.9.4