-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change generator to IDL-based pipeline (#47)
* sketch of idl2idl templates * invoke idl2idl template * Update rosidl_generate_dds_interfaces to accept tuples of IDL files to convert * Updates IDL templates for messages. * Ok * Fixes * Allow context to be extended and add optional 'post-struct line generation' * Add trailing underscores to struct member names * Add header guards * Refactor idl.idl.em * Propagates variables to nested templates. * Fixes bad indentation in templates. * Propagates yet more variables. * Fixes installation paths for IDL files. * Moves header guards one template level up. * Add wrapper_msg.idl.em * Fixes bad install macro call. * Rename variable for Service object to 'service' * Add message templates for user-defined components of actions * Pass in service wrapper templates rather than having them here * Always use slashes in IDL include paths. * Add missing check when converting negative int8 values to octet * Avoid duplicate include directives. * Add underscore suffix to constants * add space between two > * Removes backup srv IDL template. * fix linter warnings * fix double slash * Remove extra brace in namespace comment * match renamed action types * remove usage of unset variable * pass through key annotations * Update rosidl_generator_dds_idl/bin/rosidl_generator_dds_idl Co-Authored-By: dirk-thomas <[email protected]> * Update rosidl_generator_dds_idl/bin/rosidl_generator_dds_idl Co-Authored-By: dirk-thomas <[email protected]> * document SERVICE_TEMPLATES * fix wrong variable name * readd explicit dependency on absolute paths of idl files * declare missing dependency on additional templates
- Loading branch information
1 parent
714065f
commit c80366c
Showing
7 changed files
with
301 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@# Included from rosidl_generator_dds_idl/resource/idl.idl.em | ||
@{ | ||
TEMPLATE( | ||
'msg.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
message=action.goal, | ||
get_post_struct_lines=get_post_struct_lines | ||
) | ||
TEMPLATE( | ||
'srv.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
service=action.send_goal_service, | ||
get_post_struct_lines=get_post_struct_lines, | ||
additional_service_templates=additional_service_templates | ||
) | ||
TEMPLATE( | ||
'msg.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
message=action.result, | ||
get_post_struct_lines=get_post_struct_lines | ||
) | ||
TEMPLATE( | ||
'srv.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
service=action.get_result_service, | ||
get_post_struct_lines=get_post_struct_lines, | ||
additional_service_templates=additional_service_templates | ||
) | ||
TEMPLATE( | ||
'msg.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
message=action.feedback, | ||
get_post_struct_lines=get_post_struct_lines | ||
) | ||
TEMPLATE( | ||
'msg.idl.em', | ||
package_name=package_name, | ||
interface_path=interface_path, | ||
message=action.feedback_message, | ||
get_post_struct_lines=get_post_struct_lines | ||
) | ||
}@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// generated from rosidl_generator_dds_idl/resource/idl.idl.em | ||
// with input from @(package_name):@(interface_path) | ||
// generated code does not contain a copyright notice | ||
@{ | ||
import os | ||
from rosidl_parser.definition import Include | ||
includes = content.get_elements_of_type(Include) | ||
}@ | ||
@[if includes]@ | ||
@{ | ||
include_directives = set() | ||
}@ | ||
@[ for include in includes]@ | ||
@{ | ||
name, ext = os.path.splitext(include.locator) | ||
dir_name = os.path.dirname(name) | ||
include_name = '{}_{}'.format('/'.join([dir_name] + subfolders + [os.path.basename(name)]), ext) | ||
}@ | ||
@[ if include_name not in include_directives]@ | ||
#include "@(include_name)" | ||
@[ end if]@ | ||
@{ | ||
include_directives.add(include_name) | ||
}@ | ||
@[ end for]@ | ||
@[end if]@ | ||
@{ | ||
from rosidl_parser.definition import Action | ||
from rosidl_parser.definition import Message | ||
from rosidl_parser.definition import Service | ||
|
||
from rosidl_cmake import convert_camel_case_to_lower_case_underscore | ||
header_guard_parts = [package_name] + list(interface_path.parents[0].parts) + \ | ||
[convert_camel_case_to_lower_case_underscore(interface_path.stem)] + \ | ||
['idl'] | ||
}@ | ||
|
||
#ifndef __@('__'.join(header_guard_parts))__ | ||
#define __@('__'.join(header_guard_parts))__ | ||
|
||
@{ | ||
for message in content.get_elements_of_type(Message): | ||
TEMPLATE( | ||
'msg.idl.em', package_name=package_name, | ||
interface_path=interface_path, message=message, | ||
get_post_struct_lines=get_post_struct_lines | ||
) | ||
|
||
for service in content.get_elements_of_type(Service): | ||
TEMPLATE( | ||
'srv.idl.em', package_name=package_name, | ||
interface_path=interface_path, service=service, | ||
get_post_struct_lines=get_post_struct_lines, | ||
additional_service_templates=additional_service_templates | ||
) | ||
|
||
for action in content.get_elements_of_type(Action): | ||
TEMPLATE( | ||
'action.idl.em', package_name=package_name, | ||
interface_path=interface_path, action=action, | ||
get_post_struct_lines=get_post_struct_lines, | ||
additional_service_templates=additional_service_templates | ||
) | ||
}@ | ||
|
||
#endif // __@('__'.join(header_guard_parts))__ |
Oops, something went wrong.