-
Notifications
You must be signed in to change notification settings - Fork 227
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
Try all available implementations instead of hardcoding OpenSplice #5
Conversation
Embedding a compile time hard coded list into the code is not necessary here. This should use the ament resource index instead. |
@esteve the Python implementation of the ament index API is here: https://github.com/ament/ament_index/blob/master/ament_index_python/ament_index_python/__init__.py However, there might be an issue with using the index since a new rmw impl could be added after this package is built and so the index may contain more implementations than existed when the C extensions were built. So long as the code is gracefully degrading that shouldn't be an issue though. |
@dirk-thomas @wjwwood I've replaced the |
macro(rmw_list) | ||
set(RMW_IMPLEMENTATIONS "${RMW_IMPLEMENTATIONS} ${rmw_implementation}") | ||
endmacro() | ||
call_for_each_rmw_implementation(rmw_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is much simpler API for this: https://github.com/ros2/rmw/blob/master/rmw_implementation_cmake/cmake/get_available_rmw_implementations.cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also what is this variable used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a remnant of the old code, I just removed it.
349729e
to
82efeba
Compare
I've changed the code so that the rclpy implementation can be set via an environment variable and also via Python. CI: http://ci.ros2.org/job/ci_linux/1039/ |
After fixing the pyflakes warnings: |
This is ready for review. |
if _rclpy is None: | ||
for rmw_implementation in rmw_implementations: | ||
rmw_module = _load_rmw(rmw_implementation) | ||
if rmw_module is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which cases does this return None
?
|
||
def init(args): | ||
global _rclpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the other functions do not use global _rclpy
. Can you either remove it here or add it to the other functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is that not necessary since this is the only one where you assign it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answered my own question: http://stackoverflow.com/a/423596/671658
try: | ||
return func(*args, **kwargs) | ||
except: | ||
print("exception in {0}():".format(func.__name__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To stderr
.
I think I addressed them all in f161c04. Btw, for those kind of style only changes I think we agreed that it would generate less churn if you just fixed them directly when you see them, and I'm fine with anyone pushing directly to my PR's. |
I'm going to fire off another Linux CI to test the new pr included in this set (ament/ament_tools#86): |
I forgot to push a local change to |
711b61d
to
35b07ce
Compare
All the pr's have been squashed and here is a final (hopefully) set of CI: |
This CI set is clean:
I also have +1's so I'm going to merge these. |
@wjwwood It looks like this PR broke the packaging jobs on Linux and OS X. |
@dirk-thomas the bridge tries to import I think the ros bridge has been broken since Python messages were introduced, this pr just exposed the problem. |
This is the start of the problem: From http://ci.ros2.org/view/packaging/job/packaging_linux/199/console:
|
I don't know either what the best way to address this is. But I think the bridge is important and we should keep it working in the upcoming alpha. |
I don't think that was in question? Do you want me to change the import style of the Python code or do you want to change how the bridge builds its code to avoid imported the ROS 2 messages (and other Python 3 stuff from within Python 2)? |
@ros2/dev bump. Sorry I'm not there to discuss in person, but we need to fix this, can you guys look at the issue and weigh in on our short term solution? I'm happy to make the change to the Python import structure, but I'd like some ideas on what to change it to. |
I'm not an expert here; I think it will take me a little while to understand how the bridge works and how Python messages are imported before I can give you ideas about how to change it. |
I am going to build the bridge locally to see what can be done... |
I was also setting up my local build to build it, let me know if you want me to test something. @jacquelinekay I'm pretty sure @dirk-thomas could explain it better than me (at least on the ROS bridge side), but the fundamental problem here is that if you source ROS 1 and then ROS 2, and afterwards do We need to fix that so you can import ROS 2 messages without So the question to everyone else is should we change the import signature of ROS 2 so this is never a problem, even accidentally. And if so, how should we change it. Short term we can either change how the ros bridge builds or we can change the import signature in ROS 2. If we choose not to change the import signature then we'll have to do the former, which I guess @dirk-thomas is looking into now. So, I don't think a deep understanding of the bridge is necessary to express an opinion on how we should proceed for this release. Hopefully that explanation helps with that. |
I made a small edit to the previous comment to be more accurate. |
Yeah, I understood most of that from the previous comments, but I still have no idea what the best way to proceed is. Did you mean to say "We need to fix that so you can import ROS 2 messages without rclpy being involved"? If I had to express an opinion, I would say that changing the import signature of ROS 2 messages doesn't feel like the right way to go, especially since the import signature matches in Python and C++ as it is right now (e.g. std_msgs.msg.Bool and std_msgs::msg::Bool). |
Yup, edited it again, thanks.
I tend to agree with that sentiment, also because we have more flexibility with Python to "make it work" through dynamic behavior (:sparkles:magic:sparkles:). Which is not really an option in C++. So if we decide to stick with identical import statements, then I think we need to do some extra work to ensure the messages are being used in the right system. So, for example adding a "build for" marker in the generated code for both ROS 1 and ROS 2, and then we can add checks in common functions like |
No description provided.