Skip to content

Commit

Permalink
change generators to IDL-based pipeline, change char type, separate a…
Browse files Browse the repository at this point in the history
…ction types (#334)

* add Python function for IDL-based generators

* update C and C++ message generators to use IDL-based extension point

* update includes in typesupport packages

* replace separate action generation with IDL-based approach

* don't pass .action files to legacy message generators

* temporary use custom map in not yet updated generator

* strip action specific suffixes from include filename

* add action templates to list of dependencies

* match constants with message

* traits

* native path

* escape JSON correctly

* rsplit

* fix warning

* comment fix

* unique include directives

* make pydot optional

* fix linter

* linter

* fix comment

* remove service check for feedback suffix

* use UINT8_MAX

* fix comment

* extend action struct with FeedbackMessage

* update C and C++ introspection typesupport generators to use IDL-based extension point

* add missing symbols

* address linter warnings

* instantiate parser on demand

* Add option to generate_files() for keeping idl filename case (#336)

* remove unused var

* remove comment

* fix missing import introduced during rebase

* change exported variable from <pkg>_INTERFACE_FILES to <pkg>_IDL_FILES and only include .idl files

* keep <pkg>_INTERFACE_FILES for legacy generators

* fix upper string length for nested strings

* fix default value for strings with upper bounds

* fix classification of unbounded sequence of bounded strings

* fix previous fix

* Adds includes for action wrapper IDL messages fields. (#337)

* Adds includes for action wrapper IDL messages fields.

* move includes

* add includes before action

* Deduplicates implicit action includes.

* Use set comprehension instead (nit fix)

* fix adding actions

* Add missing closing brace for 'extern C'

* fix missing service request/response symbols

* don't generate png of AST by default

* expose function to get AST

* no enum support yet

* fix more missing symbols

* fixup

* fix includes

* undef NO_ERROR for Windows

This was causing a build issue in tf2_msgs where a constant with the same name is defined.

* dump working copy

* fix struct identifier extraction when having an annotation

* match renamed action types

* update grammar to improve parse performance

* remove obsolete ImplicitFieldCollision logic

* update action tests

* fix value range of char in adapter

* fix char being unsigned

* disable debug images of AST

* use unique_identifier_msgs for goal id

* up doc

* fix regression on Windows

* remove obsolete comment

* try to fix Windows warning

* remove obsolete constant

* targeting Dashing

* removed comment

* moved template calls

* remove obsolete todo

* removed commented code

* fix initialization of u16string

* fix u16string len

* avoid double initialization

* moved template calls

* comment in test

* fix has_bounded_size trait

* readd explicit dependency on absolute paths of idl files

* reduce logic with all action related types being in a single file
  • Loading branch information
dirk-thomas authored Mar 12, 2019
1 parent 7c5c7d3 commit 416ebd8
Show file tree
Hide file tree
Showing 100 changed files with 3,961 additions and 3,524 deletions.
35 changes: 0 additions & 35 deletions rosidl_actions/CMakeLists.txt

This file was deleted.

40 changes: 0 additions & 40 deletions rosidl_actions/bin/rosidl_actions

This file was deleted.

23 changes: 0 additions & 23 deletions rosidl_actions/cmake/register_actions.cmake

This file was deleted.

22 changes: 0 additions & 22 deletions rosidl_actions/package.xml

This file was deleted.

7 changes: 0 additions & 7 deletions rosidl_actions/rosidl_actions-extras.cmake.in

This file was deleted.

49 changes: 0 additions & 49 deletions rosidl_actions/rosidl_actions/__init__.py

This file was deleted.

24 changes: 1 addition & 23 deletions rosidl_adapter/rosidl_adapter/action/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Open Source Robotics Foundation, Inc.
# Copyright 2018-2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,28 +27,6 @@ def convert_action_to_idl(package_dir, package_name, input_file, output_dir):
content = abs_input_file.read_text(encoding='utf-8')
action = parse_action_string(package_name, input_file.stem, content)

# HACK as long as the return action specification contains implicitly added
# fields they have to be skipped when generating .idl files
assert len(action.goal_service.request.fields) >= 1
assert action.goal_service.request.fields[0].name == 'action_goal_id'
action.goal_service.request.fields.pop(0)
assert len(action.goal_service.response.fields) >= 2
assert action.goal_service.response.fields[0].name == 'accepted'
assert action.goal_service.response.fields[1].name == 'stamp'
action.goal_service.response.fields.pop(1)
action.goal_service.response.fields.pop(0)

assert len(action.result_service.request.fields) >= 1
assert action.result_service.request.fields[0].name == 'action_goal_id'
action.result_service.request.fields.pop(0)
assert len(action.result_service.response.fields) >= 1
assert action.result_service.response.fields[0].name == 'action_status'
action.result_service.response.fields.pop(0)

assert len(action.feedback.fields) >= 1
assert action.feedback.fields[0].name == 'action_goal_id'
action.feedback.fields.pop(0)

output_file = output_dir / input_file.with_suffix('.idl').name
abs_output_file = output_file.absolute()
print('Writing output file: {abs_output_file}'.format_map(locals()))
Expand Down
6 changes: 4 additions & 2 deletions rosidl_adapter/rosidl_adapter/msg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ def convert_msg_to_idl(package_dir, package_name, input_file, output_dir):


def to_idl_literal(idl_type, value):
if idl_type[-1] in (']', '>'):
if idl_type[-1] == ']' or idl_type.startswith('sequence<'):
elements = [repr(v) for v in value]
while len(elements) < 2:
elements.append('')
return '"(%s)"' % ', '.join(e.replace('"', r'\"') for e in elements)

if 'boolean' == idl_type:
return 'TRUE' if value else 'FALSE'
if 'string' == idl_type:
if idl_type.startswith('string'):
return string_to_idl_string_literal(value)
return value

Expand All @@ -90,6 +90,8 @@ def get_idl_type(type_):
identifier = MSG_TYPE_TO_IDL[type_]
elif type_.is_primitive_type():
identifier = MSG_TYPE_TO_IDL[type_.type]
if identifier == 'string' and type_.string_upper_bound is not None:
identifier += '<{type_.string_upper_bound}>'.format_map(locals())
else:
identifier = '{type_.pkg_name}::msg::{type_.type}' \
.format_map(locals())
Expand Down
Loading

0 comments on commit 416ebd8

Please sign in to comment.