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#pragma once
17
18#include "smacc2/smacc.hpp"
19
20// CLIENTS
21#include "ros_timer_client/cl_ros_timer.hpp"
22#include "ros_timer_client/client_behaviors/cb_timer_countdown_once.hpp"
23
24// ORTHOGONALS
25#include "$sm_name$/orthogonals/or_timer.hpp"
26
27namespace $sm_name$
28{
29// SMACC2 clases
33
36
38
39// STATE DECLARATION
40struct State2 : smacc2::SmaccState<State2, $SmName$>
41{
42 using SmaccState::SmaccState;
43
44 // TRANSITION TABLE - adjust as needed
45 typedef boost::mpl::list<
46
47 Transition<EvTimer<CbTimerCountdownOnce, OrTimer>, State1, SUCCESS>
48
50
51 // STATE FUNCTIONS
52 static void staticConfigure()
53 {
54 // START: Example code - change needed
55 configure_orthogonal<OrTimer, CbTimerCountdownOnce>(5); // EvTimer triggers once at 10 client ticks
56 // END: Example code - change or delete as needed
57 }
58
60 {
61 // START: Example code - change or delete as needed
62 RCLCPP_INFO(getLogger(), " Entering State2");
63 // END: Example code - change or delete as needed
64 }
65
66 void onEntry() {
67 // START: Example code - change or delete as needed
68 // Use Blackboard to get global state-machine data - example - feel free to delete it.
69 std::string output_message_note;
70 getGlobalSMData("output_message_note", output_message_note);
71 RCLCPP_INFO(getLogger(), (output_message_note + " On Entry!").c_str());
72 // END: Example code - change or delete as needed
73 }
74
75 void onExit()
76 {
77 // START: Example code - change or delete as needed
78 RCLCPP_INFO(getLogger(), " On Exit!");
79 // END: Example code - change or delete as needed
80 }
81};
82} // namespace sm_atomic_performance_test_a_1
rclcpp::Logger getLogger()
Definition: smacc_state.hpp:36
bool getGlobalSMData(std::string name, T &ret)
boost::mpl::list< Transition< EvTimer< CbTimerCountdownOnce, OrTimer >, State1, SUCCESS > > reactions
Definition: st_state_2.hpp:49
static void staticConfigure()
Definition: st_state_2.hpp:52
void runtimeConfigure()
Definition: st_state_2.hpp:59