Skip to content

Commit f208604

Browse files
authored
Fix services (#62)
* Update ubuntu version Signed-off-by: acuadros95 <[email protected]> * Add missing methods Signed-off-by: acuadros95 <[email protected]> * Update Signed-off-by: acuadros95 <[email protected]> * Add missing definition Signed-off-by: acuadros95 <[email protected]> * Add on all srv files Signed-off-by: acuadros95 <[email protected]> * Fix event template Signed-off-by: acuadros95 <[email protected]> * Add fix to cpp Signed-off-by: acuadros95 <[email protected]> * Add mising include Signed-off-by: acuadros95 <[email protected]> * Remove cpp modifications Signed-off-by: acuadros95 <[email protected]> * Fix headers generation Signed-off-by: acuadros95 <[email protected]> --------- Signed-off-by: acuadros95 <[email protected]>
1 parent 1310b44 commit f208604

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ ubuntu-20.04 ]
1817
ros_distribution: [ rolling ]
19-
include:
20-
- docker_image: ubuntu:jammy
21-
ros_distribution: rolling
2218
container:
2319
image: ubuntu:jammy
2420

rosidl_typesupport_microxrcedds_c/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<buildtool_export_depend>python3</buildtool_export_depend>
1919
<buildtool_export_depend>rosidl_cmake</buildtool_export_depend>
2020
<buildtool_export_depend>rosidl_runtime_c</buildtool_export_depend>
21+
<buildtool_export_depend>rosidl_generator_c</buildtool_export_depend>
2122

2223
<depend>rmw</depend>
2324

rosidl_typesupport_microxrcedds_c/resource/idl__type_support_c.c.em

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include_parts = [package_name] + list(interface_path.parents[0].parts) + [
1818
include_base = '/'.join(include_parts)
1919
}@
2020
#include "@(include_base)__rosidl_typesupport_microxrcedds_c.h"
21+
#include "@(include_base)__functions.h"
2122

2223
@{
2324
include_directives = set()

rosidl_typesupport_microxrcedds_c/resource/msg__type_support_c.c.em

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
@# Included from rosidl_typesupport_microxrcedds_c/resource/idl__type_support_c.cpp.em
22
@{
33
from rosidl_cmake import convert_camel_case_to_lower_case_underscore
4+
from rosidl_generator_c import idl_structure_type_to_c_typename
5+
from rosidl_generator_type_description import GET_DESCRIPTION_FUNC
6+
from rosidl_generator_type_description import GET_HASH_FUNC
7+
from rosidl_generator_type_description import GET_SOURCES_FUNC
48
from rosidl_parser.definition import AbstractGenericString
59
from rosidl_parser.definition import AbstractNestedType
610
from rosidl_parser.definition import AbstractSequence
711
from rosidl_parser.definition import AbstractString
812
from rosidl_parser.definition import BoundedString
913
from rosidl_parser.definition import AbstractWString
14+
from rosidl_parser.definition import SERVICE_REQUEST_MESSAGE_SUFFIX
15+
from rosidl_parser.definition import SERVICE_RESPONSE_MESSAGE_SUFFIX
16+
from rosidl_parser.definition import SERVICE_EVENT_MESSAGE_SUFFIX
1017
from rosidl_parser.definition import ACTION_FEEDBACK_SUFFIX
1118
from rosidl_parser.definition import ACTION_GOAL_SUFFIX
1219
from rosidl_parser.definition import ACTION_RESULT_SUFFIX
@@ -109,6 +116,12 @@ for member in message.structure.members:
109116
keys.add('rosidl_runtime_c/u16string.h')
110117
keys.add('rosidl_runtime_c/u16string_functions.h')
111118
elif isinstance(type_, NamespacedType):
119+
import sys
120+
if (
121+
type_.name.endswith(SERVICE_REQUEST_MESSAGE_SUFFIX) or
122+
type_.name.endswith(SERVICE_RESPONSE_MESSAGE_SUFFIX)
123+
):
124+
continue
112125
if (
113126
type_.name.endswith(ACTION_GOAL_SUFFIX) or
114127
type_.name.endswith(ACTION_RESULT_SUFFIX) or
@@ -546,6 +559,10 @@ static rosidl_message_type_support_t _@(message.structure.namespaced_type.name)_
546559
ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE,
547560
&__callbacks_@(message.structure.namespaced_type.name),
548561
get_message_typesupport_handle_function,
562+
563+
&@(idl_structure_type_to_c_typename(message.structure.namespaced_type))__@(GET_HASH_FUNC),
564+
&@(idl_structure_type_to_c_typename(message.structure.namespaced_type))__@(GET_DESCRIPTION_FUNC),
565+
&@(idl_structure_type_to_c_typename(message.structure.namespaced_type))__@(GET_SOURCES_FUNC),
549566
};
550567

551568
const rosidl_message_type_support_t *

rosidl_typesupport_microxrcedds_c/resource/srv__rosidl_typesupport_microxrcedds_c.h.em

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ TEMPLATE(
1717
include_directives=include_directives)
1818
}@
1919

20+
@{
21+
TEMPLATE(
22+
'msg__rosidl_typesupport_microxrcedds_c.h.em',
23+
package_name=package_name,
24+
interface_path=interface_path,
25+
message=service.event_message,
26+
include_directives=include_directives)
27+
}@
28+
2029
@{
2130
header_files = [
2231
'rosidl_runtime_c/service_type_support_struct.h',

rosidl_typesupport_microxrcedds_c/resource/srv__type_support_c.c.em

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
@# Included from rosidl_typesupport_microxrcedds_c/resource/idl__type_support_c.c.em
22
@{
3+
from rosidl_generator_c import idl_structure_type_to_c_typename
4+
from rosidl_generator_type_description import GET_DESCRIPTION_FUNC
5+
from rosidl_generator_type_description import GET_HASH_FUNC
6+
from rosidl_generator_type_description import GET_SOURCES_FUNC
7+
from rosidl_parser.definition import SERVICE_EVENT_MESSAGE_SUFFIX
8+
from rosidl_parser.definition import SERVICE_REQUEST_MESSAGE_SUFFIX
9+
from rosidl_parser.definition import SERVICE_RESPONSE_MESSAGE_SUFFIX
10+
311
TEMPLATE(
412
'msg__type_support_c.c.em',
513
package_name=package_name,
@@ -17,6 +25,15 @@ TEMPLATE(
1725
include_directives=include_directives)
1826
}@
1927

28+
@{
29+
TEMPLATE(
30+
'msg__type_support_c.c.em',
31+
package_name=package_name,
32+
interface_path=interface_path,
33+
message=service.event_message,
34+
include_directives=include_directives)
35+
}@
36+
2037
@{
2138
from rosidl_cmake import convert_camel_case_to_lower_case_underscore
2239

@@ -58,6 +75,23 @@ static rosidl_service_type_support_t @(service.namespaced_type.name)__handle = {
5875
ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE,
5976
&@(service.namespaced_type.name)__callbacks,
6077
get_service_typesupport_handle_function,
78+
79+
&_@(service.namespaced_type.name)@(SERVICE_REQUEST_MESSAGE_SUFFIX)__type_support,
80+
&_@(service.namespaced_type.name)@(SERVICE_RESPONSE_MESSAGE_SUFFIX)__type_support,
81+
&_@(service.namespaced_type.name)@(SERVICE_EVENT_MESSAGE_SUFFIX)__type_support,
82+
83+
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_CREATE_EVENT_MESSAGE_SYMBOL_NAME(
84+
rosidl_typesupport_c,
85+
@(',\n '.join(service.namespaced_type.namespaced_name()))
86+
),
87+
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_DESTROY_EVENT_MESSAGE_SYMBOL_NAME(
88+
rosidl_typesupport_c,
89+
@(',\n '.join(service.namespaced_type.namespaced_name()))
90+
),
91+
92+
&@(idl_structure_type_to_c_typename(service.namespaced_type))__@(GET_HASH_FUNC),
93+
&@(idl_structure_type_to_c_typename(service.namespaced_type))__@(GET_DESCRIPTION_FUNC),
94+
&@(idl_structure_type_to_c_typename(service.namespaced_type))__@(GET_SOURCES_FUNC),
6195
};
6296

6397
const rosidl_service_type_support_t *

0 commit comments

Comments
 (0)