知方号

知方号

createTimer() replacement in eloquent

In ROS1 we can simply do:

ros::Timer timer = nh.createTimer(ros::Duration(0.1), timerCallback);

This gives us a tick approximately every 100 ms of ROS time. In ROS2, particularly in Eloquent, there is no similar API as far as I can determine, and the only references I find mention Ardent APIs that have been removed. However, for this code:

rclcpp::Clock ros_clock(RCL_ROS_TIME);

This returns a ROS time-based clock, but I cannot see an obvious way to go from there to a timer that ticks every simulated 100 milliseconds. rclcpp::create_wall_timer() exists, but not the more generic rclcpp::create_timer(rclccp::Clock, duration, callback). How can I replicate the ROS1 behaviour in ROS2?

EDIT: Studying the API, the best I can find is something like this:

rclcpp::Clock ros_clock(RCL_ROS_TIME);rclcpp::timer::GenericTimer

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lizi9903@foxmail.com举报,一经查实,本站将立刻删除。