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