SMACC2
smacc2_client_library
ros_timer_client
src
ros_timer_client
cb_timer_countdown_loop.cpp
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
#include <ros_timer_client/client_behaviors/cb_timer_countdown_loop.hpp>
16
17
namespace
cl_ros_timer
18
{
19
CbTimerCountdownLoop::CbTimerCountdownLoop
(
unsigned
long
triggerTickCount)
20
: tickTriggerCount_(triggerTickCount), tickCounter_(0)
21
{
22
}
23
24
void
CbTimerCountdownLoop::onClientTimerTickCallback
()
25
{
26
tickCounter_
++;
27
28
if
(
tickCounter_
%
tickTriggerCount_
== 0)
29
{
30
onTimerTick_
();
31
postCountDownEvent_
();
32
}
33
}
34
35
void
CbTimerCountdownLoop::onEntry
()
36
{
37
this->
requiresClient
(
timerClient_
);
38
timerClient_
->
onTimerTick
(&
CbTimerCountdownLoop::onClientTimerTickCallback
,
this
);
39
}
40
41
void
CbTimerCountdownLoop::onExit
() {}
42
}
// namespace cl_ros_timer
cl_ros_timer::CbTimerCountdownLoop::onTimerTick_
smacc2::SmaccSignal< void()> onTimerTick_
Definition:
cb_timer_countdown_loop.hpp:50
cl_ros_timer::CbTimerCountdownLoop::postCountDownEvent_
std::function< void()> postCountDownEvent_
Definition:
cb_timer_countdown_loop.hpp:49
cl_ros_timer::CbTimerCountdownLoop::tickCounter_
unsigned long tickCounter_
Definition:
cb_timer_countdown_loop.hpp:46
cl_ros_timer::CbTimerCountdownLoop::onExit
void onExit() override
Definition:
cb_timer_countdown_loop.cpp:41
cl_ros_timer::CbTimerCountdownLoop::CbTimerCountdownLoop
CbTimerCountdownLoop(unsigned long triggerTickCount)
Definition:
cb_timer_countdown_loop.cpp:19
cl_ros_timer::CbTimerCountdownLoop::onEntry
void onEntry() override
Definition:
cb_timer_countdown_loop.cpp:35
cl_ros_timer::CbTimerCountdownLoop::timerClient_
ClRosTimer * timerClient_
Definition:
cb_timer_countdown_loop.hpp:48
cl_ros_timer::CbTimerCountdownLoop::onClientTimerTickCallback
void onClientTimerTickCallback()
Definition:
cb_timer_countdown_loop.cpp:24
cl_ros_timer::CbTimerCountdownLoop::tickTriggerCount_
unsigned long tickTriggerCount_
Definition:
cb_timer_countdown_loop.hpp:45
cl_ros_timer::ClRosTimer::onTimerTick
boost::signals2::connection onTimerTick(void(T::*callback)(), T *object)
Definition:
cl_ros_timer.hpp:49
smacc2::ISmaccClientBehavior::requiresClient
void requiresClient(SmaccClientType *&storage)
Definition:
smacc_client_behavior_impl.hpp:67
cl_ros_timer
Definition:
cl_ros_timer.hpp:23
Generated by
1.9.4