-
Notifications
You must be signed in to change notification settings - Fork 45
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
Python typesupport for Actions #21
Conversation
The fork this PR is coming from is not accessible. Was it dropped, or just not made public? |
Hi @brawner , I think the branch name has lead to confusion here. Actually, this PR is coming from a local branch to the rcl repo and can be found here: https://github.com/ros2/rosidl_python/tree/apojomovsky/typesupport_for_actions |
Haha, that indeed was my confusion. Thanks!
… On Dec 21, 2018, at 7:18 AM, Alexis Pojomovsky ***@***.***> wrote:
Hi @brawner , I think the branch name has lead to confusion here. Actually, this PR is coming from a local branch to the rcl repo and can be found here: https://github.com/ros2/rosidl_python/tree/apojomovsky/typesupport_for_actions
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I've tested this out on my system. Is there a reason why no high-level action class is created? Something like:
as opposed to
|
It would appear that the |
Hi @jacobperron , I've just verified and it's exactly as you say. With the current pipeline, action files are broken into services and messages prior to being passed to the generator. |
@@ -23,7 +23,8 @@ add_custom_command( | |||
COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_py_BIN} | |||
--generator-arguments-file "${generator_arguments_file}" | |||
--typesupport-impls "${_typesupport_impls}" | |||
DEPENDS ${target_dependencies} ${rosidl_generate_interfaces_TARGET} | |||
${extra_generator_arguments} |
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.
Where is this variable being defined?
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 left over from a previous attempt. Thanks for pointing it out. Removed.
cb12148
to
615e6a2
Compare
Alright, it seems to be working now. Or at least I'm able to import the Having said that, I'm not very proud of this patch. It works, but it's fragile, if you know what I mean. The split pipeline does no good to the Python generator implementation, and this is the solution I came up with that minimized the amount of changes necessary. Hopefully, we'll get to replace it with a more robust implementation once Dirk's work lands. @jacobperron this is ready for you to implement actions in |
print('%sif %s.Metaclass._TYPE_SUPPORT is None:' % (' ' * 4 * 3, '_cancel_goal')) | ||
print('%s%s.Metaclass.__import_type_support__()' % (' ' * 4 * 4, '_cancel_goal')) | ||
}@ | ||
|
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.
Need an extra blank line to have two between top-level definitions
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.
True. Fixed.
content = re.sub( | ||
r"# BEGIN %s$.*^# END %s" % (block_name, block_name), | ||
'', content, 0, re.M | re.S | ||
) |
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.
Is this part where it modifies the previously generated __init__.py
the fragile part you were referring to?
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.
That and adding _action
to the package name whenever necessary (but not everywhere) to avoid name collisions.
2e51b21
to
161faf0
Compare
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.
LGTM with green CI. I think this could be merged now, but shouldn't be released until rclpy actions are ready in case there are bugs not caught by review.
@sloretz fully agree. |
If this thread is right, 3e212cb should fix our little issue. |
Re-running Windows CI, last one failed for unrelated reasons: 20:56:50 II> Using workspace: ws
20:56:50 WW> Deleting the folder at 'ws'.
20:56:50 Traceback (most recent call last):
20:56:50 File "C:\Python37\lib\shutil.py", line 389, in _rmtree_unsafe
20:56:50 os.unlink(fullname)
20:56:50 PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'ws\\log\\test_2019-01-10_22-14-13\\logger_all.log'
20:56:50
20:56:50 During handling of the above exception, another exception occurred:
20:56:50
20:56:50 Traceback (most recent call last):
20:56:50 File "run_ros2_batch.py", line 32, in <module>
20:56:50 sys.exit(main())
20:56:50 File "C:\J\workspace\ci_windows\ros2_batch_job\__main__.py", line 132, in main
20:56:50 return run(args, build_function, blacklisted_package_names=blacklisted_package_names)
20:56:50 File "C:\J\workspace\ci_windows\ros2_batch_job\__main__.py", line 404, in run
20:56:50 remove_folder(args.workspace)
20:56:50 File "C:\J\workspace\ci_windows\ros2_batch_job\util.py", line 114, in remove_folder
20:56:50 shutil.rmtree(path, onerror=del_rw)
20:56:50 File "C:\Python37\lib\shutil.py", line 507, in rmtree
20:56:50 return _rmtree_unsafe(path, onerror)
20:56:50 File "C:\Python37\lib\shutil.py", line 386, in _rmtree_unsafe
20:56:50 _rmtree_unsafe(fullname, onerror)
20:56:50 File "C:\Python37\lib\shutil.py", line 386, in _rmtree_unsafe
20:56:50 _rmtree_unsafe(fullname, onerror)
20:56:50 File "C:\Python37\lib\shutil.py", line 391, in _rmtree_unsafe
20:56:50 onerror(os.unlink, fullname, sys.exc_info())
20:56:50 File "C:\J\workspace\ci_windows\ros2_batch_job\util.py", line 113, in del_rw
20:56:50 os.remove(name)
20:56:50 PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'ws\\log\\test_2019-01-10_22-14-13\\logger_all.log' |
Alright!! All green. Going in. |
else: | ||
cls._TYPE_SUPPORT = module.type_support_action__@(subfolder)_@(module_name) | ||
@{ | ||
preffix = '_' + convert_camel_case_to_lower_case_underscore(spec.action_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.
Spelling: prefix
.
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.
Fixed in #28
* Adds Python typesupport for Actions (#21) * Add _action.py.em; Makes rosidl_generator_py handle action files properly * Adds CMake pipeline bits for action generation. * Fixes all linter issues. * Attempts to fix CMake warnings in Windows. * Fix flake8 error (#27) * Provide type support for 'goal_status_array' in action type support Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Fix spelling typo Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Ignore import order on generated imports (#29) Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Closes #14
This PR:
rosidl_python/rosidl_generator_py/resource/_action.py.em
template file with the proper imports for the generated action messages/services._msg_pkg_typesupport_entry_point.c.em
script.rosidl_generator_py
so that it can handle the new action's template.