-
Notifications
You must be signed in to change notification settings - Fork 260
Backport of the Events Executor (#1391) #1435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Brad Martin <[email protected]>
The previous version worked on 22.04+Iron, but fails on 24.04+Jazzy or Rolling. It seems like the behavior of std::bind() may have changed when asked to bind a py::object to a callback taking a py::handle. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
clang-format fixes things that uncrustify tends to leave alone, but then uncrustify seems slightly unhappy with that result. Also reflow comments at 100 columns. This uses the .clang-format file from the ament-clang-format package, with the exception of SortIncludes being set to false, because I didn't like what it tried to do with includes without that override. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Tests that currently work are enabled, and those that don't are annotated what needs to be done before they can be enabled Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
It was being used only inconsistently, and on reflection it wasn't adding any protection beyond what the GIL already provides. Signed-off-by: Brad Martin <[email protected]>
Needed to release the GIL while blocking on another lock. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Never bool-test a py::object::attr() return value without an explicit py::cast<bool>. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
EventsExecutor was exploding because the test was leaving destroyed entities in the node by using an incorrect API to destroy them. Signed-off-by: Brad Martin <[email protected]>
…om it * Test methods need to be prefixed with 'test_' in order to function. This had been entirely dead code, and when I enabled it EventsExecutor deadlocked. * On reflection, it seems like a deadlock is exactly what should be expected from what this test is doing. Remove EventsExecutor from the test and document the problem. Signed-off-by: Brad Martin <[email protected]>
Co-authored-by: Janosch Machowinski <[email protected]> Signed-off-by: Brad Martin <[email protected]>
This both prevents an issue where user callbacks could potentially queue up if they didn't dispatch fast enough, and ensures that a timer that has passed its expiration without being dispatched yet can still be canceled without the user callback being delivered later. This commit also makes use of the new rcl API for querying the absolute timer expiration time, instead of the relative number of nanoseconds remaining until it expires. This should both make things more accurate, and potentially reduce overhead as we don't have to re-query the current time for each outstanding timer. Signed-off-by: Brad Martin <[email protected]>
…ckManager Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
This both reduces duplicate code now, and simplifies the asio interface used which would need replacing. Signed-off-by: Brad Martin <[email protected]>
This method can't be allowed to leave its Future done callback outstanding in case the method is returning for a reason other than the Future being done. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
This is dumb on its own, but it helps me move towards eliminating asio. Signed-off-by: Brad Martin <[email protected]>
This isn't ideal because there are some ways async callbacks could become unblocked which wouldn't get noticed right away (if at all); however this seems to match the behavior of SingleThreadedExecutor. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
Python 3.9, still used by RHEL 9, doesn't seem to understand '|' syntax, and Optional/Union seems to be what gets used throughout the rest of the codebase. Additionally, fix a couple other mypy nits: * mypy is mad that I haven't explicitly annotated every __init__ as returning None * mypy wants generic arguments to service and action clients now Signed-off-by: Brad Martin <[email protected]>
pybind11::hash() is documented as returning ssize_t, but this seems to be a lie because MSVC doesn't understand that type; so, let's just return whatever we do get. Signed-off-by: Brad Martin <[email protected]>
MSVC didn't like the more concise method. Signed-off-by: Brad Martin <[email protected]>
Signed-off-by: Brad Martin <[email protected]>
time.monotonic() has a resolution of 16ms, which is way too coarse for the intervals this test is trying to measure. Signed-off-by: Brad Martin <[email protected]>
|
@alsora All tests pass in my clean jazzy docker container. Feel free to run the CI if you are happy with the PR. I many cherry-picked all the relevant commits and adapted any issues that were indicated by the tests. This mainly included the following changes:
|
- Generics have been added to some parts of rclpy in a later version. Therefore, we can not use them, and they were removed from the affected type hints. - The TimerInfo argument is not present in jazzy. Anything related to it is removed. - The execution order of the SingleThreadedExecutor is not fifo in jazzy. This has been fixed in rolling, but the PR will not be backported, as this would be a breaking change. Therefore, a special case is added to one test that flips the order so we expect a fifo behavior for the events executor. - A usage of the deprecated, but otherwise identical, QoSEventHandler is changed to EventHandler, because it leads to a test failure when the create_event_handlers API is used with a matched callback. Signed-off-by: Florian Vahl <[email protected]>
That is strange, as the rcl and rclcpp changes were merge prior to jazzy
It the python executor different from the rclcpp one ? The rclcpp one is explicit entity priority based |
|
Pulls: #1435 |
I am not sure, but my comment was in reference to #1304, which is present in rolling, but not jazzy.
It was introduced in #1292 and wasn't backported to jazzy, as it is not present in https://github.com/ros2/rclpy/blob/jazzy/rclpy/rclpy/timer.py. Also the PR was merged on Jul 30 which is after May 23, which is listed on https://docs.ros.org/en/jazzy/Releases.html as the release date. |
|
It seems like the windows CI failed with an unrelated issue (some jenkins internal thing) right? |
|
@Flova actually it looks like CI got cut off, i just restart the CI. |
|
I only did a quick look, but the PR seems good to me! |
|
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/faster-rclpy-executor-now-in-rolling/42852/1 |
Backport of the events executor from rolling to jazzy as discussed in #1391.