GuardCondition should have a callback that gets handled by the executor
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
Discovered while looking at ros2/rclcpp#1916
Feature description
I think it would be useful to have a callback that gets run by the executor after the guard condition is triggered.
rclpy already has this feature.
This could be used to do work in the executor. One could use it to complete a future to work around ros2/rclcpp#1916.
You can sort of do this now with timers with a 0 second period by canceling them in the callback. The timer callback won't run again until it's reset, so resetting is sort of like calling trigger()).
Implementation considerations
The GuardCondition class has a callback that gets called when it's triggered, but this isn't suitable for this feature.
https://github.com/ros2/rclcpp/blob/85a7046ac39bfc0d787ed2bbe62574424e31b871/rclcpp/include/rclcpp/guard_condition.hpp#L112
This callback replaces the trigger implementation so that the rcl_trigger_guard_condition method never gets called, and the executor isn't woken. A different callback would be needed to implement this feature.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rclcpp/include/rclcpp/guard_condition.hpp and rclcpp/src/rclcpp/guard_condition.cpp, then compare rclpy's guard_condition.py behavior. Trace how the executor handles triggered guard conditions. Done means a separate callback can run through the executor after triggering without replacing the trigger implementation or preventing the executor from waking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100