Fix bugs related to subscription age and setting timeout (#609, #611) #612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#609 - The original code used rclcpp::Clock::now() to retrieve the time, which returns a clock of type RCL_SYSTEM_TIME. All other code is using rclcpp::Node::now() which returns a clock of type RCL_ROS_TIME. The two time sources are not compatible and cannot be compared or operated on together. This change pushes the code down into the impl where the node handle is available for calling now() when now is not provided as an argument. It is worth noting that calling age(node->now()) instead of age() is not even possible as a workaround since that will result in another exception due to the passed time object source not being compatible with rclcpp::Time(0,0). Similar "what" text as the original problem, just having to do with comparing to unlike time sources.
#611 - There is no constructor for rclcpp::Duration that takes a double. Convert to a std::chrono::duration before passing to the setTimeout() function that takes a rclcpp::Duration.