Skip to content

Instantly share code, notes, and snippets.

@youtalk
Last active December 24, 2017 13:00
Show Gist options
  • Save youtalk/ab48963dd1fd9cd6808f753c1c1e1ec7 to your computer and use it in GitHub Desktop.
Save youtalk/ab48963dd1fd9cd6808f753c1c1e1ec7 to your computer and use it in GitHub Desktop.
Node::create_wall_timer
template<typename DurationT, typename CallbackT>
typename rclcpp::WallTimer<CallbackT>::SharedPtr
Node::create_wall_timer(
std::chrono::duration<int64_t, DurationT> period,
CallbackT callback,
rclcpp::callback_group::CallbackGroup::SharedPtr group)
{
auto timer = rclcpp::WallTimer<CallbackT>::make_shared(
std::chrono::duration_cast<std::chrono::nanoseconds>(period),
std::move(callback));
node_timers_->add_timer(timer, group);
return timer;
}
template<typename CallbackType>
using WallTimer = GenericTimer<CallbackType, std::chrono::steady_clock>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment