Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion franka_hw/include/franka_hw/trigger_rate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TriggerRate {

private:
ros::Time time_stamp_;
double period_;
ros::Duration period_;
};

}; // namespace franka_hw
5 changes: 3 additions & 2 deletions franka_hw/src/trigger_rate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ namespace franka_hw {
TriggerRate::TriggerRate(double rate) : period_(1.0 / rate), time_stamp_(ros::Time::now()) {}

bool TriggerRate::operator()() {
if ((ros::Time::now() - time_stamp_).toSec() > period_) {
time_stamp_ = ros::Time::now();
auto now = ros::Time::now();
if (now - time_stamp_ >= period_ || now < time_stamp_) {
time_stamp_ = now;
return true;
}
return false;
Expand Down