Main Page
Namespaces
Classes
Files
File List
File Members
src
trigger_rate.cpp
Go to the documentation of this file.
1
// Copyright (c) 2017 Franka Emika GmbH
2
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
3
#include <
franka_hw/trigger_rate.h
>
4
5
namespace
franka_hw
{
6
7
TriggerRate::TriggerRate
(
double
rate) : period_(1.0 / rate), time_stamp_(
ros
::Time::now()) {}
8
9
bool
TriggerRate::operator()
() {
10
if
((
ros::Time::now
() -
time_stamp_
).toSec() >
period_
) {
11
time_stamp_
=
ros::Time::now
();
12
return
true
;
13
}
14
return
false
;
15
}
16
17
}
// namespace franka_hw
franka_hw
Definition:
control_mode.h:8
franka_hw::TriggerRate::period_
double period_
Definition:
trigger_rate.h:16
franka_hw::TriggerRate::time_stamp_
ros::Time time_stamp_
Definition:
trigger_rate.h:15
ros
franka_hw::TriggerRate::TriggerRate
TriggerRate(double rate=30.0)
Definition:
trigger_rate.cpp:7
trigger_rate.h
ros::Time::now
static Time now()
franka_hw::TriggerRate::operator()
bool operator()()
Definition:
trigger_rate.cpp:9
franka_hw
Author(s): Franka Emika GmbH
autogenerated on Fri Oct 23 2020 03:47:05