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.
When using ROS2 logging it is desirable to throttle logged messages to keep output manageable ([https://docs.ros.org/en/humble/Tutorials/Demos/Logging-and-logger-configuration.html#logging-throttled]).
To do so, you need access to the node's clock. Since with new changes there is no more direct access to the node object within a subclass of bt_action_node and bt_service_node it is not possible to get the clock and therefore not possible to log with throttling.
This PR adds a get_clock() method to the parent classes which can be used to for throttled logging which I exemplify with an Feedback callback in the existing sleep action sample.
N.B. The samples are still broken in the latest commit. To use any sample (including my edit to exemplify the PR), you need to use BT.CPP with pull 804 BehaviorTree/BehaviorTree.CPP#804 because this actually exports the plugins to be used by the sample behavior trees. I would suggest that you please merge that PR before this one.