SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_ros2_timer
include
cl_ros2_timer
cl_ros2_timer.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
#pragma once
16
17
#include <boost/signals2.hpp>
18
#include <chrono>
19
#include <optional>
20
#include <
smacc2/smacc.hpp
>
21
22
#include <
cl_ros2_timer/components/cp_timer_listener_1.hpp
>
23
#include <
smacc2/client_core_components/cp_ros2_timer.hpp
>
24
25
namespace
cl_ros2_timer
26
{
27
template
<
typename
TSource,
typename
TOrthogonal>
28
struct
EvTimer
:
sc::event
<EvTimer<TSource, TOrthogonal>>
29
{
30
};
31
32
class
ClRos2Timer
:
public
smacc2::ISmaccClient
33
{
34
public
:
35
ClRos2Timer
(rclcpp::Duration duration,
bool
oneshot =
false
);
36
37
virtual
~ClRos2Timer
();
38
39
// Component-based initialization
40
template
<
typename
TOrthogonal,
typename
TClient>
41
void
onComponentInitialization
()
42
{
43
// Create the core timer component
44
this->
createComponent<smacc2::client_core_components::CpRos2Timer, TOrthogonal, ClRos2Timer>
(
45
duration_
,
oneshot_
);
46
47
// Create the timer listener component that requires CpRos2Timer
48
this->
createComponent<cl_ros2_timer::components::CpTimerListener1, TOrthogonal, ClRos2Timer>
();
49
}
50
51
private
:
52
rclcpp::Duration
duration_
;
53
bool
oneshot_
;
54
};
55
}
// namespace cl_ros2_timer
boost::statechart::event
cl_ros2_timer::ClRos2Timer
Definition
cl_ros2_timer.hpp:33
cl_ros2_timer::ClRos2Timer::duration_
rclcpp::Duration duration_
Definition
cl_ros2_timer.hpp:52
cl_ros2_timer::ClRos2Timer::onComponentInitialization
void onComponentInitialization()
Definition
cl_ros2_timer.hpp:41
cl_ros2_timer::ClRos2Timer::~ClRos2Timer
virtual ~ClRos2Timer()
Definition
cl_ros2_timer.cpp:24
cl_ros2_timer::ClRos2Timer::ClRos2Timer
ClRos2Timer(rclcpp::Duration duration, bool oneshot=false)
Definition
cl_ros2_timer.cpp:19
cl_ros2_timer::ClRos2Timer::oneshot_
bool oneshot_
Definition
cl_ros2_timer.hpp:53
smacc2::ISmaccClient
Definition
smacc_client.hpp:45
smacc2::ISmaccClient::createComponent
SmaccComponentType * createComponent(TArgs... targs)
Definition
smacc_client_impl.hpp:134
cp_ros2_timer.hpp
cp_timer_listener_1.hpp
cl_ros2_timer
Definition
cl_ros2_timer.hpp:26
smacc.hpp
cl_ros2_timer::EvTimer
Definition
cp_timer_listener_1.hpp:24
Generated by
1.12.0