Skip to content

Generate python typesupport for Actions #14

Closed

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

Activity

  1. added
    enhancement
    on Oct 18, 2018
  2. added this to the crystal milestone on Oct 18, 2018
  3. added
    in progress
    on Nov 15, 2018
  4. removed
    in progress
    on Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions