rclcpp
rclcpp copied to clipboard
Add create_timer interface to Node
Feature request
Feature description
Add an rclcpp::Node interface for the creation of ROS time timers.
This would allow easier creation of timers that can use sim time when possible, and not be strictly held to wall time.
This is already possible with rclcpp::create_timer and passing in the right arguments, but having it as a function of rclcpp::Node will make it more convenient to use.
Implementation considerations
Add a Node::create_timer declaration into the node.hpp file, but since it will take a callback the definition will most likely need to be added to the node_impl.hpp template file.
The implementation will most likely just be a wrapper around one of the rclcpp::create_timer calls and passing the correct arguments as needed. I don't know which of the create_timer functions will be better to use.
I agree. I like this feature request. I started to use create_wall_timer as that is all I saw under rclcpp::Node, but wanted to use the node's clock with the timer. I missed that there was a rclcpp::create_timer at first.
Any updates on this? Would be a nice shortcut feature to have.
@srikarg89 AFAIK, no update on this. this is tagged with help wanted, please consider the PR.
https://github.com/ros2/rclcpp/blob/c01602f7a68f25e96bbb7719e874d88dd2018d88/rclcpp/include/rclcpp/node.hpp#L256
Isn't this exactly what this ticket is about ?
Yes it is! I made the ticket when first not finding it when using humble, and I have been getting around the issue by just using rclcpp::create_timer directly.