SMACC2
sm_name.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 <memory>
19
20#include "rclcpp/rclcpp.hpp"
21#include "smacc2/smacc.hpp"
22
23namespace $sm_name$
24{
25//STATES
26struct State1;
27struct State2;
28
29//VARIABLES - shared between states (using "_<name>_"-syntax to make this obvious)
30static unsigned int _counter_ = 0;
31rclcpp::Time _start_time_;
32
33unsigned int _sum_of_iterations_ = 0.0;
35
36//--------------------------------------------------------------------
37//STATE_MACHINE
38struct $SmName$ : public smacc2::SmaccStateMachineBase<$SmName$, State1>
39{
40 using SmaccStateMachineBase::SmaccStateMachineBase;
41
42 void onInitialize() override { _start_time_ = getNode()->now(); }
43};
44
45} // namespace $sm_name$
46
47#include "states/st_state_1.hpp"
48#include "states/st_state_2.hpp"
rclcpp::Node::SharedPtr getNode()
static unsigned int _counter_
Definition: sm_name.hpp:30
double _sum_of_elapsed_time_
Definition: sm_name.hpp:34
rclcpp::Time _start_time_
Definition: sm_name.hpp:31
unsigned int _sum_of_iterations_
Definition: sm_name.hpp:33
void onInitialize() override
this function should be implemented by the user to create the orthogonals
Definition: sm_name.hpp:42