add method to reset a timer in TimerBase (#326)

This commit is contained in:
William Woodall 2017-05-10 00:34:52 -07:00 committed by GitHub
parent 100417a98d
commit 5777bbee79
2 changed files with 12 additions and 0 deletions

View file

@ -55,6 +55,10 @@ public:
void void
cancel(); cancel();
RCLCPP_PUBLIC
void
reset();
RCLCPP_PUBLIC RCLCPP_PUBLIC
virtual void virtual void
execute_callback() = 0; execute_callback() = 0;

View file

@ -40,6 +40,14 @@ TimerBase::cancel()
} }
} }
void
TimerBase::reset()
{
if (rcl_timer_reset(&timer_handle_) != RCL_RET_OK) {
throw std::runtime_error(std::string("Couldn't reset timer: ") + rcl_get_error_string_safe());
}
}
bool bool
TimerBase::is_ready() TimerBase::is_ready()
{ {