Skip to content

Make Rate to select the clock to work with#2123

Merged
clalancette merged 18 commits intoros2:rollingfrom
AlexeyMerzlyakov:ros-rate
Aug 31, 2023
Merged

Make Rate to select the clock to work with#2123
clalancette merged 18 commits intoros2:rollingfrom
AlexeyMerzlyakov:ros-rate

Conversation

@AlexeyMerzlyakov
Copy link
Contributor

This is the continue of [#1373] discussion and related to the ros-navigation/navigation2#3325 issue in Nav2

The initial idea is to make rclcpp::Rate to work with ROS-time (currently it works only with system and steady times).

What was made:

  • Add rclcpp::Clock pointer to the rclcpp::Rate constructor to allow developer to specify the clock to work with (by-default it is still RCL_SYSTEM_TIME if no clock is specified)
  • Add rclcpp::ROSRate rate class, respective to ROS-time

Current implementation points:

  • Getting rid of templates' structure allows developer to select the clock to work with in dynamics
  • Renamed rclcpp::GenericRate -> to rclcpp::Rate and gave it the default clock to work with
  • rclcpp::Rate and rclcpp::WallRate API remaining to be untouched as much as possible
  • Although there are some changes in API: rclcpp::Duration instead of std::chrono::nanoseconds in durations and Rate::get_type() routine instead of previously used Rate::is_steady()
  • New rclcpp::ROSRate class that working with ROS time

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timer callbacks and rate sleep behave differently if sim clock update rate is slow

6 participants