-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Feature request
There should be a python module importable by import packagename.action.actioname which contains everything needed to use actions in python.
Feature description
The module needs to have references to all the types a user needs to interface with actions. This should follow the same model as services since a service type support includes two message type supports.
Implementation considerations
The service python object imports the generated python objects for the request and response message. The action module should import the generated python objects for the services and message it uses as well as the common cancel service and status message.
rosidl_python/rosidl_generator_py/resource/_srv.py.em
Lines 35 to 41 in deab237
| @{ | |
| srv_name = '_' + convert_camel_case_to_lower_case_underscore(spec.srv_name) | |
| for field_name in [srv_name + '__request', srv_name + '__response']: | |
| print('%sfrom %s.srv import %s' % (' ' * 4 * 3, package_name, field_name)) | |
| print('%sif %s.Metaclass._TYPE_SUPPORT is None:' % (' ' * 4 * 3, field_name)) | |
| print('%s%s.Metaclass.__import_type_support__()' % (' ' * 4 * 4, field_name)) | |
| }@ |
The python object for services is just a class with two class members: Request and Response. Actions could be a class with 3 members: SendGoal, GetResult, and Feedback
rosidl_python/rosidl_generator_py/resource/_srv.py.em
Lines 44 to 46 in deab237
| class @(spec.srv_name)(metaclass=Metaclass): | |
| from @(package_name).srv._@convert_camel_case_to_lower_case_underscore(spec.srv_name)__request import @(spec.srv_name)_Request as Request | |
| from @(package_name).srv._@convert_camel_case_to_lower_case_underscore(spec.srv_name)__response import @(spec.srv_name)_Response as Response |
connects to ros2/ros2#583