-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add example for migrating a Python package from ROS 1 to 2 #4780
Conversation
HTML artifacts: https://github.com/ros2/ros2_documentation/actions/runs/11353745523/artifacts/2060170324. To view the resulting site:
|
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
c367d2e
to
278bed2
Compare
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
This is a great start, what I would recommend we do this in a step by step fashion. For example, first show the package.xml upgrade process, then move on the next file. This approach would keep the before and after files right next to each other. |
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
@kscottz @clalancette this guide is ready for review! |
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 fantastic document. I've left a few things to fix, hopefully they aren't too onerous.
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
|
||
|
||
def main(): | ||
rclpy.init() |
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.
For the rolling
branch only, I'm going to suggest that we switch to the with rclpy.init():
context manager, since we have switched all of our other examples to that. But do note that when we backport this to other distributions, we are going to have to go back to the "regular" rclpy.init()
.
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.
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
:depth: 2 | ||
:local: | ||
|
||
Prerequisites |
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.
I just did a first pass read on this while I had a minute.
One suggestion, which you are free to ignore, is that if you wrote an index / overview for this document it would effectively be a check list that readers could work through systematically.
We can certainly come back to this once the initial PR is complete and add it in.
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.
I will skip this one for now to conserve time
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com> Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
@clalancette @kscottz all feedback addressed. PTAL 🙇 |
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.
i think this is great enhancement for migration process. lgtm.
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
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.
A few more minor things to fix, then I think this is ready to go!
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Package-Example.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Chris Lalancette <clalancette@gmail.com> Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
Signed-off-by: Shane Loretz <shane.loretz@gmail.com>
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.
Looks good! Will go ahead and merge this and backport, then merge in #4813 only on Rolling.
* Add tutorial for migrating a Python package from ROS 1 to 2 Signed-off-by: Shane Loretz <shane.loretz@gmail.com> Co-authored-by: Chris Lalancette <clalancette@gmail.com> (cherry picked from commit d9391f3)
* Add tutorial for migrating a Python package from ROS 1 to 2 Signed-off-by: Shane Loretz <shane.loretz@gmail.com> Co-authored-by: Chris Lalancette <clalancette@gmail.com> (cherry picked from commit d9391f3)
* Add tutorial for migrating a Python package from ROS 1 to 2 Signed-off-by: Shane Loretz <shane.loretz@gmail.com> Co-authored-by: Chris Lalancette <clalancette@gmail.com> (cherry picked from commit d9391f3)
This adds a guide walking someone through migrating a ROS 1 Python package to ROS 2. I assumed the reader is familiar with ROS 1 and Python, but is not familiar with ROS 2's Python APIs or best practices.