Skip to content
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

Galactic: for_each_callback_group backport #1741

Merged
merged 12 commits into from
Aug 19, 2021

Conversation

adityapande-1995
Copy link
Contributor

@adityapande-1995 adityapande-1995 commented Aug 3, 2021

This PR aims takle ros-simulation/gazebo_ros_pkgs#1296 by backporting #1723 to galactic without breaking ABI. To do this, I added a new non virtual function in node_base class, and added static members to it to keep track of a global map of mutexes. This map stores the mutexes for each node_base instance. However, while using the new for_each_callback_group method, the pointer of type NodeBaseInterface has to be typecasted to NodeBase. The global map of mutexes is written as a separate class and access to it is protected by an internal mutex.

TODO

  • General code cleanup, linting issues
  • Modify static_executor_entities_collector
  • Modify the corresponding test cases

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a preliminary round of review. I would also suggest rebasing all of the individual commits into a single commit, adding a useful commit message, and signing it properly (which will make the DCO bot happy).

rclcpp/include/rclcpp/node.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/executor.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
…se.hpp, updated the

for_each_callback_group wrapper method in lifecycle_node and node.cpp,
added a thread safe global map of mutexes in node_base.

Implemented the suggestions in preliminary review.

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
@adityapande-1995
Copy link
Contributor Author

adityapande-1995 commented Aug 4, 2021

Changes:

  • Squashed commits, signed
  • Removed debug prints, macro
  • removed typedef lines, CallbackGroupFunction now works the same way as in the ROS rolling commit
  • Changed variable name to node_base
  • map_of_mutexes now in rclcpp::node_interfaces namespace
  • count_of_instances changed to boolean flag, protected by a mutex now
  • Added docstring for for_each_callback_group in node.cpp and lifecycle_node.cpp
  • Removed blank spaces

TODO

  • Modify tests
  • Make changes to static_entities_collector
  • general cleanup, linting fixes, ament, uncrustify checks

…ixes

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
…_cb_group

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
…each_cb_group

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a bunch of questions/comments.

rclcpp/include/rclcpp/node.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node.cpp Outdated Show resolved Hide resolved
@clalancette clalancette changed the title for_each_callback_group backport Galactic: for_each_callback_group backport Aug 10, 2021
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
…ointer cast

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think this is getting close. I've left a few more things to think about.

rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
…_mutexes

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a bunch of nits inline. Once those are all fixed, I think this is good to go from my perspective, though I'd like to get @ivanpauno 's final thoughts before we run CI on this.

rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/include/rclcpp/node_interfaces/node_base.hpp Outdated Show resolved Hide resolved
rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me with three things:

  1. Green CI.
  2. Running abi-compliance-checker before and after this PR to make sure we aren't changing ABI.
  3. An approval from @ivanpauno and @cottsay

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from an ABI compatibility perspective. I had a couple of other comments inline, but nothing critical.

rclcpp/src/rclcpp/node_interfaces/node_base.cpp Outdated Show resolved Hide resolved
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
@adityapande-1995
Copy link
Contributor Author

CI Jobs:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@adityapande-1995
Copy link
Contributor Author

adityapande-1995 commented Aug 17, 2021

@cottsay How should we handle the unstable windows CI ? The failures are in rosbag2_transport which don't seem to be related to this PR.

@cottsay
Copy link
Member

cottsay commented Aug 17, 2021

How should we handle the unstable windows CI ? The failures are in rosbag2_transport which don't seem to be related to this PR.

If you're confident that they aren't a regression caused by this PR, then I think it's OK to ignore the test failures. It might be worth triggering a baseline build to be sure, though.

@adityapande-1995
Copy link
Contributor Author

adityapande-1995 commented Aug 18, 2021

CI on galactic branch of rclcpp:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ivanpauno
Copy link
Member

@cottsay How should we handle the unstable windows CI ? The failures are in rosbag2_transport which don't seem to be related to this PR.

I can't tell if those failures are related or not, +1 to compare with a baseline build.

@adityapande-1995
Copy link
Contributor Author

CI on galactic branch of rclcpp:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

So this CI was run by changing the branch of rclcpp to galactic, i.e without my changes and it produced the same error in Windows. @cottsay @ivanpauno

@ivanpauno
Copy link
Member

So this CI was run by changing the branch of rclcpp to galactic, i.e without my changes and it produced the same error in Windows. @cottsay @ivanpauno

LGTM!

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for double-checking!

@adityapande-1995
Copy link
Contributor Author

adityapande-1995 commented Aug 19, 2021

ABI check report between galactic and aditya/thread_safe_cb branches of rclcpp passed, merging !

image

@adityapande-1995 adityapande-1995 merged commit 6adab6e into galactic Aug 19, 2021
@delete-merged-branch delete-merged-branch bot deleted the aditya/thread-safe-cb branch August 19, 2021 20:41
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request Oct 13, 2023
Added thread safe for_each_callback_group method

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
alsora added a commit to irobot-ros/rclcpp that referenced this pull request Oct 16, 2023
…ick-1741

Galactic: for_each_callback_group backport (ros2#1741)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants