Split rclpy module for easier porting to pybind11#675
Merged
Conversation
34 tasks
cottsay
reviewed
Feb 8, 2021
rclpy/src/rclpy/exceptions.hpp
Outdated
Comment on lines
+26
to
+32
| std::string append_rcl_error(std::string prepend) | ||
| { | ||
| prepend += ": "; | ||
| prepend += rcl_get_error_string().str; | ||
| rcl_reset_error(); | ||
| return prepend; | ||
| } |
Member
There was a problem hiding this comment.
Won't including this header in multiple *.cpp files that get compiled into the same binary cause a symbol collision?
Contributor
Author
There was a problem hiding this comment.
I suppose so. It looks like inline would solve the issue (Explanation 2. 1.)
Member
There was a problem hiding this comment.
Even if this gets inlined, I would assume the RCLError constructor would still have the issue. Any reason not to create a .cpp file for the implementation?
Contributor
Author
There was a problem hiding this comment.
No reason other than laziness 🙃
Contributor
Author
850e84b to
531d36e
Compare
c04dc58 to
674b02c
Compare
30621b6 to
0a68445
Compare
cottsay
approved these changes
Feb 17, 2021
Member
cottsay
left a comment
There was a problem hiding this comment.
A few comments that you should take a look at, but nothing blocking.
The stateful module change looks like it was a lot of work - well done.
Adds _rclpy_pybind11 module for incrementally converting to pybind11 Makes _rclpy use multiphase initialization so it can import _rclpy_pybind11 Signed-off-by: Shane Loretz <sloretz@openrobotics.org> Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@openrobotics.org> Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
0a68445 to
8662933
Compare
Contributor
Author
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Contributor
Author
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@cottsay specifically, here's a way to split the giant
_rclpymodule in pieces that can be ported a little at a time. This PR has split out exceptions (first commit) andrclpy_context_get_domain_id(second commit).There are two modules:
_rclpyand_rclpy_pybind11. Insiderclpy.impl.implementation_singletonthe functions and exceptions on_rclpy_pybind11gets set on_rclpy._rclpyitself needs the exception objects to raise them in C code, so it also imports_rclpy_pybind11. To do that, I had to convert_rclpyto use Multi phase Initialization.@azeey @IanTheEngineer @cottsay FYI
Part of #665