Merge pull request #146 from ros2/fix_timer
Change behavior of timer on construction
This commit is contained in:
commit
361faf650d
1 changed files with 2 additions and 3 deletions
|
@ -97,9 +97,8 @@ public:
|
|||
GenericTimer(std::chrono::nanoseconds period, CallbackType callback)
|
||||
: TimerBase(period, callback), loop_rate_(period)
|
||||
{
|
||||
/* Subtracting the loop rate period ensures that the callback gets triggered
|
||||
on the first call to check_and_trigger. */
|
||||
last_triggered_time_ = Clock::now() - period;
|
||||
/* Set last_triggered_time_ so that the timer fires at least one period after being created. */
|
||||
last_triggered_time_ = Clock::now();
|
||||
}
|
||||
|
||||
/// Default destructor.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue