SMACC2
mode_2_sequence_a_loop.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
15namespace sm_multi_stage_1
16{
17
18// STATE DECLARATION
19struct Mode2SequenceALoop : smacc2::SmaccState<Mode2SequenceALoop, MsMode2>
20{
21public:
22 using SmaccState::SmaccState;
23
24 // TRANSITION TABLE
25 typedef mpl::list<
26
27 Transition<EvLoopContinue<Mode2SequenceALoop>, SsMode2SequenceA, CONTINUELOOP>
28
30
31 // STATE FUNCTIONS
32 static void staticConfigure() {}
33
35
37 {
38 auto & superstate = this->context<MsMode2>();
39
40 RCLCPP_INFO(
41 getLogger(), "Loop start, current iterations: %d, total iterations: %d",
42 superstate.ziteration_count, superstate.ztotal_iterations());
43 return superstate.ziteration_count++ < superstate.ztotal_iterations();
44 }
45
46 void onEntry()
47 {
48 RCLCPP_INFO(getLogger(), "LOOP START ON ENTRY");
50 }
51};
52} // namespace sm_multi_stage_1
rclcpp::Logger getLogger()
Definition: smacc_state.hpp:36
void checkWhileLoopConditionAndThrowEvent(bool(MostDerived::*conditionFn)())
mpl::list< Transition< EvLoopContinue< Mode2SequenceALoop >, SsMode2SequenceA, CONTINUELOOP > > reactions