Conversation
- Moved contents from "src/xacro/" folder to "xacro/" folder. - Renamed scripts folder to resource folder. - Modifed package.xml and setup.py according to ROS2 rules. - Deleted CMakeLists.txt
- Modified all python scripts as per ros2 coding guidelines. - Added substitution_args.py file, replacement for roslaunch's resolve_args() method, as it is not available in ROS2's ros2launch package. - Updated shebang line in all python scripts to use python3. - Resolved errors where some test cases were failing to find out some .xml files. (eg. include1.xml) - Added temporary workaround for rosgraph.names.load_mappings because rosgraph is not migrated to ROS2.
…, required for ament_copyright rule.
…test this package on bouncy.
- Added some more details in README.md file.
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
clalancette
left a comment
There was a problem hiding this comment.
I've got a lot of things to fix in here. They fall into a few main categories:
- Switch the license back to BSD everywhere
- Be very careful about changing " -> '; it matters in some places
- Get the dependencies correct
- Miscellaneous fixes
I may have more on a subsequent review, but these are the major things I saw to start with.
.travis.yml
Outdated
| python: | ||
| - "2.7" | ||
| - "3.5" | ||
| # - "3.5" |
There was a problem hiding this comment.
We've been generally trying to keep Python 3.5 support for older Debian. So I'd suggest re-enabling this.
.travis.yml
Outdated
| # - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' | ||
| # - wget http://packages.ros.org/ros.key -O - | sudo apt-key add - | ||
| # - sudo apt-get update | ||
| # - sudo apt-get install ros-indigo-catkin ros-indigo-roslaunch ros-indigo-rostest ros-indigo-roslint |
There was a problem hiding this comment.
Just kill off all of the commented lines above this.
.travis.yml
Outdated
| - sudo apt update && sudo apt install curl | ||
| - curl http://repo.ros2.org/repos.key | sudo apt-key add - | ||
| - sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' | ||
| - export ROS_DISTRO=ardent # or ardent |
There was a problem hiding this comment.
Definitely switch this to Dashing.
.travis.yml
Outdated
| - sudo -H python3 -m pip install -U setuptools | ||
|
|
||
| before_script: | ||
| # before_script: |
There was a problem hiding this comment.
You'll probably want to reenable the flake8 tests.
.travis.yml
Outdated
| # - make | ||
| # - make run_tests | ||
| # - catkin_test_results --all ./ | ||
| # - sudo make install |
There was a problem hiding this comment.
Kill off all of this commented-out code.
xacro/xmlutils.py
Outdated
| @@ -1,38 +1,29 @@ | |||
| #!/usr/bin/env python3 | |||
|
|
|||
| # Copyright 2018 Open Source Robotics Foundation, Inc. | |||
xacro/xmlutils.py
Outdated
|
|
||
| for a_name in a_names: | ||
| writer.write(" %s=\"" % a_name) | ||
| writer.write(' %s=\"' % a_name) |
There was a problem hiding this comment.
We have to be careful here. I believe that we should get rid of the escape slash here.
xacro/xmlutils.py
Outdated
| writer.write(' %s=\"' % a_name) | ||
| xml.dom.minidom._write_data(writer, attrs[a_name].value) | ||
| writer.write("\"") | ||
| writer.write('\"') |
There was a problem hiding this comment.
I think we need to get rid of the escape slash here as well.
xacro/substitution_args.py
Outdated
| @@ -0,0 +1,576 @@ | |||
| #!/usr/bin/env python3 | |||
|
|
|||
| # Copyright 2018 Open Source Robotics Foundation, Inc. | |||
xacro/substitution_args.py
Outdated
|
|
||
|
|
||
| try: | ||
| from cStringIO import StringIO # Python 2.x |
setup.py
Outdated
| @@ -1,13 +1,37 @@ | |||
| #!/usr/bin/env python | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
I'm not sure this #! line is needed, since it gets registered as a console script.
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
.travis.yml
Outdated
| - sudo -H python3 -m pip install -U setuptools | ||
|
|
||
| before_script: | ||
| before_script: |
There was a problem hiding this comment.
I don't think this should be indented.
README.md
Outdated
| @@ -0,0 +1,43 @@ | |||
| This file describes the work done and steps to perform test on the xacro package. | |||
|
|
|||
| "https://github.com/vandanamandlik/xacro/tree/ros2" | |||
There was a problem hiding this comment.
I agree with @clalancette's comment above regarding refactoring the README.md.
In any case, we shouldn't be pointing to a fork of this repo.
setup.py
Outdated
| keywords=['ROS'], | ||
| classifiers=[ | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: Apache Software License', |
There was a problem hiding this comment.
| 'License :: OSI Approved :: Apache Software License', | |
| 'License :: OSI Approved :: BSD License', |
xacro/cli.py
Outdated
| @@ -0,0 +1,180 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
I don't think the shebang line is necessary since this isn't intended to be executed as a script.
xacro/color.py
Outdated
| @@ -1,4 +1,5 @@ | |||
| #! /usr/bin/env python | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
Similar to my comment above, I think this line can be removed.
xacro/__init__.py
Outdated
| if s == '$(cwd)': | ||
| # TODO This is Temporary fix to return cwd() for 'find xacro' command. | ||
| # We can use resolve_args() when rospkg will be migrated to ROS2. | ||
| if s == '$(cwd)' or s == '$(find xacro)': |
There was a problem hiding this comment.
I guess this temporary fix isn't necessary since we're using ament to find packages now in substitution_args.py.
xacro/__init__.py
Outdated
| from rospkg.common import ResourceNotFound | ||
| return substitution_args.resolve_args(s, context=substitution_args_context, resolve_anon=False) | ||
| # TODO use following when roslaunch will be fully migrated to ROS2. | ||
| # from roslaunch import substitution_args |
There was a problem hiding this comment.
I'm not sure what's needed exactly to resolve this TODO, but I don't think depending on launch is an appropriate solution. It looks like substitution_args from roslaunch is already replicated in xacro, so maybe we can remove this TODO.
xacro/substitution_args.py
Outdated
|
|
||
| import yaml | ||
|
|
||
| from ament_index_python.packages import get_package_prefix |
There was a problem hiding this comment.
Following a discussion on a separate thread (kazuki0824#1 (comment)), I think it's better to default to using get_package_share_directory().
clalancette
left a comment
There was a problem hiding this comment.
This round of review still has a lot of comments (some still remaining from last time), but this is looking a lot better.
README.md
Outdated
| @@ -0,0 +1,43 @@ | |||
| This file describes the work done and steps to perform test on the xacro package. | |||
xacro/substitution_args.py
Outdated
|
|
||
| import yaml | ||
|
|
||
| from ament_index_python.packages import get_package_prefix |
xacro/substitution_args.py
Outdated
|
|
||
|
|
||
| try: | ||
| from cStringIO import StringIO # Python 2.x |
|
|
||
|
|
||
| def _eval_optenv(name, default=''): | ||
|
|
There was a problem hiding this comment.
This should probably get a pydoc comment.
|
|
||
|
|
||
| def _eval_dirname(filename): | ||
|
|
xacro/substitution_args.py
Outdated
|
|
||
|
|
||
| def convert_value(value, type_): | ||
| """ |
There was a problem hiding this comment.
The indentation on this method is weird compared to the other ones in this file (and in this whole codebase). Fix this to be 4 spaces like the rest.
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
clalancette
left a comment
There was a problem hiding this comment.
There are still quite a few comments left-over from my last review. Please go through all of the open comments and address them.
resource/xacro
Outdated
| @@ -1,4 +1,4 @@ | |||
| #! /usr/bin/env python | |||
|
|
|||
There was a problem hiding this comment.
Nit: remove empty line at the top.
|
As I already pointed out in #203 (comment), I suggest to split this huge PR into independent components:
The first three points were nicely prepared by @vandanamandlik, @jacobperron, and @gonzodepedro. I'm working on the remaining issues (see #213). The following improvments are independent from the ROS2 porting:
As the present PR is a mixture of the first two items, I suggest to close it here and continue on #213. |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
Only sort of. While I agree with the general principle, the ROS 2 ports have been sitting long enough and we've done enough iterations with this PR that I think it would be a waste now to throw this away. I'd much rather port your travis fixes into this PR and complete it here. |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
|
@clalancette, my motivation is primarily separation of concerns: The ROS2 port is a rather small fraction of this PR and should be decoupled from the python linting. |
|
Currently, this PR has a lot of unit test failures and nobody yet worked on this. So far, work focused on fixing flake8 and pep257 issues, which doesn't help us in porting to ROS2. |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
|
Manually transferred formatting changes (90fb2af) |
This PR brings together changes made by @vandanamandlik and @jacobperron.