Skip to content

Generate python typesupport for Actions #14

@sloretz

Description

@sloretz

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.

@{
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

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions