├── .clang-tidy
├── rosidlcpp_generator_py
├── resource
│ ├── __init__.py.template
│ ├── _idl.py.template
│ ├── _srv_pkg_typesupport_entry_point.c.template
│ ├── _action_pkg_typesupport_entry_point.c.template
│ ├── _idl_pkg_typesupport_entry_point.c.template
│ ├── _idl_support.c.template
│ └── _srv.py.template
├── rosidlcpp_generator_py-extras.cmake.in
├── CHANGELOG.rst
├── cmake
│ ├── rosidlcpp_generator_py_get_typesupports.cmake
│ ├── register_py.cmake
│ └── custom_command.cmake
├── include
│ └── rosidlcpp_generator_py
│ │ └── rosidlcpp_generator_py.hpp
├── CMakeLists.txt
└── package.xml
├── rosidlcpp
├── doc
│ └── img
│ │ ├── flamegraph_rosidl.jpg
│ │ ├── flamegraph_rosidlcpp.jpg
│ │ └── flamegraph_rosidl_compilation.jpg
├── CMakeLists.txt
├── CHANGELOG.rst
└── package.xml
├── .clangd
├── .devcontainer
├── packages.repos
├── Dockerfile
├── gdb_nlohmann.py
├── Dockerfile.rhel9
├── devcontainer.json
└── Makefile
├── rosidlcpp_generator_c
├── resource
│ ├── action__type_support.c.template
│ ├── msg__type_support.h.template
│ ├── idl.h.template
│ ├── action__type_support.h.template
│ ├── idl__type_support.c.template
│ ├── empty__description.c.template
│ ├── rosidl_generator_c__visibility_control.h.in
│ ├── idl__type_support.h.template
│ ├── srv__type_support.h.template
│ ├── idl__description.c.template
│ ├── idl__functions.c.template
│ ├── idl__struct.h.template
│ └── srv__type_support.c.template
├── rosidlcpp_generator_c-extras.cmake.in
├── include
│ └── rosidlcpp_generator_c
│ │ └── rosidlcpp_generator_c.hpp
├── CHANGELOG.rst
├── package.xml
├── cmake
│ └── register_c.cmake
└── CMakeLists.txt
├── rosidlcpp_generator_cpp
├── resource
│ ├── srv__builder.hpp.template
│ ├── action__builder.hpp.template
│ ├── msg.hpp.template
│ ├── idl.hpp.template
│ ├── srv__struct.hpp.template
│ ├── msg__type_support.hpp.template
│ ├── idl__type_support.hpp.template
│ ├── srv__type_support.hpp.template
│ ├── idl__builder.hpp.template
│ ├── action__type_support.hpp.template
│ ├── idl__traits.hpp.template
│ ├── action__traits.hpp.template
│ ├── idl__struct.hpp.template
│ ├── rosidl_generator_cpp__visibility_control.hpp.in
│ ├── srv__traits.hpp.template
│ ├── msg__builder.hpp.template
│ └── action__struct.hpp.template
├── rosidlcpp_generator_cpp-extras.cmake.in
├── include
│ └── rosidlcpp_generator_cpp
│ │ └── rosidlcpp_generator_cpp.hpp
├── package.xml
├── CMakeLists.txt
├── CHANGELOG.rst
└── cmake
│ └── register_cpp.cmake
├── rosidlcpp_parser
├── package.xml
├── CHANGELOG.rst
├── src
│ └── main.cpp
├── CMakeLists.txt
└── include
│ └── rosidlcpp_parser
│ └── rosidlcpp_parser.hpp
├── rosidlcpp_generator_core
├── package.xml
├── CHANGELOG.rst
└── CMakeLists.txt
├── rosidlcpp_generator_type_description
├── rosidlcpp_generator_type_description-extras.cmake.in
├── CHANGELOG.rst
├── package.xml
├── CMakeLists.txt
├── include
│ └── rosidlcpp_generator_type_description
│ │ └── json_utils.hpp
└── resource
│ └── HashedTypeDescription.schema.json
├── CONTRIBUTING.md
├── rosidlcpp_typesupport_introspection_c
├── resource
│ ├── msg__rosidl_typesupport_introspection_c.h.template
│ ├── srv__rosidl_typesupport_introspection_c.h.template
│ ├── idl__type_support.c.template
│ ├── rosidl_typesupport_introspection_c__visibility_control.h.in
│ └── idl__rosidl_typesupport_introspection_c.h.template
├── include
│ └── rosidlcpp_typesupport_introspection_c
│ │ └── rosidlcpp_typesupport_introspection_c.hpp
├── CHANGELOG.rst
├── rosidlcpp_typesupport_introspection_c-extras.cmake.in
├── package.xml
└── CMakeLists.txt
├── rosidlcpp_typesupport_fastrtps_c
├── include
│ └── rosidlcpp_typesupport_fastrtps_c
│ │ └── rosidlcpp_typesupport_fastrtps_c.hpp
├── CHANGELOG.rst
├── resource
│ ├── srv__rosidl_typesupport_fastrtps_c.h.template
│ ├── rosidl_typesupport_fastrtps_c__visibility_control.h.in
│ ├── idl__type_support_c.cpp.template
│ └── idl__rosidl_typesupport_fastrtps_c.h.template
├── rosidlcpp_typesupport_fastrtps_c-extras.cmake.in
├── package.xml
└── CMakeLists.txt
├── rosidlcpp_typesupport_c
├── CHANGELOG.rst
├── include
│ └── rosidlcpp_typesupport_c
│ │ └── rosidlcpp_typesupport_c.hpp
├── rosidlcpp_typesupport_c-extras.cmake.in
├── resource
│ └── idl__type_support.cpp.template
├── package.xml
├── CMakeLists.txt
└── cmake
│ └── get_used_typesupports.cmake
├── rosidlcpp_typesupport_fastrtps_cpp
├── include
│ └── rosidlcpp_typesupport_fastrtps_cpp
│ │ └── rosidlcpp_typesupport_fastrtps_cpp.hpp
├── CHANGELOG.rst
├── resource
│ ├── srv__rosidl_typesupport_fastrtps_cpp.hpp.template
│ ├── rosidl_typesupport_fastrtps_cpp__visibility_control.h.in
│ ├── idl__type_support.cpp.template
│ └── idl__rosidl_typesupport_fastrtps_cpp.hpp.template
├── rosidlcpp_typesupport_fastrtps_cpp-extras.cmake.in
├── package.xml
└── CMakeLists.txt
├── rosidlcpp_typesupport_cpp
├── CHANGELOG.rst
├── include
│ └── rosidlcpp_typesupport_cpp
│ │ └── rosidlcpp_typesupport_cpp.hpp
├── rosidlcpp_typesupport_cpp-extras.cmake.in
├── resource
│ └── idl__type_support.cpp.template
├── package.xml
└── CMakeLists.txt
├── rosidlcpp_typesupport_introspection_cpp
├── include
│ └── rosidlcpp_typesupport_introspection_cpp
│ │ └── rosidlcpp_typesupport_introspection_cpp.hpp
├── resource
│ ├── msg__rosidl_typesupport_introspection_cpp.hpp.template
│ ├── srv__rosidl_typesupport_introspection_cpp.hpp.template
│ ├── idl__type_support.cpp.template
│ └── idl__rosidl_typesupport_introspection_cpp.hpp.template
├── CHANGELOG.rst
├── rosidlcpp_typesupport_introspection_cpp-extras.cmake.in
├── package.xml
└── CMakeLists.txt
└── .clang-format
/.clang-tidy:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/__init__.py.template:
--------------------------------------------------------------------------------
1 | {% for import in imports %}
2 | {{ import }}
3 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp/doc/img/flamegraph_rosidl.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TonyWelte/rosidlcpp/HEAD/rosidlcpp/doc/img/flamegraph_rosidl.jpg
--------------------------------------------------------------------------------
/rosidlcpp/doc/img/flamegraph_rosidlcpp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TonyWelte/rosidlcpp/HEAD/rosidlcpp/doc/img/flamegraph_rosidlcpp.jpg
--------------------------------------------------------------------------------
/rosidlcpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 | project(rosidlcpp NONE)
3 | find_package(ament_cmake REQUIRED)
4 | ament_package()
--------------------------------------------------------------------------------
/rosidlcpp/doc/img/flamegraph_rosidl_compilation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TonyWelte/rosidlcpp/HEAD/rosidlcpp/doc/img/flamegraph_rosidl_compilation.jpg
--------------------------------------------------------------------------------
/.clangd:
--------------------------------------------------------------------------------
1 | CompileFlags:
2 | CompilationDatabase: ../../build
3 | Diagnostics:
4 | MissingIncludes: Strict
5 | ClangTidy:
6 | Add:
7 | - modernize*
8 | - bugprone*
9 | - cppcoreguidelines*
10 | - performance*
--------------------------------------------------------------------------------
/.devcontainer/packages.repos:
--------------------------------------------------------------------------------
1 | repositories:
2 | px4_msgs:
3 | type: git
4 | url: https://github.com/PX4/px4_msgs.git
5 | version: main
6 | rcl_interfaces:
7 | type: git
8 | url: https://github.com/ros2/rcl_interfaces.git
9 | version: rolling
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/action__type_support.c.template:
--------------------------------------------------------------------------------
1 | {% set service = action.send_goal_service %}
2 | {% include "srv__type_support.c.template" %}
3 |
4 |
5 | {% set service = action.get_result_service %}
6 | {% include "srv__type_support.c.template" %}
7 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/srv__builder.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message = service.request_message %}
2 | {% include "msg__builder.hpp.template" %}
3 |
4 |
5 | {% set message = service.response_message %}
6 | {% include "msg__builder.hpp.template" %}
7 |
8 |
9 | {% set message = service.event_message %}
10 | {% include "msg__builder.hpp.template" %}
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/rosidlcpp_generator_py-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from rosidlcpp_generator_py/rosidlcpp_generator_py-extras.cmake
2 |
3 | include("${CMAKE_CURRENT_LIST_DIR}/register_py.cmake")
4 | rosidlcpp_generator_py_extras(
5 | "${rosidlcpp_generator_py_DIR}/../../../lib/rosidlcpp_generator_py/rosidlcpp_generator_py"
6 | "${rosidlcpp_generator_py_DIR}/../resource"
7 | )
8 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/rosidlcpp_generator_cpp-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from rosidlcpp_generator_cpp/rosidlcpp_generator_cpp-extras.cmake
2 |
3 |
4 | include("${CMAKE_CURRENT_LIST_DIR}/register_cpp.cmake")
5 | rosidlcpp_generator_cpp_extras(
6 | "${rosidlcpp_generator_cpp_DIR}/../../../lib/rosidlcpp_generator_cpp/rosidlcpp_generator_cpp"
7 | "${rosidlcpp_generator_cpp_DIR}/../resource"
8 | )
9 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/rosidlcpp_generator_c-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from rosidl_generator_c/rosidl_generator_c-extras.cmake
2 |
3 | # use the same type of library
4 | set(rosidl_generator_c_LIBRARY_TYPE "@rosidlcpp_generator_c_LIBRARY_TYPE@")
5 |
6 | include("${CMAKE_CURRENT_LIST_DIR}/register_c.cmake")
7 | rosidlcpp_generator_c_extras(
8 | "${rosidlcpp_generator_c_DIR}/../../../lib/rosidlcpp_generator_c/rosidlcpp_generator_c"
9 | "${rosidlcpp_generator_c_DIR}/../resource"
10 | )
11 |
--------------------------------------------------------------------------------
/rosidlcpp/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 |
11 | 0.2.1 (2025-07-14)
12 | ------------------
13 |
14 | 0.2.0 (2025-06-24)
15 | ------------------
16 |
17 | 0.1.2 (2025-06-21)
18 | ------------------
19 |
20 | 0.1.1 (2025-06-15)
21 | ------------------
22 |
23 | 0.1.0 (2025-05-25)
24 | ------------------
25 | * First release of rosidlcpp package
26 | * Contributors: Anthony Welte
27 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/action__builder.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message = action.goal %}
2 | {% include "msg__builder.hpp.template" %}
3 |
4 |
5 | {% set message = action.result %}
6 | {% include "msg__builder.hpp.template" %}
7 |
8 |
9 | {% set message = action.feedback %}
10 | {% include "msg__builder.hpp.template" %}
11 |
12 |
13 | {% set service = action.send_goal_service %}
14 | {% include "srv__builder.hpp.template" %}
15 |
16 |
17 | {% set service = action.get_result_service %}
18 | {% include "srv__builder.hpp.template" %}
19 |
20 |
21 | {% set message = action.feedback_message %}
22 | {% include "msg__builder.hpp.template" %}
--------------------------------------------------------------------------------
/.devcontainer/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG ROS_DISTRO=rolling
2 |
3 | FROM osrf/ros:${ROS_DISTRO}-desktop-full
4 |
5 | SHELL [ "/bin/bash" , "-c" ]
6 |
7 | # Upgrade all packages
8 | RUN sudo apt update && sudo apt upgrade -y
9 |
10 | # Install essential packages
11 | RUN sudo apt install -y wget ninja-build clangd-19 ssh nano neovim less
12 |
13 | # Create overlay workspace
14 | WORKDIR /root/ros_ws/src
15 | COPY packages.repos .
16 |
17 | RUN vcs import < packages.repos; \
18 | cd ..; \
19 | rosdep install --from-paths src --ignore-src -r -y;
20 |
21 | # Add sourcing ROS setup.bash to .bashrc
22 | RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/msg__type_support.h.template:
--------------------------------------------------------------------------------
1 | {% set header_file = "rosidl_runtime_c/message_type_support_struct.h" %}
2 | {% set include_directives = get_global_variable("include_directives") %}
3 | {% if header_file in include_directives %}
4 | // already included above
5 | // {{ "" -}}
6 | {% else %}
7 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
8 | {% endif %}
9 | #include "{{ header_file }}"
10 |
11 | // Forward declare the get type support functions for this type.
12 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
13 | const rosidl_message_type_support_t *
14 | ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
15 | rosidl_typesupport_c,
16 | {% for ns in message.type.namespaces %}
17 | {{ ns }},
18 | {% endfor %}
19 | {{ message.type.name }}
20 | )(void);
21 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/msg.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl.hpp.em
2 | // generated code does not contain a copyright notice
3 | {% set include_base = join(message.type.namespaces, "/") + "/detail/" + convert_camel_case_to_lower_case_underscore(message.type.name) %}
4 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "_HPP_" %}
5 |
6 | #ifndef {{ header_guard_variable }}
7 | #define {{ header_guard_variable }}
8 |
9 | #include "{{ include_base }}__struct.hpp"
10 | #include "{{ include_base }}__builder.hpp"
11 | #include "{{ include_base }}__traits.hpp"
12 | #include "{{ include_base }}__type_support.hpp"
13 |
14 | #endif // {{ header_guard_variable }}
15 |
--------------------------------------------------------------------------------
/rosidlcpp_parser/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_parser
5 | 0.4.0
6 | This package provides utilities to parse idl files into a json data structure
7 | Anthony Welte
8 | Apache License 2.0
9 |
10 | ament_cmake
11 |
12 | nlohmann-json-dev
13 | fmt
14 |
15 | ament_lint_auto
16 | ament_lint_common
17 |
18 |
19 | ament_cmake
20 |
21 |
22 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/idl.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl.hpp.em
2 | // generated code does not contain a copyright notice
3 |
4 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "_HPP_" %}
5 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
6 | #ifndef {{ header_guard_variable }}
7 | #define {{ header_guard_variable }}
8 |
9 | #include "{{ include_base }}__struct.hpp"
10 | #include "{{ include_base }}__builder.hpp"
11 | #include "{{ include_base }}__traits.hpp"
12 | #include "{{ include_base }}__type_support.hpp"
13 |
14 | #endif // {{ header_guard_variable }}
15 |
--------------------------------------------------------------------------------
/rosidlcpp_parser/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_parser
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Fix compilation on RHEL9 (`#12 `_)
11 | * Contributors: Anthony Welte
12 |
13 | 0.2.1 (2025-07-14)
14 | ------------------
15 | * Fix bounded sequence of bounded strings (`#10 `_)
16 | * Contributors: Anthony Welte
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 |
21 | 0.1.2 (2025-06-21)
22 | ------------------
23 |
24 | 0.1.1 (2025-06-15)
25 | ------------------
26 |
27 | 0.1.0 (2025-05-25)
28 | ------------------
29 | * First release of rosidlcpp_parser package
30 | * Contributors: Anthony Welte
31 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl.h.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 |
5 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "_H_" %}
6 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
7 | #ifndef {{ header_guard_variable }}
8 | #define {{ header_guard_variable }}
9 |
10 | #include "{{ include_base }}__struct.h"
11 | #include "{{ include_base }}__functions.h"
12 | #include "{{ include_base }}__type_support.h"
13 |
14 | #endif // {{ header_guard_variable }}
15 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_core/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_generator_core
5 | 0.4.0
6 | This package provides the basis for all rosidlcpp generators
7 | Anthony Welte
8 | Apache License 2.0
9 |
10 | ament_cmake
11 |
12 | nlohmann-json-dev
13 | fmt
14 | rosidlcpp_parser
15 |
16 | ament_lint_auto
17 | ament_lint_common
18 |
19 |
20 | ament_cmake
21 |
22 |
23 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_core/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_generator_core
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add jazzy support (`#11 `_)
11 | * Contributors: Anthony Welte
12 |
13 | 0.2.1 (2025-07-14)
14 | ------------------
15 |
16 | 0.2.0 (2025-06-24)
17 | ------------------
18 |
19 | 0.1.2 (2025-06-21)
20 | ------------------
21 | * Fix missing fmt dependency in rosidlcpp_generator_core (`#5 `_)
22 | * Contributors: Anthony Welte
23 |
24 | 0.1.1 (2025-06-15)
25 | ------------------
26 |
27 | 0.1.0 (2025-05-25)
28 | ------------------
29 | * First release of rosidlcpp_generator_core package
30 | * Contributors: Anthony Welte
31 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/srv__struct.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message = service.request_message %}
2 | {% include "msg__struct.hpp.template" %}
3 |
4 | {% set message = service.response_message %}
5 | {% include "msg__struct.hpp.template" %}
6 |
7 | {% set message = service.event_message %}
8 | {% include "msg__struct.hpp.template" %}
9 |
10 | {% for ns in service.type.namespaces %}
11 | namespace {{ ns }}
12 | {
13 |
14 | {% endfor %}
15 | struct {{ service.type.name }}
16 | {
17 | {% set service_typename = join(service.type.namespaces, "::") + "::" + service.type.name %}
18 | using Request = {{ service_typename }}_Request;
19 | using Response = {{ service_typename }}_Response;
20 | using Event = {{ service_typename }}_Event;
21 | };
22 | {% for i in range(length(service.type.namespaces)) %}
23 |
24 | } // namespace {{ at(service.type.namespaces, length(service.type.namespaces) - 1 - i) }}
25 | {% endfor %}
26 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/msg__type_support.hpp.template:
--------------------------------------------------------------------------------
1 | {% set header_file = "rosidl_typesupport_cpp/message_type_support.hpp" %}
2 | {% set include_directives = get_global_variable("include_directives") %}
3 | {% if header_file in include_directives %}
4 | // already included above
5 | // #include "{{ header_file }}"
6 | {% else %}
7 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
8 | #include "{{ header_file }}"
9 | {% endif %}
10 |
11 | #ifdef __cplusplus
12 | extern "C"
13 | {
14 | #endif
15 | // Forward declare the get type support functions for this type.
16 | ROSIDL_GENERATOR_CPP_PUBLIC_{{ package_name }}
17 | const rosidl_message_type_support_t *
18 | ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
19 | rosidl_typesupport_cpp,
20 | {{ join(message.type.namespaces, ",\n ") }},
21 | {{ message.type.name }}
22 | )();
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/rosidlcpp_generator_type_description-extras.cmake.in:
--------------------------------------------------------------------------------
1 | find_package(ament_cmake_core QUIET REQUIRED)
2 |
3 | if(NOT USE_ROSIDL_GENERATORS)
4 |
5 | # Replace rosidl_generator_cpp with rosidlcpp_generator_cpp
6 | find_package(rosidl_generator_type_description QUIET) # Needs to be loaded for its generator can be replace
7 | list(
8 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
9 | REPLACE "rosidl_generator_type_description:rosidl_generator_type_description_generate_interfaces.cmake"
10 | "rosidlcpp_generator_type_description:rosidlcpp_generator_type_description_generate_interfaces.cmake"
11 | )
12 |
13 | set(rosidlcpp_generator_type_description_BIN "${rosidlcpp_generator_type_description_DIR}/../../../lib/rosidlcpp_generator_type_description/rosidlcpp_generator_type_description")
14 | normalize_path(rosidlcpp_generator_type_description_BIN "${rosidlcpp_generator_type_description_BIN}")
15 |
16 | endif()
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # TODO
2 |
3 | TODO
4 |
5 | # License
6 |
7 | Any contribution that you make to this repository will
8 | be under the Apache 2 License, as dictated by that
9 | [license](http://www.apache.org/licenses/LICENSE-2.0.html):
10 |
11 | ~~~
12 | 5. Submission of Contributions. Unless You explicitly state otherwise,
13 | any Contribution intentionally submitted for inclusion in the Work
14 | by You to the Licensor shall be under the terms and conditions of
15 | this License, without any additional terms or conditions.
16 | Notwithstanding the above, nothing herein shall supersede or modify
17 | the terms of any separate license agreement you may have executed
18 | with Licensor regarding such Contributions.
19 | ~~~
20 |
21 | Contributors must sign-off each commit by adding a `Signed-off-by: ...`
22 | line to commit messages to certify that they have the right to submit
23 | the code they are contributing to the project according to the
24 | [Developer Certificate of Origin (DCO)](https://developercertificate.org/).
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/resource/msg__rosidl_typesupport_introspection_c.h.template:
--------------------------------------------------------------------------------
1 | {% set include_directives = get_global_variable("include_directives") -%}
2 | {% set header_files = ["rosidl_runtime_c/message_type_support_struct.h", "rosidl_typesupport_interface/macros.h"] %}
3 | {% set header_files = push_back(header_files, package_name + "/msg/rosidl_typesupport_introspection_c__visibility_control.h") %}
4 | {% for header_file in header_files %}
5 | {% if header_file in include_directives %}
6 | // already included above
7 | // {% else -%}
8 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
9 | {% endif %}
10 | #include "{{ header_file }}"
11 | {% endfor %}
12 |
13 | ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_{{ package_name }}
14 | const rosidl_message_type_support_t *
15 | ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ message.type.name }})();
16 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/include/rosidlcpp_generator_cpp/rosidlcpp_generator_cpp.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorCpp : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorCpp(rosidlcpp_core::GeneratorArguments generator_arguments);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | };
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_generator_py
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Fix compilation on RHEL9 (`#12 `_)
11 | * Add jazzy support (`#11 `_)
12 | * Contributors: Anthony Welte
13 |
14 | 0.2.1 (2025-07-14)
15 | ------------------
16 | * Fix bounded strings (`#10 `_)
17 | * Contributors: Anthony Welte
18 |
19 | 0.2.0 (2025-06-24)
20 | ------------------
21 | * Fix __eq_\_ for Array fields (`#8 `_)
22 | * Contributors: Anthony Welte
23 |
24 | 0.1.2 (2025-06-21)
25 | ------------------
26 |
27 | 0.1.1 (2025-06-15)
28 | ------------------
29 |
30 | 0.1.0 (2025-05-25)
31 | ------------------
32 | * First release of rosidlcpp_generator_py package
33 | * Contributors: Anthony Welte
34 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/include/rosidlcpp_typesupport_fastrtps_c/rosidlcpp_typesupport_fastrtps_c.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorTypesupportFastrtpsC : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorTypesupportFastrtpsC(rosidlcpp_core::GeneratorArguments generator_arguments);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | };
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/include/rosidlcpp_generator_c/rosidlcpp_generator_c.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorC : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorC(rosidlcpp_core::GeneratorArguments generator_arguments, bool disable_description_codegen);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | bool m_disable_description_codegen;
28 | };
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_c
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add ros_environment dependency to fix missing ROS_DISTRO variable (`#13 `_)
11 | * Fix compilation on RHEL9 (`#12 `_)
12 | * Add jazzy support (`#11 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 |
21 | 0.1.2 (2025-06-21)
22 | ------------------
23 |
24 | 0.1.1 (2025-06-15)
25 | ------------------
26 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
27 | * Contributors: Anthony Welte
28 |
29 | 0.1.0 (2025-05-25)
30 | ------------------
31 | * First release of rosidlcpp_typesupport_c package
32 | * Contributors: Anthony Welte
33 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/include/rosidlcpp_typesupport_fastrtps_cpp/rosidlcpp_typesupport_fastrtps_cpp.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorTypesupportFastrtpsCpp : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorTypesupportFastrtpsCpp(const rosidlcpp_core::GeneratorArguments& generator_arguments);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | };
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_cpp
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add ros_environment dependency to fix missing ROS_DISTRO variable (`#13 `_)
11 | * Fix compilation on RHEL9 (`#12 `_)
12 | * Add jazzy support (`#11 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 |
21 | 0.1.2 (2025-06-21)
22 | ------------------
23 |
24 | 0.1.1 (2025-06-15)
25 | ------------------
26 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
27 | * Contributors: Anthony Welte
28 |
29 | 0.1.0 (2025-05-25)
30 | ------------------
31 | * First release of rosidlcpp_typesupport_cpp package
32 | * Contributors: Anthony Welte
33 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/include/rosidlcpp_typesupport_introspection_c/rosidlcpp_typesupport_introspection_c.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorTypesupportIntrospectionC : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorTypesupportIntrospectionC(const rosidlcpp_core::GeneratorArguments& generator_arguments);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | };
28 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_generator_type_description
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 |
11 | 0.2.1 (2025-07-14)
12 | ------------------
13 | * Several small bugfixes after the first public release (`#10 `_)
14 | * Contributors: Anthony Welte
15 |
16 | 0.2.0 (2025-06-24)
17 | ------------------
18 |
19 | 0.1.2 (2025-06-21)
20 | ------------------
21 | * Fix missing fmt dependency in rosidlcpp_generator_core (`#5 `_)
22 | * Contributors: Anthony Welte
23 |
24 | 0.1.1 (2025-06-15)
25 | ------------------
26 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
27 | * Contributors: Anthony Welte
28 |
29 | 0.1.0 (2025-05-25)
30 | ------------------
31 | * First release of rosidlcpp_generator_type_description package
32 | * Contributors: Anthony Welte
33 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_generator_type_description
5 | 0.4.0
6 | Generate hashes and descriptions of ROS 2 interface types, per REP-2011.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 |
13 | ament_cmake
14 |
15 | ament_cmake_core
16 |
17 | nlohmann-json-dev
18 | fmt
19 | rosidlcpp_parser
20 | rosidlcpp_generator_core
21 | rcutils
22 | rosidl_runtime_c
23 |
24 | rosidl_generator_packages
25 |
26 |
27 | ament_cmake
28 |
29 |
30 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/include/rosidlcpp_typesupport_introspection_cpp/rosidlcpp_typesupport_introspection_cpp.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | class GeneratorTypesupportIntrospectionCpp : public rosidlcpp_core::GeneratorBase {
20 | public:
21 | GeneratorTypesupportIntrospectionCpp(rosidlcpp_core::GeneratorArguments generator_arguments);
22 |
23 | void run();
24 |
25 | private:
26 | rosidlcpp_core::GeneratorArguments m_arguments;
27 | };
28 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/resource/msg__rosidl_typesupport_introspection_cpp.hpp.template:
--------------------------------------------------------------------------------
1 | {% set include_directives = get_global_variable("include_directives") -%}
2 | {% set header_files = ["rosidl_runtime_c/message_type_support_struct.h", "rosidl_typesupport_interface/macros.h", "rosidl_typesupport_introspection_cpp/visibility_control.h"] %}
3 |
4 | {% for header_file in header_files %}
5 | {% if header_file in include_directives %}
6 | // already included above
7 | // {% else -%}
8 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
9 | {% endif %}
10 | #include "{{ header_file }}"
11 | {% endfor %}
12 |
13 | #ifdef __cplusplus
14 | extern "C"
15 | {
16 | #endif
17 |
18 | // TODO(dirk-thomas) these visibility macros should be message package specific
19 | ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
20 | const rosidl_message_type_support_t *
21 | ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_cpp, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ message.type.name }})();
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/cmake/rosidlcpp_generator_py_get_typesupports.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2016 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | macro(rosidlcpp_generator_py_get_typesupports TYPESUPPORT_IMPLS)
16 | set(${TYPESUPPORT_IMPLS} "")
17 | ament_index_get_resources(${TYPESUPPORT_IMPLS} "rosidl_typesupport_c")
18 | list(APPEND ${TYPESUPPORT_IMPLS} "rosidl_typesupport_c")
19 | foreach(_typesupport ${${TYPESUPPORT_IMPLS}})
20 | find_package(${_typesupport} QUIET)
21 | if(NOT ${_typesupport}_FOUND)
22 | list(REMOVE_ITEM ${TYPESUPPORT_IMPLS} "${_typesupport}")
23 | endif()
24 | endforeach()
25 | endmacro()
26 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_generator_cpp
5 | 0.4.0
6 | Generate the ROS interfaces in C++.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | ament_cmake
13 |
14 | ament_cmake_core
15 |
16 | nlohmann-json-dev
17 | fmt
18 | rosidlcpp_parser
19 | rosidlcpp_generator_core
20 |
21 | rosidl_cmake
22 | rosidl_generator_type_description
23 | rosidl_typesupport_interface
24 | rcutils
25 |
26 | rosidl_generator_packages
27 |
28 |
29 | ament_cmake
30 |
31 |
32 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/include/rosidlcpp_generator_py/rosidlcpp_generator_py.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | #include
20 | #include
21 |
22 | class GeneratorPython : public rosidlcpp_core::GeneratorBase {
23 | public:
24 | GeneratorPython(rosidlcpp_core::GeneratorArguments generator_arguments, std::vector typesupport_implementations_list);
25 |
26 | void run();
27 |
28 | private:
29 | rosidlcpp_core::GeneratorArguments m_arguments;
30 | std::vector m_typesupport_implementations;
31 | };
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/include/rosidlcpp_typesupport_c/rosidlcpp_typesupport_c.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | #include
20 | #include
21 |
22 | class GeneratorTypesupportC : public rosidlcpp_core::GeneratorBase {
23 | public:
24 | GeneratorTypesupportC(rosidlcpp_core::GeneratorArguments generator_arguments, std::vector typesupport_implementations_list);
25 |
26 | void run();
27 |
28 | private:
29 | rosidlcpp_core::GeneratorArguments m_arguments;
30 | std::vector m_typesupport_implementations;
31 | };
32 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/include/rosidlcpp_typesupport_cpp/rosidlcpp_typesupport_cpp.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | #include
20 | #include
21 |
22 | class GeneratorTypesupportCpp : public rosidlcpp_core::GeneratorBase {
23 | public:
24 | GeneratorTypesupportCpp(rosidlcpp_core::GeneratorArguments generator_arguments, std::vector typesupport_implementations_list);
25 |
26 | void run();
27 |
28 | private:
29 | rosidlcpp_core::GeneratorArguments m_arguments;
30 | std::vector m_typesupport_implementations;
31 | };
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/idl__type_support.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl__type_support.hpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filedir }}/{{ interface_path.filename }}.idl
3 | // generated code does not contain a copyright notice
4 |
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__TYPE_SUPPORT_HPP_" %}
7 | #ifndef {{ header_guard_variable }}
8 | #define {{ header_guard_variable }}
9 |
10 | #include "rosidl_typesupport_interface/macros.h"
11 |
12 | #include "{{ package_name }}/msg/rosidl_generator_cpp__visibility_control.hpp"
13 |
14 | {% for msg_object in messages %}
15 | {% set message=msg_object.message %}
16 | {% include "msg__type_support.hpp.template" %}
17 |
18 | {% endfor %}
19 | {% for service in services %}
20 | {% include "srv__type_support.hpp.template" %}
21 |
22 | {% endfor %}
23 | {% for action in actions %}
24 | {% include "action__type_support.hpp.template" %}
25 |
26 | {% endfor %}
27 | #endif // {{ header_guard_variable }}
28 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/srv__type_support.hpp.template:
--------------------------------------------------------------------------------
1 | {% set header_file = "rosidl_typesupport_cpp/service_type_support.hpp" %}
2 | {% set include_directives = get_global_variable("include_directives") %}
3 | {% if header_file in include_directives %}
4 | // already included above
5 | // {{ "" -}}
6 | {% else %}
7 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
8 | {% endif %}
9 | #include "{{ header_file }}"
10 |
11 | #ifdef __cplusplus
12 | extern "C"
13 | {
14 | #endif
15 | // Forward declare the get type support functions for this type.
16 | ROSIDL_GENERATOR_CPP_PUBLIC_{{ package_name }}
17 | const rosidl_service_type_support_t *
18 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(
19 | rosidl_typesupport_cpp,
20 | {{ join(service.type.namespaces, ",\n ") }},
21 | {{ service.type.name }}
22 | )();
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | {% set message = service.request_message %}
28 | {% include "msg__type_support.hpp.template" %}
29 |
30 | {% set include_directives = push_back(include_directives, "rosidl_typesupport_cpp/message_type_support.hpp") %}
31 | {% set message = service.response_message %}
32 | {% include "msg__type_support.hpp.template" %}
33 |
34 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_fastrtps_c
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 | * Port rosidl_typesupport_fastrtps`#130 `_ (`#14 `_)
8 | * Contributors: Anthony Welte
9 |
10 | 0.3.0 (2025-07-21)
11 | ------------------
12 | * Fix compilation on RHEL9 (`#12 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 |
21 | 0.1.2 (2025-06-21)
22 | ------------------
23 | * Fix missing fmt dependency in rosidlcpp_generator_core (`#5 `_)
24 | * Contributors: Anthony Welte
25 |
26 | 0.1.1 (2025-06-15)
27 | ------------------
28 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
29 | * Contributors: Anthony Welte
30 |
31 | 0.1.0 (2025-05-25)
32 | ------------------
33 | * First release of rosidlcpp_typesupport_fastrtps_c package
34 | * Contributors: Anthony Welte
35 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_fastrtps_cpp
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 | * Port rosidl_typesupport_fastrtps`#130 `_ (`#14 `_)
8 | * Contributors: Anthony Welte
9 |
10 | 0.3.0 (2025-07-21)
11 | ------------------
12 | * Fix compilation on RHEL9 (`#12 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 |
21 | 0.1.2 (2025-06-21)
22 | ------------------
23 | * Fix missing fmt dependency in rosidlcpp_generator_core (`#5 `_)
24 | * Contributors: Anthony Welte
25 |
26 | 0.1.1 (2025-06-15)
27 | ------------------
28 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
29 | * Contributors: Anthony Welte
30 |
31 | 0.1.0 (2025-05-25)
32 | ------------------
33 | * First release of rosidlcpp_typesupport_fastrtps_cpp package
34 | * Contributors: Anthony Welte
35 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_generator_type_description)
4 |
5 | find_package(ament_cmake REQUIRED)
6 |
7 | find_package(nlohmann_json REQUIRED)
8 | find_package(fmt REQUIRED)
9 |
10 | find_package(rosidlcpp_parser REQUIRED)
11 | find_package(rosidlcpp_generator_core REQUIRED)
12 |
13 | find_package(rcutils REQUIRED)
14 | find_package(rosidl_runtime_c REQUIRED)
15 |
16 | ament_index_register_resource("rosidl_generator_packages")
17 |
18 | add_executable(rosidlcpp_generator_type_description src/rosidlcpp_generator_type_description/rosidlcpp_generator_type_description.cpp src/rosidlcpp_generator_type_description/json_utils.cpp)
19 |
20 | target_include_directories(rosidlcpp_generator_type_description PUBLIC include)
21 | target_link_libraries(rosidlcpp_generator_type_description PUBLIC fmt::fmt nlohmann_json::nlohmann_json rosidlcpp_parser::rosidlcpp_parser rosidlcpp_generator_core::rosidlcpp_generator_core rcutils::rcutils rosidl_runtime_c::rosidl_runtime_c)
22 |
23 | ament_package(
24 | CONFIG_EXTRAS "${PROJECT_NAME}-extras.cmake.in"
25 | )
26 |
27 | install(
28 | TARGETS rosidlcpp_generator_type_description
29 | DESTINATION lib/rosidlcpp_generator_type_description
30 | )
31 |
32 | install(
33 | DIRECTORY cmake resource
34 | DESTINATION share/${PROJECT_NAME}
35 | )
36 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_introspection_c
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add ros_environment dependency to fix missing ROS_DISTRO variable (`#13 `_)
11 | * Fix compilation on RHEL9 (`#12 `_)
12 | * Add jazzy support (`#11 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 | * Fix shared/static library type for generator_c and introspection_c[pp] (`#6 `_)
21 | * Contributors: Anthony Welte
22 |
23 | 0.1.2 (2025-06-21)
24 | ------------------
25 |
26 | 0.1.1 (2025-06-15)
27 | ------------------
28 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
29 | * Contributors: Anthony Welte
30 |
31 | 0.1.0 (2025-05-25)
32 | ------------------
33 | * First release of rosidlcpp_typesupport_introspection_c package
34 | * Contributors: Anthony Welte
35 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_typesupport_introspection_cpp
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add ros_environment dependency to fix missing ROS_DISTRO variable (`#13 `_)
11 | * Fix compilation on RHEL9 (`#12 `_)
12 | * Add jazzy support (`#11 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 |
18 | 0.2.0 (2025-06-24)
19 | ------------------
20 | * Fix shared/static library type for generator_c and introspection_c[pp] (`#6 `_)
21 | * Contributors: Anthony Welte
22 |
23 | 0.1.2 (2025-06-21)
24 | ------------------
25 |
26 | 0.1.1 (2025-06-15)
27 | ------------------
28 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
29 | * Contributors: Anthony Welte
30 |
31 | 0.1.0 (2025-05-25)
32 | ------------------
33 | * First release of rosidlcpp_typesupport_introspection_cpp package
34 | * Contributors: Anthony Welte
35 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 | project(rosidlcpp_generator_core)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | set(CMAKE_CXX_STANDARD 23)
9 |
10 | # find dependencies
11 | find_package(ament_cmake REQUIRED)
12 | find_package(nlohmann_json REQUIRED)
13 | find_package(fmt REQUIRED)
14 | find_package(rosidlcpp_parser REQUIRED)
15 |
16 | add_library(${PROJECT_NAME} SHARED src/${PROJECT_NAME}/generator_base.cpp src/${PROJECT_NAME}/generator_utils.cpp)
17 | target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json fmt::fmt rosidlcpp_parser::rosidlcpp_parser)
18 | target_include_directories(${PROJECT_NAME} PUBLIC
19 | "$"
20 | "$")
21 |
22 | install(TARGETS ${PROJECT_NAME}
23 | EXPORT export_${PROJECT_NAME}
24 | ARCHIVE DESTINATION lib
25 | LIBRARY DESTINATION lib
26 | )
27 |
28 | install(DIRECTORY include/ DESTINATION include)
29 |
30 | ament_export_include_directories("include/${PROJECT_NAME}")
31 | ament_export_libraries(${PROJECT_NAME})
32 |
33 | ament_export_dependencies(ament_cmake nlohmann_json fmt rosidlcpp_parser)
34 |
35 | # Export modern CMake targets
36 | ament_export_targets(export_${PROJECT_NAME})
37 |
38 | ament_package()
39 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/resource/srv__rosidl_typesupport_introspection_c.h.template:
--------------------------------------------------------------------------------
1 | {% set message=service.request_message %}
2 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
3 |
4 | {% set message=service.response_message %}
5 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
6 |
7 | {% set message=service.event_message %}
8 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
9 |
10 | {% set include_directives = get_global_variable("include_directives") %}
11 | {% set header_files = ["rosidl_runtime_c/service_type_support_struct.h", "rosidl_typesupport_interface/macros.h"] %}
12 | {% set header_files = push_back(header_files, package_name + "/msg/rosidl_typesupport_introspection_c__visibility_control.h") %}
13 | {% for header_file in header_files %}
14 | {% if header_file in include_directives %}
15 | // already included above
16 | // {% else -%}
17 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
18 | {% endif %}
19 | #include "{{ header_file }}"
20 | {% endfor %}
21 |
22 | ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_{{ package_name }}
23 | const rosidl_service_type_support_t *
24 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_introspection_c, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ service.type.name }})();
25 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/action__type_support.h.template:
--------------------------------------------------------------------------------
1 | {% set header_file = "rosidl_runtime_c/action_type_support_struct.h" %}
2 | {% set include_directives = get_global_variable("include_directives") %}
3 | {% if header_file in include_directives %}
4 | // already included above
5 | // {{ "" -}}
6 | {% else %}
7 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
8 | {% endif %}
9 | #include "{{ header_file }}"
10 |
11 | // Forward declare the get type support functions for this type.
12 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
13 | const rosidl_action_type_support_t *
14 | ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME(
15 | rosidl_typesupport_c,
16 | {% for ns in action.type.namespaces %}
17 | {{ ns }},
18 | {% endfor %}
19 | {{ action.type.name }}
20 | )(void);
21 |
22 | {% set message = action.goal %}
23 | {% include "msg__type_support.h.template" %}
24 |
25 | {% set message = action.result %}
26 | {% include "msg__type_support.h.template" %}
27 |
28 | {% set message = action.feedback %}
29 | {% include "msg__type_support.h.template" %}
30 |
31 | {% set service = action.send_goal_service %}
32 | {% include "srv__type_support.h.template" %}
33 |
34 | {% set service = action.get_result_service %}
35 | {% include "srv__type_support.h.template" %}
36 |
37 | {% set message = action.feedback_message %}
38 | {% include "msg__type_support.h.template" %}
39 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_generator_cpp)
4 |
5 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6 | add_compile_options(-Wall -Wextra -Wpedantic -Werror)
7 | endif()
8 |
9 | set(CMAKE_CXX_STANDARD 23)
10 |
11 | # find dependencies
12 | find_package(ament_cmake REQUIRED)
13 |
14 | find_package(fmt REQUIRED)
15 | find_package(nlohmann_json REQUIRED)
16 |
17 | find_package(rosidlcpp_parser REQUIRED)
18 | find_package(rosidlcpp_generator_core REQUIRED)
19 |
20 | add_executable(rosidlcpp_generator_cpp src/rosidlcpp_generator_cpp/rosidlcpp_generator_cpp.cpp)
21 |
22 | target_include_directories(rosidlcpp_generator_cpp PUBLIC include)
23 | target_link_libraries(
24 | rosidlcpp_generator_cpp
25 | PUBLIC
26 | fmt::fmt
27 | nlohmann_json::nlohmann_json
28 | rosidlcpp_parser::rosidlcpp_parser
29 | rosidlcpp_generator_core::rosidlcpp_generator_core
30 | )
31 |
32 | ament_export_dependencies(
33 | fmt
34 | nlohmann_json
35 | rosidlcpp_parser
36 | rosidlcpp_generator_core
37 | )
38 |
39 | ament_index_register_resource("rosidl_generator_packages")
40 |
41 | ament_package(
42 | CONFIG_EXTRAS "rosidlcpp_generator_cpp-extras.cmake.in"
43 | )
44 |
45 | install(
46 | TARGETS rosidlcpp_generator_cpp
47 | DESTINATION lib/rosidlcpp_generator_cpp
48 | )
49 |
50 | install(
51 | DIRECTORY cmake resource
52 | DESTINATION share/${PROJECT_NAME}
53 | )
54 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/idl__builder.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl__builder.hpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filedir }}/{{ interface_path.filename }}.idl
3 | // generated code does not contain a copyright notice
4 |
5 | // IWYU pragma: private, include "{{ package_name }}/{{ interface_path.filedir }}/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}.hpp"
6 |
7 |
8 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__BUILDER_HPP_" %}
9 | #ifndef {{ header_guard_variable }}
10 | #define {{ header_guard_variable }}
11 |
12 | #include
13 | #include
14 |
15 | #include "{{ package_name }}/{{ interface_path.filedir }}/detail/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}__struct.hpp"
16 | #include "rosidl_runtime_cpp/message_initialization.hpp"
17 |
18 |
19 | {% for msg_object in messages %}
20 | {% set message=msg_object.message %}
21 | {% include "msg__builder.hpp.template" %}
22 |
23 | {% endfor %}
24 | {% for service in services %}
25 | {% include "srv__builder.hpp.template" %}
26 |
27 | {% endfor %}
28 | {% for action in actions %}
29 | {% include "action__builder.hpp.template" %}
30 |
31 | {% endfor %}
32 | #endif // {{ header_guard_variable }}
33 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/resource/srv__rosidl_typesupport_introspection_cpp.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message=service.request_message %}
2 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
3 |
4 | {% set message=service.response_message %}
5 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
6 |
7 | {% set message=service.event_message %}
8 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
9 |
10 |
11 | {% set include_directives = get_global_variable("include_directives") %}
12 | {% set header_files = ["rosidl_runtime_c/service_type_support_struct.h", "rosidl_typesupport_interface/macros.h", "rosidl_typesupport_introspection_cpp/visibility_control.h"] %}
13 | {% for header_file in header_files %}
14 | {% if header_file in include_directives %}
15 | // already included above
16 | // {% else -%}
17 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
18 | {% endif %}
19 | #include "{{ header_file }}"
20 | {% endfor %}
21 |
22 | #ifdef __cplusplus
23 | extern "C"
24 | {
25 | #endif
26 |
27 | ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
28 | const rosidl_service_type_support_t *
29 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_introspection_cpp, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ service.type.name }})();
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_generator_py)
4 |
5 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6 | add_compile_options(-Wall -Wextra -Wpedantic -Werror)
7 | endif()
8 |
9 | set(CMAKE_CXX_STANDARD 23)
10 |
11 | find_package(ament_cmake REQUIRED)
12 |
13 | find_package(nlohmann_json REQUIRED)
14 | find_package(fmt REQUIRED)
15 |
16 | find_package(rosidlcpp_parser REQUIRED)
17 | find_package(rosidlcpp_generator_core REQUIRED)
18 |
19 | ament_export_dependencies(ament_cmake)
20 | ament_export_dependencies(rmw)
21 |
22 | add_executable(rosidlcpp_generator_py src/rosidlcpp_generator_py/rosidlcpp_generator_py.cpp)
23 |
24 | target_include_directories(rosidlcpp_generator_py PUBLIC include)
25 | target_link_libraries(rosidlcpp_generator_py PUBLIC fmt::fmt nlohmann_json::nlohmann_json rosidlcpp_parser::rosidlcpp_parser rosidlcpp_generator_core::rosidlcpp_generator_core)
26 |
27 | ament_index_register_resource("rosidl_generator_packages")
28 |
29 | if(BUILD_TESTING)
30 | # TODO
31 | endif()
32 |
33 | ament_package(
34 | CONFIG_EXTRAS "cmake/rosidlcpp_generator_py_get_typesupports.cmake"
35 | "cmake/register_py.cmake"
36 | "rosidlcpp_generator_py-extras.cmake.in"
37 | )
38 |
39 | install(
40 | TARGETS rosidlcpp_generator_py
41 | DESTINATION lib/rosidlcpp_generator_py
42 | )
43 | install(
44 | DIRECTORY cmake resource
45 | DESTINATION share/${PROJECT_NAME}
46 | )
47 |
--------------------------------------------------------------------------------
/.devcontainer/gdb_nlohmann.py:
--------------------------------------------------------------------------------
1 | import gdb
2 | import re
3 |
4 | ns_pattern = re.compile(r'nlohmann(::json_abi(?P\w*)(_v(?P\d+)_(?P\d+)_(?P\d+))?)?::(?P.+)')
5 | class JsonValuePrinter:
6 | "Print a json-value"
7 |
8 | def __init__(self, val):
9 | self.val = val
10 |
11 | def to_string(self):
12 | if self.val.type.strip_typedefs().code == gdb.TYPE_CODE_FLT:
13 | return ("%.6f" % float(self.val)).rstrip("0")
14 | return self.val
15 |
16 | def json_lookup_function(val):
17 | if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
18 | name = m.group('name')
19 | if name and name.startswith('basic_json<') and name.endswith('>'):
20 | m_data = val['m_data']
21 | m_type = m_data['m_type']
22 | m = ns_pattern.fullmatch(str(m_type))
23 | t = m.group('name')
24 | prefix = 'detail::value_t::'
25 | if t and t.startswith(prefix):
26 | try:
27 | union_val = m_data['m_value'][t.replace(prefix, '', 1)]
28 | if union_val.type.code == gdb.TYPE_CODE_PTR:
29 | return gdb.default_visualizer(union_val.dereference())
30 | else:
31 | return JsonValuePrinter(union_val)
32 | except Exception:
33 | return JsonValuePrinter(m_type)
34 |
35 | gdb.pretty_printers.append(json_lookup_function)
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_generator_c
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 |
8 | 0.3.0 (2025-07-21)
9 | ------------------
10 | * Add ros_environment dependency to fix missing ROS_DISTRO variable (`#13 `_)
11 | * Fix compilation on RHEL9 (`#12 `_)
12 | * Add jazzy support (`#11 `_)
13 | * Contributors: Anthony Welte
14 |
15 | 0.2.1 (2025-07-14)
16 | ------------------
17 | * Fix CRLF interface files (`#10 `_)
18 | * Contributors: Anthony Welte
19 |
20 | 0.2.0 (2025-06-24)
21 | ------------------
22 | * Fix shared/static library type for generator_c and introspection_c[pp] (`#6 `_)
23 | * Contributors: Anthony Welte
24 |
25 | 0.1.2 (2025-06-21)
26 | ------------------
27 |
28 | 0.1.1 (2025-06-15)
29 | ------------------
30 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
31 | * Contributors: Anthony Welte
32 |
33 | 0.1.0 (2025-05-25)
34 | ------------------
35 | * Fix escaped strings to match changes from https://github.com/ros2/rosidl/pull/862
36 | * First release of rosidlcpp_generator_c package
37 | * Contributors: Anthony Welte
38 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/resource/srv__rosidl_typesupport_fastrtps_c.h.template:
--------------------------------------------------------------------------------
1 | {% set message=service.request_message %}
2 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
3 |
4 | {% set message=service.response_message %}
5 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
6 |
7 | {% set message=service.event_message %}
8 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
9 |
10 |
11 | {% set include_directives = get_global_variable("include_directives") %}
12 | {% set header_files = ["rosidl_runtime_c/service_type_support_struct.h", "rosidl_typesupport_interface/macros.h"] %}
13 | {% set header_files = push_back(header_files, package_name + "/msg/rosidl_typesupport_fastrtps_c__visibility_control.h") %}
14 | {% for header_file in header_files %}
15 | {% if header_file in include_directives %}
16 | // already included above
17 | // {% else -%}
18 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
19 | {% endif %}
20 | #include "{{ header_file }}"
21 | {% endfor %}
22 |
23 | #ifdef __cplusplus
24 | extern "C"
25 | {
26 | #endif
27 |
28 | ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_{{ package_name }}
29 | const rosidl_service_type_support_t *
30 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_fastrtps_c, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ service.type.name }})();
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_generator_py
5 | 0.4.0
6 | Generate the ROS interfaces in Python.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | rosidl_runtime_c
13 |
14 | nlohmann-json-dev
15 | fmt
16 | rosidlcpp_parser
17 | rosidlcpp_generator_core
18 |
19 | ament_cmake
20 |
21 | rmw
22 |
23 | ament_cmake
24 | ament_index_python
25 | python_cmake_module
26 | rosidl_generator_c
27 | rosidl_pycommon
28 | rosidl_typesupport_c
29 | rosidl_typesupport_interface
30 |
31 | rosidl_generator_packages
32 |
33 |
34 | ament_cmake
35 |
36 |
37 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_generator_c
5 | 0.4.0
6 | Generate the ROS interfaces in C.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | ament_cmake
13 | ament_cmake_ros
14 | ament_cmake_ros_core
15 |
16 |
17 | ros_environment
18 |
19 | ament_cmake_core
20 |
21 | nlohmann-json-dev
22 | fmt
23 | rosidlcpp_parser
24 | rosidlcpp_generator_core
25 |
26 | rosidl_cmake
27 | rosidl_generator_type_description
28 | rosidl_typesupport_interface
29 | rcutils
30 |
31 | rosidl_generator_packages
32 |
33 |
34 | ament_cmake
35 |
36 |
37 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/resource/srv__rosidl_typesupport_fastrtps_cpp.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message=service.request_message %}
2 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
3 |
4 | {% set message=service.response_message %}
5 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
6 |
7 | {% set message=service.event_message %}
8 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
9 |
10 | {% set include_directives = get_global_variable("include_directives") %}
11 | {% set header_files = ["rmw/types.h", "rosidl_typesupport_cpp/service_type_support.hpp", "rosidl_typesupport_interface/macros.h"] %}
12 | {% set header_files = push_back(header_files, package_name + "/msg/rosidl_typesupport_fastrtps_cpp__visibility_control.h") %}
13 | {% for header_file in header_files %}
14 | {% if header_file in include_directives %}
15 | // already included above
16 | // {% else -%}
17 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
18 | {% endif %}
19 | #include "{{ header_file }}"
20 | {% endfor %}
21 |
22 | #ifdef __cplusplus
23 | extern "C"
24 | {
25 | #endif
26 |
27 | ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_{{ package_name }}
28 | const rosidl_service_type_support_t *
29 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, {{ package_name + ", " + join(split_string(interface_path.filedir, "/"), ", ") }}, {{ service.type.name }})();
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_idl.py.template:
--------------------------------------------------------------------------------
1 | # generated from rosidl_generator_py/resource/_idl.py.em
2 | # with input from {{ package_name }}:{{ interface_path.filepath }}
3 | # generated code does not contain a copyright notice
4 |
5 | # This is being done at the module level and not on the instance level to avoid looking
6 | # for the same variable multiple times on each instance. This variable is not supposed to
7 | # change during runtime so it makes sense to only look for it once.
8 | from os import getenv
9 |
10 | ros_python_check_fields = getenv('ROS_PYTHON_CHECK_FIELDS', default='')
11 | {% set import_statements = set_global_variable("import_statements", []) %}
12 | {########################################################################}
13 | {# Handle messages #}
14 | {########################################################################}
15 | {% for message_obj in messages %}
16 | {% set message = message_obj.message %}
17 | {% include "_msg.py.template" %}
18 | {% endfor %}
19 | {########################################################################}
20 | {# Handle services #}
21 | {########################################################################}
22 | {% for service in services %}
23 | {% include "_srv.py.template" %}
24 |
25 | {% endfor %}
26 | {########################################################################}
27 | {# Handle actions #}
28 | {########################################################################}
29 | {% for action in actions %}
30 | {% include "_action.py.template" %}
31 |
32 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package rosidlcpp_generator_cpp
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2025-09-07)
6 | ------------------
7 | * Port rosidl`#864 `_ (`#16 `_)
8 | * Port rosidl`#863 `_ (`#15 `_)
9 | * Contributors: Anthony Welte
10 |
11 | 0.3.0 (2025-07-21)
12 | ------------------
13 | * Fix compilation on RHEL9 (`#12 `_)
14 | * Add jazzy support (`#11 `_)
15 | * Contributors: Anthony Welte
16 |
17 | 0.2.1 (2025-07-14)
18 | ------------------
19 | * Fix array with default values (`#10 `_)
20 | * Contributors: Anthony Welte
21 |
22 | 0.2.0 (2025-06-24)
23 | ------------------
24 | * Add name and data_type traits for actions (`#7 `_)
25 | * Contributors: Anthony Welte
26 |
27 | 0.1.2 (2025-06-21)
28 | ------------------
29 |
30 | 0.1.1 (2025-06-15)
31 | ------------------
32 | * Fix circular dependency caused by ament_cmake_ros dependency (`#4 `_)
33 | * Contributors: Anthony Welte
34 |
35 | 0.1.0 (2025-05-25)
36 | ------------------
37 | * First release of rosidlcpp_generator_cpp package
38 | * Contributors: Anthony Welte
39 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/action__type_support.hpp.template:
--------------------------------------------------------------------------------
1 | {% set header_file = "rosidl_typesupport_cpp/action_type_support.hpp" %}
2 | {% set include_directives = get_global_variable("include_directives") %}
3 | {% if header_file in include_directives %}
4 | // already included above
5 | // {{ "" -}}
6 | {% else %}
7 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
8 | {% endif %}
9 | #include "{{ header_file }}"
10 |
11 | #ifdef __cplusplus
12 | extern "C"
13 | {
14 | #endif
15 | // Forward declare the get type support functions for this type.
16 | ROSIDL_GENERATOR_CPP_PUBLIC_{{ package_name }}
17 | const rosidl_action_type_support_t *
18 | ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME(
19 | rosidl_typesupport_cpp,
20 | {% for ns in action.type.namespaces %}
21 | {{ ns }},
22 | {% endfor %}
23 | {{ action.type.name }}
24 | )();
25 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | {% set message = action.goal %}
30 | {% include "msg__type_support.hpp.template" %}
31 |
32 | {% set message = action.result %}
33 | {% include "msg__type_support.hpp.template" %}
34 |
35 | {% set message = action.feedback %}
36 | {% include "msg__type_support.hpp.template" %}
37 |
38 | {% set service = action.send_goal_service %}
39 | {% include "srv__type_support.hpp.template" %}
40 |
41 | {% set service = action.get_result_service %}
42 | {% include "srv__type_support.hpp.template" %}
43 |
44 | {% set message = action.feedback_message %}
45 | {% include "msg__type_support.hpp.template" %}
--------------------------------------------------------------------------------
/rosidlcpp/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp
5 | 0.4.0
6 | Meta package depending on all rosidlcpp generators
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | ament_cmake
13 |
14 | ament_cmake_core
15 | rosidlcpp_typesupport_c
16 | rosidlcpp_typesupport_cpp
17 |
18 | rosidlcpp_generator_c
19 | rosidlcpp_generator_cpp
20 | rosidlcpp_generator_py
21 | rosidlcpp_generator_type_description
22 | rosidlcpp_typesupport_fastrtps_c
23 | rosidlcpp_typesupport_introspection_c
24 | rosidlcpp_typesupport_fastrtps_cpp
25 | rosidlcpp_typesupport_introspection_cpp
26 |
27 |
28 | ament_cmake
29 |
30 |
31 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/idl__traits.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl__traits.hpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filedir }}/{{ interface_path.filename }}.idl
3 | // generated code does not contain a copyright notice
4 |
5 | // IWYU pragma: private, include "{{ package_name }}/{{ interface_path.filedir }}/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}.hpp"
6 |
7 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__TRAITS_HPP_" %}
8 | {% set include_directives = set_global_variable("include_directives", []) %}
9 |
10 | #ifndef {{ header_guard_variable }}
11 | #define {{ header_guard_variable }}
12 |
13 | #include
14 |
15 | #include
16 | #include
17 | #include
18 |
19 | #include "{{ package_name }}/{{ interface_path.filedir }}/detail/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}__struct.hpp"
20 | #include "rosidl_runtime_cpp/traits.hpp"
21 | {% for msg_object in messages %}
22 | {% set message=msg_object.message %}
23 | {% include "msg__traits.hpp.template" %}
24 |
25 | {% endfor %}
26 | {% for service in services %}
27 | {% include "srv__traits.hpp.template" %}
28 |
29 | {% endfor %}
30 | {% for action in actions %}
31 | {% include "action__traits.hpp.template" %}
32 |
33 | {% endfor %}
34 | #endif // {{ header_guard_variable }}
35 |
--------------------------------------------------------------------------------
/rosidlcpp_parser/src/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include
16 |
17 | #include
18 | #include
19 |
20 | int main(int argc, char* argv[]) {
21 | auto result = rosidlcpp_parser::parse_idl_file(argv[1]);
22 |
23 | if (argc == 2) {
24 | std::cout << result.dump(2) << std::endl;
25 | return 0;
26 | } else if (argc == 3) {
27 | std::ofstream output_file(argv[2]);
28 | output_file << result.dump(2) << std::endl;
29 | output_file.close();
30 | return 0;
31 | } else if (argc == 4) {
32 | auto ros_json = rosidlcpp_parser::convert_idljson_to_rosjson(result, argv[1]);
33 | std::ofstream output_file(argv[3]);
34 | output_file << ros_json.dump(2) << std::endl;
35 | output_file.close();
36 | return 0;
37 | } else {
38 | std::cerr << "Usage: rosidlcpp_parser [output_file]" << std::endl;
39 | return 1;
40 | }
41 |
42 | return 0;
43 | }
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/rosidlcpp_typesupport_c-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidl_typesupport_c/rosidl_typesupport_c-extras.cmake.in
3 |
4 | # use the same type of library
5 | set(rosidl_typesupport_c_LIBRARY_TYPE "@rosidlcpp_typesupport_c_LIBRARY_TYPE@")
6 |
7 | include("${rosidlcpp_typesupport_c_DIR}/get_used_typesupports.cmake")
8 | get_used_typesupports(_typesupports "rosidl_typesupport_c")
9 |
10 | # Make sure extension points are registered in order
11 | find_package(rosidl_generator_c QUIET)
12 | foreach(_typesupport ${_typesupports})
13 | find_package(${_typesupport} QUIET)
14 | endforeach()
15 |
16 | find_package(ament_cmake_core QUIET REQUIRED)
17 |
18 | if(NOT USE_ROSIDL_GENERATORS)
19 |
20 | # Replace rosidl_typesupport_c with rosidlcpp_typesupport_c
21 | find_package(rosidl_typesupport_c QUIET) # Needs to be loaded for its generator can be replace
22 | list(
23 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
24 | REPLACE "rosidl_typesupport_c:rosidl_typesupport_c_generate_interfaces.cmake"
25 | "rosidlcpp_typesupport_c:rosidlcpp_typesupport_c_generate_interfaces.cmake"
26 | )
27 |
28 | set(rosidlcpp_typesupport_c_BIN "${rosidlcpp_typesupport_c_DIR}/../../../lib/rosidlcpp_typesupport_c/rosidlcpp_typesupport_c")
29 | normalize_path(rosidlcpp_typesupport_c_BIN "${rosidlcpp_typesupport_c_BIN}")
30 |
31 | set(rosidlcpp_typesupport_c_TEMPLATE_DIR "${rosidlcpp_typesupport_c_DIR}/../resource")
32 | normalize_path(rosidlcpp_typesupport_c_TEMPLATE_DIR "${rosidlcpp_typesupport_c_TEMPLATE_DIR}")
33 |
34 | endif()
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/cmake/register_c.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | macro(rosidlcpp_generator_c_extras BIN TEMPLATE_DIR)
16 | if(NOT USE_ROSIDL_GENERATORS)
17 | find_package(ament_cmake_core QUIET REQUIRED)
18 | find_package(rosidl_generator_type_description QUIET REQUIRED)
19 |
20 | # Replace rosidl_generator_c with rosidlcpp_generator_c
21 | find_package(rosidl_generator_c QUIET) # Needs to be loaded for its generator can be replace
22 | list(
23 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
24 | REPLACE "rosidl_generator_c:rosidl_generator_c_generate_interfaces.cmake"
25 | "rosidlcpp_generator_c:rosidlcpp_generator_c_generate_interfaces.cmake"
26 | )
27 |
28 | normalize_path(BIN "${BIN}")
29 | set(rosidlcpp_generator_c_BIN "${BIN}")
30 |
31 | normalize_path(TEMPLATE_DIR "${TEMPLATE_DIR}")
32 | set(rosidlcpp_generator_c_TEMPLATE_DIR "${TEMPLATE_DIR}")
33 | endif()
34 | endmacro()
35 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/rosidlcpp_typesupport_cpp-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidl_typesupport_cpp/rosidl_typesupport_cpp-extras.cmake.in
3 |
4 | # use the same type of library
5 | set(rosidl_typesupport_cpp_LIBRARY_TYPE "@rosidlcpp_typesupport_cpp_LIBRARY_TYPE@")
6 |
7 | find_package(rosidl_typesupport_c QUIET REQUIRED)
8 | get_used_typesupports(_typesupports "rosidl_typesupport_cpp")
9 |
10 | # Make sure extension points are registered in order
11 | find_package(rosidl_generator_cpp QUIET)
12 | foreach(_typesupport ${_typesupports})
13 | find_package(${_typesupport} QUIET)
14 | endforeach()
15 |
16 | find_package(ament_cmake_core QUIET REQUIRED)
17 |
18 | if(NOT USE_ROSIDL_GENERATORS)
19 |
20 | # Replace rosidl_typesupport_cpp with rosidlcpp_typesupport_cpp
21 | find_package(rosidl_typesupport_cpp QUIET) # Needs to be loaded for its generator can be replace
22 | list(
23 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
24 | REPLACE "rosidl_typesupport_cpp:rosidl_typesupport_cpp_generate_interfaces.cmake"
25 | "rosidlcpp_typesupport_cpp:rosidlcpp_typesupport_cpp_generate_interfaces.cmake"
26 | )
27 |
28 | set(rosidlcpp_typesupport_cpp_BIN "${rosidlcpp_typesupport_cpp_DIR}/../../../lib/rosidlcpp_typesupport_cpp/rosidlcpp_typesupport_cpp")
29 | normalize_path(rosidlcpp_typesupport_cpp_BIN "${rosidlcpp_typesupport_cpp_BIN}")
30 |
31 | set(rosidlcpp_typesupport_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_cpp_DIR}/../resource")
32 | normalize_path(rosidlcpp_typesupport_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_cpp_TEMPLATE_DIR}")
33 |
34 | endif()
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/cmake/register_cpp.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | macro(rosidlcpp_generator_cpp_extras BIN TEMPLATE_DIR)
16 | if(NOT USE_ROSIDL_GENERATORS)
17 | find_package(ament_cmake_core QUIET REQUIRED)
18 | find_package(rosidl_generator_type_description QUIET REQUIRED)
19 |
20 | # Replace rosidl_generator_cpp with rosidlcpp_generator_cpp
21 | find_package(rosidl_generator_cpp QUIET) # Needs to be loaded for its generator can be replace
22 | list(
23 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
24 | REPLACE "rosidl_generator_cpp:rosidl_generator_cpp_generate_interfaces.cmake"
25 | "rosidlcpp_generator_cpp:rosidlcpp_generator_cpp_generate_interfaces.cmake"
26 | )
27 |
28 | normalize_path(BIN "${BIN}")
29 | set(rosidlcpp_generator_cpp_BIN "${BIN}")
30 |
31 | normalize_path(TEMPLATE_DIR "${TEMPLATE_DIR}")
32 | set(rosidlcpp_generator_cpp_TEMPLATE_DIR "${TEMPLATE_DIR}")
33 | endif()
34 | endmacro()
35 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/rosidlcpp_typesupport_introspection_c-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidl_typesupport_introspection_c/
3 | # rosidl_typesupport_introspection_c-extras.cmake.in
4 |
5 | # use the same type of library
6 | set(rosidl_typesupport_introspection_c_LIBRARY_TYPE "@rosidlcpp_typesupport_introspection_c_LIBRARY_TYPE@")
7 |
8 | # Make sure rosidl_generator_c extension point is registered first
9 | find_package(rosidl_generator_c QUIET)
10 |
11 | find_package(ament_cmake_core QUIET REQUIRED)
12 |
13 | if(NOT USE_ROSIDL_GENERATORS)
14 |
15 | # Replace rosidl_typesupport_introspection_c with rosidlcpp_typesupport_introspection_c
16 | find_package(rosidl_typesupport_introspection_c QUIET) # Needs to be loaded for its generator can be replace
17 | list(
18 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
19 | REPLACE "rosidl_typesupport_introspection_c:rosidl_typesupport_introspection_c_generate_interfaces.cmake"
20 | "rosidlcpp_typesupport_introspection_c:rosidlcpp_typesupport_introspection_c_generate_interfaces.cmake"
21 | )
22 |
23 | set(rosidlcpp_typesupport_introspection_c_BIN "${rosidlcpp_typesupport_introspection_c_DIR}/../../../lib/rosidlcpp_typesupport_introspection_c/rosidlcpp_typesupport_introspection_c")
24 | normalize_path(rosidlcpp_typesupport_introspection_c_BIN "${rosidlcpp_typesupport_introspection_c_BIN}")
25 |
26 | set(rosidlcpp_typesupport_introspection_c_TEMPLATE_DIR "${rosidlcpp_typesupport_introspection_c_DIR}/../resource")
27 | normalize_path(rosidlcpp_typesupport_introspection_c_TEMPLATE_DIR "${rosidlcpp_typesupport_introspection_c_TEMPLATE_DIR}")
28 |
29 | endif()
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/rosidlcpp_typesupport_introspection_cpp-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidl_typesupport_introspection_cpp/
3 | # rosidl_typesupport_introspection_cpp-extras.cmake.in
4 |
5 | # use the same type of library
6 | set(rosidl_typesupport_introspection_cpp_LIBRARY_TYPE "@rosidlcpp_typesupport_introspection_cpp_LIBRARY_TYPE@")
7 |
8 | # Make sure extension points are registered in order
9 | find_package(rosidl_generator_cpp QUIET)
10 |
11 | find_package(ament_cmake_core QUIET REQUIRED)
12 |
13 | if(NOT USE_ROSIDL_GENERATORS)
14 |
15 | # Replace rosidl_typesupport_introspection_cpp with rosidlcpp_typesupport_introspection_cpp
16 | find_package(rosidl_typesupport_introspection_cpp QUIET) # Needs to be loaded for its generator can be replace
17 | list(
18 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
19 | REPLACE "rosidl_typesupport_introspection_cpp:rosidl_typesupport_introspection_cpp_generate_interfaces.cmake"
20 | "rosidlcpp_typesupport_introspection_cpp:rosidlcpp_typesupport_introspection_cpp_generate_interfaces.cmake"
21 | )
22 |
23 | set(rosidlcpp_typesupport_introspection_cpp_BIN "${rosidlcpp_typesupport_introspection_cpp_DIR}/../../../lib/rosidlcpp_typesupport_introspection_cpp/rosidlcpp_typesupport_introspection_cpp")
24 | normalize_path(rosidlcpp_typesupport_introspection_cpp_BIN "${rosidlcpp_typesupport_introspection_cpp_BIN}")
25 |
26 | set(rosidlcpp_typesupport_introspection_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_introspection_cpp_DIR}/../resource")
27 | normalize_path(rosidlcpp_typesupport_introspection_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_introspection_cpp_TEMPLATE_DIR}")
28 |
29 | endif()
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl__type_support.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl__type_support.c.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 |
5 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
6 | {% set top_level_includes = ["rosidl_typesupport_interface/macros.h"] %}
7 | {% set top_level_includes = push_back(top_level_includes, include_base + "__type_support.h") %}
8 | {% set top_level_includes = push_back(top_level_includes, include_base + "__struct.h") %}
9 | {% set top_level_includes = push_back(top_level_includes, include_base + "__functions.h") %}
10 | {% set include_directives = set_global_variable("include_directives", top_level_includes) %}
11 | #include
12 |
13 | {% for header_file in top_level_includes %}
14 | #include "{{ header_file }}"
15 | {% endfor %}
16 |
17 | #ifdef __cplusplus
18 | extern "C"
19 | {
20 | #endif
21 |
22 | {########################################################################}
23 | {# Handle service #}
24 | {########################################################################}
25 | {% for service in services %}
26 |
27 | {% include "srv__type_support.c.template" %}
28 |
29 | {% endfor %}
30 | {########################################################################}
31 | {# Handle action #}
32 | {########################################################################}
33 | {% for action in actions %}
34 |
35 | {% include "action__type_support.c.template" %}
36 |
37 | {% endfor %}
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/cmake/register_py.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | macro(rosidlcpp_generator_py_extras BIN TEMPLATE_DIR)
16 | if(NOT USE_ROSIDL_GENERATORS)
17 | find_package(ament_cmake_core QUIET REQUIRED)
18 | # Make sure extension points are registered in order
19 | find_package(rosidl_generator_c QUIET REQUIRED)
20 | find_package(rosidl_typesupport_c QUIET REQUIRED)
21 |
22 | # Replace rosidl_generator_py with rosidlcpp_generator_py
23 | find_package(rosidl_generator_py QUIET) # Needs to be loaded for its generator can be replace
24 | list(
25 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
26 | REPLACE "rosidl_generator_py:rosidl_generator_py_generate_interfaces.cmake"
27 | "rosidlcpp_generator_py:rosidlcpp_generator_py_generate_interfaces.cmake"
28 | )
29 |
30 | normalize_path(BIN "${BIN}")
31 | set(rosidlcpp_generator_py_BIN "${BIN}")
32 |
33 | normalize_path(TEMPLATE_DIR "${TEMPLATE_DIR}")
34 | set(rosidlcpp_generator_py_TEMPLATE_DIR "${TEMPLATE_DIR}")
35 | endif()
36 | endmacro()
37 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_introspection_c
5 | 0.4.0
6 |
7 | Generate the message type support for dynamic message construction in C.
8 |
9 |
10 | Anthony Welte
11 |
12 | Apache License 2.0
13 |
14 | ament_cmake
15 | ament_cmake_ros
16 | ament_cmake_ros_core
17 |
18 |
19 | ros_environment
20 |
21 | nlohmann-json-dev
22 | fmt
23 | rosidlcpp_parser
24 | rosidlcpp_generator_core
25 |
26 | rosidl_cmake
27 | rosidl_runtime_c
28 | rosidl_typesupport_interface
29 |
30 | ament_index_python
31 | rosidl_cli
32 | rosidl_generator_c
33 | rosidl_parser
34 | rosidl_pycommon
35 |
36 | rosidl_generator_packages
37 |
38 |
39 | ament_cmake
40 |
41 |
42 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/action__traits.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message = action.goal %}
2 | {% include "msg__traits.hpp.template" %}
3 | {% set message = action.result %}
4 | {% include "msg__traits.hpp.template" %}
5 | {% set message = action.feedback %}
6 | {% include "msg__traits.hpp.template" %}
7 | {% set service = action.send_goal_service %}
8 | {% include "srv__traits.hpp.template" %}
9 | {% set service = action.get_result_service %}
10 | {% include "srv__traits.hpp.template" %}
11 | {% set message = action.feedback_message %}
12 | {% include "msg__traits.hpp.template" %}
13 |
14 |
15 | {% set action_typename = join(action.type.namespaces, "::") + "::" + action.type.name %}
16 | {% set action_fully_qualified_name = join(action.type.namespaces, "/") + "/" + action.type.name %}
17 | namespace rosidl_generator_traits
18 | {
19 |
20 | {% if ROS_DISTRO != "jazzy" %}
21 | template<>
22 | inline const char * data_type<{{ action_typename }}>()
23 | {
24 | return "{{ action_typename }}";
25 | }
26 |
27 | template<>
28 | inline const char * name<{{ action_typename }}>()
29 | {
30 | return "{{ action_fully_qualified_name }}";
31 | }
32 |
33 | {% endif %}
34 | template<>
35 | struct is_action<{{ action_typename }}>
36 | : std::true_type
37 | {
38 | };
39 |
40 | template<>
41 | struct is_action_goal<{{ action_typename }}{{ ACTION_GOAL_SUFFIX }}>
42 | : std::true_type
43 | {
44 | };
45 |
46 | template<>
47 | struct is_action_result<{{ action_typename }}{{ ACTION_RESULT_SUFFIX }}>
48 | : std::true_type
49 | {
50 | };
51 |
52 | template<>
53 | struct is_action_feedback<{{ action_typename }}{{ ACTION_FEEDBACK_SUFFIX }}>
54 | : std::true_type
55 | {
56 | };
57 |
58 | } // namespace rosidl_generator_traits
59 |
60 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/rosidlcpp_typesupport_fastrtps_c-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidlcpp_typesupport_fastrtps_c/rosidlcpp_typesupport_fastrtps_c-extras.cmake.in
3 |
4 | find_package(fastcdr 2 REQUIRED CONFIG)
5 |
6 | if(NOT fastcdr_FOUND)
7 | message(STATUS
8 | "Could not find eProsima Fast CDR: skipping rosidl_typesupport_fastrtps_c"
9 | )
10 | else()
11 | find_package(ament_cmake_core QUIET REQUIRED)
12 |
13 | if(NOT USE_ROSIDL_GENERATORS)
14 |
15 | # This generator generates code dependent on code generated by rosidl_generator_c
16 | # Find it first so it registers it's extensions first
17 | find_package(rosidl_generator_c REQUIRED)
18 |
19 | # Replace rosidl_typesupport_fastrtps_c with rosidlcpp_typesupport_fastrtps_c
20 | find_package(rosidl_typesupport_fastrtps_c QUIET) # Needs to be loaded for its generator can be replace
21 | list(
22 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
23 | REPLACE "rosidl_typesupport_fastrtps_c:rosidl_typesupport_fastrtps_c_generate_interfaces.cmake"
24 | "rosidlcpp_typesupport_fastrtps_c:rosidlcpp_typesupport_fastrtps_c_generate_interfaces.cmake"
25 | )
26 |
27 | set(rosidlcpp_typesupport_fastrtps_c_BIN "${rosidlcpp_typesupport_fastrtps_c_DIR}/../../../lib/rosidlcpp_typesupport_fastrtps_c/rosidlcpp_typesupport_fastrtps_c")
28 | normalize_path(rosidlcpp_typesupport_fastrtps_c_BIN "${rosidlcpp_typesupport_fastrtps_c_BIN}")
29 |
30 | set(rosidlcpp_typesupport_fastrtps_c_TEMPLATE_DIR "${rosidlcpp_typesupport_fastrtps_c_DIR}/../resource")
31 | normalize_path(rosidlcpp_typesupport_fastrtps_c_TEMPLATE_DIR "${rosidlcpp_typesupport_fastrtps_c_TEMPLATE_DIR}")
32 |
33 | endif()
34 | endif()
35 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/empty__description.c.template:
--------------------------------------------------------------------------------
1 | {# Included from rosidl_generator_c/resource/idl__description.c.em #}
2 |
3 | /// Define exported TypeDescriptions and TypeSources
4 | { set all_type_descriptions = insert(implicit_type_descriptions, 0, toplevel_type_description) }
5 | {% for type_description in all_type_descriptions %}
6 | {% set td_typename = type_description.msg.type_description.type_name %}
7 | {% set td_c_typename = replace(td_typename, "/", "__") %}
8 |
9 | const rosidl_runtime_c__type_description__TypeDescription *
10 | {{ td_c_typename }}__{{ GET_DESCRIPTION_FUNC }}(
11 | const rosidl_{{ type_description.type }})_type_support_t * type_support)
12 | {
13 | (void)type_support;
14 | static const rosidl_runtime_c__type_description__TypeDescription description = {
15 | {
16 | {NULL, 0, 0},
17 | {NULL, 0, 0},
18 | },
19 | {NULL, 0, 0},
20 | };
21 | return &description;
22 | }
23 |
24 | const rosidl_runtime_c__type_description__TypeSource *
25 | {{ td_c_typename }}__{{ GET_INDIVIDUAL_SOURCE_FUNC }}(
26 | const rosidl_{{ type_description.type }})_type_support_t * type_support)
27 | {
28 | (void)type_support;
29 | static const rosidl_runtime_c__type_description__TypeSource source = {
30 | {NULL, 0, 0},
31 | {NULL, 0, 0},
32 | {NULL, 0, 0}
33 | };
34 | return &source;
35 | }
36 |
37 | const rosidl_runtime_c__type_description__TypeSource__Sequence *
38 | {{ td_c_typename }}__{{ GET_SOURCES_FUNC }}(
39 | const rosidl_{{ type_description.type }})_type_support_t * type_support)
40 | {
41 | (void)type_support;
42 | static const rosidl_runtime_c__type_description__TypeSource__Sequence sources = {NULL, 0, 0};
43 | return &sources;
44 | }
45 | {% endfor %}
46 |
47 |
--------------------------------------------------------------------------------
/rosidlcpp_parser/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 | project(rosidlcpp_parser)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | set(CMAKE_CXX_STANDARD 23)
9 |
10 | # find dependencies
11 | find_package(ament_cmake REQUIRED)
12 |
13 | find_package(nlohmann_json REQUIRED)
14 | find_package(fmt REQUIRED)
15 |
16 | add_library(rosidlcpp_parser SHARED src/rosidlcpp_parser/rosidlcpp_parser.cpp)
17 | target_link_libraries(rosidlcpp_parser nlohmann_json::nlohmann_json fmt::fmt)
18 | target_include_directories(rosidlcpp_parser PUBLIC
19 | "$"
20 | "$")
21 |
22 | add_executable(main src/main.cpp)
23 | target_include_directories(main PUBLIC
24 | "$"
25 | "$")
26 | target_link_libraries(main rosidlcpp_parser)
27 |
28 | install(TARGETS ${PROJECT_NAME} main
29 | EXPORT export_${PROJECT_NAME}
30 | RUNTIME DESTINATION bin
31 | ARCHIVE DESTINATION lib
32 | LIBRARY DESTINATION lib
33 | )
34 |
35 | install(DIRECTORY include/ DESTINATION include)
36 |
37 | if(BUILD_TESTING)
38 | find_package(ament_cmake_gtest REQUIRED)
39 |
40 | ament_add_gtest(rosidlcpp_parser_test test/unit/rosidlcpp_parser_test.cpp)
41 | target_link_libraries(rosidlcpp_parser_test rosidlcpp_parser)
42 | target_include_directories(rosidlcpp_parser_test PUBLIC include)
43 | endif()
44 |
45 | ament_export_include_directories("include/${PROJECT_NAME}")
46 | ament_export_libraries(${PROJECT_NAME})
47 |
48 | # Export modern CMake targets
49 | ament_export_targets(export_${PROJECT_NAME})
50 |
51 | ament_package()
52 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/idl__struct.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/idl__struct.hpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filedir }}/{{ interface_path.filename }}.idl
3 | // generated code does not contain a copyright notice
4 |
5 | // IWYU pragma: private, include "{{ package_name }}/{{ interface_path.filedir }}/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}.hpp"
6 |
7 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__STRUCT_HPP_" %}
8 | {% set include_directives = set_global_variable("include_directives", []) %}
9 |
10 | #ifndef {{ header_guard_variable }}
11 | #define {{ header_guard_variable }}
12 |
13 | #include
14 | #include
15 | {% if ROS_DISTRO != "jazzy" and ROS_DISTRO != "kilted" %}
16 | #include
17 | {% endif %}
18 | #include
19 | #include
20 | #include
21 |
22 | #include "rosidl_runtime_cpp/bounded_vector.hpp"
23 | #include "rosidl_runtime_cpp/message_initialization.hpp"
24 |
25 | {########################################################################}
26 | {# Handle message #}
27 | {########################################################################}
28 | {% for msg_object in messages %}
29 | {% set message=msg_object.message %}
30 | {% include "msg__struct.hpp.template" %}
31 |
32 | {% endfor %}
33 | {% for service in services %}
34 | {% include "srv__struct.hpp.template" %}
35 |
36 | {% endfor %}
37 | {% for action in actions %}
38 | {% include "action__struct.hpp.template" %}
39 |
40 | {% endfor %}
41 | #endif // {{ header_guard_variable }}
42 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/rosidlcpp_typesupport_fastrtps_cpp-extras.cmake.in:
--------------------------------------------------------------------------------
1 | # generated from
2 | # rosidl_typesupport_fastrtps_cpp/
3 | # rosidl_typesupport_fastrtps_cpp-extras.cmake.in
4 |
5 | find_package(fastcdr 2 REQUIRED CONFIG)
6 |
7 | if(NOT fastcdr_FOUND)
8 | message(STATUS
9 | "Could not find eProsima Fast CDR - skip rosidl_typesupport_fastrtps_cpp"
10 | )
11 | else()
12 | find_package(ament_cmake_core QUIET REQUIRED)
13 |
14 | if(NOT USE_ROSIDL_GENERATORS)
15 |
16 | # This generator generates code dependent on code generated by rosidl_generator_cpp
17 | # Find it first so it registers it's extensions first
18 | find_package(rosidl_generator_cpp REQUIRED)
19 |
20 | # Replace rosidl_typesupport_fastrtps_cpp with rosidlcpp_typesupport_fastrtps_cpp
21 | find_package(rosidl_typesupport_fastrtps_cpp QUIET) # Needs to be loaded for its generator can be replace
22 | list(
23 | TRANSFORM AMENT_EXTENSIONS_rosidl_generate_idl_interfaces
24 | REPLACE "rosidl_typesupport_fastrtps_cpp:rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake"
25 | "rosidlcpp_typesupport_fastrtps_cpp:rosidlcpp_typesupport_fastrtps_cpp_generate_interfaces.cmake"
26 | )
27 |
28 |
29 | set(rosidlcpp_typesupport_fastrtps_cpp_BIN "${rosidlcpp_typesupport_fastrtps_cpp_DIR}/../../../lib/rosidlcpp_typesupport_fastrtps_cpp/rosidlcpp_typesupport_fastrtps_cpp")
30 | normalize_path(rosidlcpp_typesupport_fastrtps_cpp_BIN "${rosidlcpp_typesupport_fastrtps_cpp_BIN}")
31 |
32 | set(rosidlcpp_typesupport_fastrtps_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_fastrtps_cpp_DIR}/../resource")
33 | normalize_path(rosidlcpp_typesupport_fastrtps_cpp_TEMPLATE_DIR "${rosidlcpp_typesupport_fastrtps_cpp_TEMPLATE_DIR}")
34 |
35 | endif()
36 | endif()
37 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/rosidl_generator_c__visibility_control.h.in:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/rosidl_generator_c__visibility_control.h.in
2 | // generated code does not contain a copyright notice
3 |
4 | #ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_
5 | #define @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_
6 |
7 | #ifdef __cplusplus
8 | extern "C"
9 | {
10 | #endif
11 |
12 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
13 | // https://gcc.gnu.org/wiki/Visibility
14 |
15 | #if defined _WIN32 || defined __CYGWIN__
16 | #ifdef __GNUC__
17 | #define ROSIDL_GENERATOR_C_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport))
18 | #define ROSIDL_GENERATOR_C_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport))
19 | #else
20 | #define ROSIDL_GENERATOR_C_EXPORT_@PROJECT_NAME@ __declspec(dllexport)
21 | #define ROSIDL_GENERATOR_C_IMPORT_@PROJECT_NAME@ __declspec(dllimport)
22 | #endif
23 | #ifdef ROSIDL_GENERATOR_C_BUILDING_DLL_@PROJECT_NAME@
24 | #define ROSIDL_GENERATOR_C_PUBLIC_@PROJECT_NAME@ ROSIDL_GENERATOR_C_EXPORT_@PROJECT_NAME@
25 | #else
26 | #define ROSIDL_GENERATOR_C_PUBLIC_@PROJECT_NAME@ ROSIDL_GENERATOR_C_IMPORT_@PROJECT_NAME@
27 | #endif
28 | #else
29 | #define ROSIDL_GENERATOR_C_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default")))
30 | #define ROSIDL_GENERATOR_C_IMPORT_@PROJECT_NAME@
31 | #if __GNUC__ >= 4
32 | #define ROSIDL_GENERATOR_C_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default")))
33 | #else
34 | #define ROSIDL_GENERATOR_C_PUBLIC_@PROJECT_NAME@
35 | #endif
36 | #endif
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
42 | #endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_
43 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/rosidl_generator_cpp__visibility_control.hpp.in:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_cpp/resource/rosidl_generator_cpp__visibility_control.hpp.in
2 | // generated code does not contain a copyright notice
3 |
4 | #ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_CPP__VISIBILITY_CONTROL_HPP_
5 | #define @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_CPP__VISIBILITY_CONTROL_HPP_
6 |
7 | #ifdef __cplusplus
8 | extern "C"
9 | {
10 | #endif
11 |
12 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
13 | // https://gcc.gnu.org/wiki/Visibility
14 |
15 | #if defined _WIN32 || defined __CYGWIN__
16 | #ifdef __GNUC__
17 | #define ROSIDL_GENERATOR_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport))
18 | #define ROSIDL_GENERATOR_CPP_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport))
19 | #else
20 | #define ROSIDL_GENERATOR_CPP_EXPORT_@PROJECT_NAME@ __declspec(dllexport)
21 | #define ROSIDL_GENERATOR_CPP_IMPORT_@PROJECT_NAME@ __declspec(dllimport)
22 | #endif
23 | #ifdef ROSIDL_GENERATOR_CPP_BUILDING_DLL_@PROJECT_NAME@
24 | #define ROSIDL_GENERATOR_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_GENERATOR_CPP_EXPORT_@PROJECT_NAME@
25 | #else
26 | #define ROSIDL_GENERATOR_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_GENERATOR_CPP_IMPORT_@PROJECT_NAME@
27 | #endif
28 | #else
29 | #define ROSIDL_GENERATOR_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default")))
30 | #define ROSIDL_GENERATOR_CPP_IMPORT_@PROJECT_NAME@
31 | #if __GNUC__ >= 4
32 | #define ROSIDL_GENERATOR_CPP_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default")))
33 | #else
34 | #define ROSIDL_GENERATOR_CPP_PUBLIC_@PROJECT_NAME@
35 | #endif
36 | #endif
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
42 | #endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_GENERATOR_CPP__VISIBILITY_CONTROL_HPP_
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/resource/idl__type_support.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_introspection_c/resource/idl__type_support.c.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {########################################################################}
7 | {# Handle message #}
8 | {########################################################################}
9 | {% for msg_object in messages %}
10 | {% set message=msg_object.message %}
11 | {% include "msg__type_support.c.template" %}
12 |
13 | {% endfor %}
14 | {########################################################################}
15 | {# Handle service #}
16 | {########################################################################}
17 | {% for service in services %}
18 | {% set message=service.request_message %}
19 | {% include "srv__type_support.c.template" %}
20 |
21 | {% endfor %}
22 | {########################################################################}
23 | {# Handle action #}
24 | {########################################################################}
25 | {% for action in actions %}
26 | {% set message=action.goal %}
27 | {% include "msg__type_support.c.template" %}
28 |
29 | {% set message=action.result %}
30 | {% include "msg__type_support.c.template" %}
31 |
32 | {% set message=action.feedback %}
33 | {% include "msg__type_support.c.template" %}
34 |
35 | {% set service=action.send_goal_service %}
36 | {% include "srv__type_support.c.template" %}
37 |
38 | {% set service=action.get_result_service %}
39 | {% include "srv__type_support.c.template" %}
40 |
41 | {% set message=action.feedback_message %}
42 | {% include "msg__type_support.c.template" %}
43 |
44 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_generator_c)
4 |
5 | if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
6 | add_compile_options(-Wall -Wextra -Wpedantic)
7 | endif()
8 |
9 | set(CMAKE_CXX_STANDARD 23)
10 |
11 | find_package(ament_cmake REQUIRED)
12 | if($ENV{ROS_DISTRO} STREQUAL "jazzy")
13 | find_package(ament_cmake_ros REQUIRED)
14 | else()
15 | find_package(ament_cmake_ros_core REQUIRED)
16 | endif()
17 |
18 | find_package(fmt REQUIRED)
19 | find_package(nlohmann_json REQUIRED)
20 |
21 | find_package(rosidlcpp_parser REQUIRED)
22 | find_package(rosidlcpp_generator_core REQUIRED)
23 |
24 | add_executable(rosidlcpp_generator_c src/rosidlcpp_generator_c/rosidlcpp_generator_c.cpp)
25 |
26 | target_include_directories(rosidlcpp_generator_c PUBLIC include)
27 | target_link_libraries(
28 | rosidlcpp_generator_c
29 | PUBLIC
30 | fmt::fmt
31 | nlohmann_json::nlohmann_json
32 | rosidlcpp_parser::rosidlcpp_parser
33 | rosidlcpp_generator_core::rosidlcpp_generator_core
34 | )
35 |
36 | ament_export_dependencies(
37 | fmt
38 | nlohmann_json
39 | rosidlcpp_parser
40 | rosidlcpp_generator_core
41 | )
42 |
43 | ament_index_register_resource("rosidl_generator_packages")
44 |
45 | if(BUILD_SHARED_LIBS)
46 | set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED")
47 | else()
48 | set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC")
49 | endif()
50 |
51 | if(BUILD_TESTING)
52 | find_package(ament_lint_auto REQUIRED)
53 | ament_lint_auto_find_test_dependencies()
54 | endif()
55 |
56 | ament_package(
57 | CONFIG_EXTRAS "rosidlcpp_generator_c-extras.cmake.in"
58 | )
59 |
60 | install(
61 | TARGETS rosidlcpp_generator_c
62 | DESTINATION lib/rosidlcpp_generator_c
63 | )
64 |
65 | install(
66 | DIRECTORY cmake resource
67 | DESTINATION share/${PROJECT_NAME}
68 | )
69 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/resource/idl__type_support.cpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_introspection_cpp/resource/idl__type_support.cpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {########################################################################}
7 | {# Handle message #}
8 | {########################################################################}
9 | {% for msg_object in messages %}
10 | {% set message=msg_object.message %}
11 | {% include "msg__type_support.cpp.template" %}
12 |
13 | {% endfor %}
14 | {########################################################################}
15 | {# Handle service #}
16 | {########################################################################}
17 | {% for service in services %}
18 | {% set message=service.request_message %}
19 | {% include "srv__type_support.cpp.template" %}
20 |
21 | {% endfor %}
22 | {########################################################################}
23 | {# Handle action #}
24 | {########################################################################}
25 | {% for action in actions %}
26 | {% set message=action.goal %}
27 | {% include "msg__type_support.cpp.template" %}
28 |
29 | {% set message=action.result %}
30 | {% include "msg__type_support.cpp.template" %}
31 |
32 | {% set message=action.feedback %}
33 | {% include "msg__type_support.cpp.template" %}
34 |
35 | {% set service=action.send_goal_service %}
36 | {% include "srv__type_support.cpp.template" %}
37 |
38 | {% set service=action.get_result_service %}
39 | {% include "srv__type_support.cpp.template" %}
40 |
41 | {% set message=action.feedback_message %}
42 | {% include "msg__type_support.cpp.template" %}
43 |
44 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/resource/idl__type_support.cpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_c/resource/idl__type_support.cpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {########################################################################}
7 | {# Handle message #}
8 | {########################################################################}
9 | {% for msg_object in messages %}
10 | {% set message=msg_object.message %}
11 | {% include "msg__type_support.cpp.template" %}
12 |
13 | {% endfor %}
14 | {########################################################################}
15 | {# Handle service #}
16 | {########################################################################}
17 | {% for service in services %}
18 | {% set message=service.request_message %}
19 | {% include "srv__type_support.cpp.template" %}
20 |
21 | {% endfor %}
22 | {########################################################################}
23 | {# Handle action #}
24 | {########################################################################}
25 | {% for action in actions %}
26 | {% set message=action.goal %}
27 | {% include "msg__type_support.cpp.template" %}
28 |
29 | {% set message=action.result %}
30 | {% include "msg__type_support.cpp.template" %}
31 |
32 | {% set message=action.feedback %}
33 | {% include "msg__type_support.cpp.template" %}
34 |
35 | {% set service=action.send_goal_service %}
36 | {% include "srv__type_support.cpp.template" %}
37 |
38 | {% set service=action.get_result_service %}
39 | {% include "srv__type_support.cpp.template" %}
40 |
41 | {% set message=action.feedback_message %}
42 | {% include "msg__type_support.cpp.template" %}
43 |
44 | {% include "action__type_support.c.template" %}
45 |
46 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/resource/idl__type_support.cpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_cpp/resource/idl__type_support.cpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {########################################################################}
7 | {# Handle message #}
8 | {########################################################################}
9 | {% for msg_object in messages %}
10 | {% set message=msg_object.message %}
11 | {% include "msg__type_support.cpp.template" %}
12 |
13 | {% endfor %}
14 | {########################################################################}
15 | {# Handle service #}
16 | {########################################################################}
17 | {% for service in services %}
18 | {% set message=service.request_message %}
19 | {% include "srv__type_support.cpp.template" %}
20 |
21 | {% endfor %}
22 | {########################################################################}
23 | {# Handle action #}
24 | {########################################################################}
25 | {% for action in actions %}
26 | {% set message=action.goal %}
27 | {% include "msg__type_support.cpp.template" %}
28 |
29 | {% set message=action.result %}
30 | {% include "msg__type_support.cpp.template" %}
31 |
32 | {% set message=action.feedback %}
33 | {% include "msg__type_support.cpp.template" %}
34 |
35 | {% set service=action.send_goal_service %}
36 | {% include "srv__type_support.cpp.template" %}
37 |
38 | {% set service=action.get_result_service %}
39 | {% include "srv__type_support.cpp.template" %}
40 |
41 | {% set message=action.feedback_message %}
42 | {% include "msg__type_support.cpp.template" %}
43 |
44 | {% include "action__type_support.cpp.template" %}
45 |
46 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_c
5 | 0.4.0
6 | Generate the type support for C messages.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | ament_cmake_ros
13 | ament_cmake_ros_core
14 |
15 |
16 | ros_environment
17 |
18 | rcpputils
19 | rcutils
20 |
21 | nlohmann-json-dev
22 | fmt
23 | rosidlcpp_parser
24 | rosidlcpp_generator_core
25 |
26 | rosidl_runtime_c
27 |
28 |
29 | rosidl_typesupport_introspection_c
30 |
31 | ament_cmake_core
32 | rosidl_runtime_c
33 |
34 | ament_index_python
35 | rosidl_cli
36 | rosidl_generator_c
37 | rosidl_pycommon
38 | rosidl_typesupport_interface
39 |
40 | rosidl_typesupport_c_packages
41 |
42 | rosidl_generator_packages
43 |
44 |
45 | ament_cmake
46 |
47 |
48 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_fastrtps_c
5 | 0.4.0
6 | Generate the C interfaces for eProsima FastRTPS.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 |
13 | ament_cmake
14 | ament_cmake_python
15 |
16 |
17 | ament_cmake_ros
18 |
19 |
20 | rosidl_generator_c
21 |
22 |
23 | rosidl_runtime_cpp
24 | rosidl_typesupport_interface
25 |
26 |
27 | fastcdr
28 | rmw
29 | rosidl_runtime_c
30 | rosidl_typesupport_fastrtps_cpp
31 |
32 | nlohmann-json-dev
33 | fmt
34 | rosidlcpp_parser
35 | rosidlcpp_generator_core
36 |
37 | rosidl_generator_packages
38 |
39 |
40 | ament_cmake
41 |
42 |
43 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_fastrtps_cpp
5 | 0.4.0
6 | Generate the C++ interfaces for eProsima FastRTPS.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 |
13 | ament_cmake
14 | ament_cmake_python
15 |
16 |
17 | ament_cmake_ros
18 |
19 |
20 | rosidl_generator_c
21 | rosidl_generator_cpp
22 |
23 |
24 | rosidl_runtime_cpp
25 | rosidl_typesupport_interface
26 |
27 |
28 | fastcdr
29 | rmw
30 | rosidl_runtime_c
31 |
32 | nlohmann-json-dev
33 | fmt
34 | rosidlcpp_parser
35 | rosidlcpp_generator_core
36 |
37 | rosidl_generator_packages
38 |
39 |
40 | ament_cmake
41 |
42 |
43 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/srv__traits.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message = service.request_message %}
2 | {% set message_typename = service.request_message.type %}
3 | {% include "msg__traits.hpp.template" %}
4 | {% set message = service.response_message %}
5 | {% set message_typename = service.response_message.type %}
6 | {% include "msg__traits.hpp.template" %}
7 | {% set message = service.event_message %}
8 | {% set message_typename = service.event_message.type %}
9 | {% include "msg__traits.hpp.template" %}
10 |
11 | {% set service_typename = join(service.type.namespaces, "::") + "::" + service.type.name %}
12 | {% set service_fully_qualified_name = join(service.type.namespaces, "/") + "/" + service.type.name %}
13 | namespace rosidl_generator_traits
14 | {
15 |
16 | template<>
17 | inline const char * data_type<{{ service_typename }}>()
18 | {
19 | return "{{ service_typename }}";
20 | }
21 |
22 | template<>
23 | inline const char * name<{{ service_typename }}>()
24 | {
25 | return "{{ service_fully_qualified_name }}";
26 | }
27 |
28 | template<>
29 | struct has_fixed_size<{{ service_typename }}>
30 | : std::integral_constant<
31 | bool,
32 | has_fixed_size<{{ service_typename }}_Request>::value &&
33 | has_fixed_size<{{ service_typename }}_Response>::value
34 | >
35 | {
36 | };
37 |
38 | template<>
39 | struct has_bounded_size<{{ service_typename }}>
40 | : std::integral_constant<
41 | bool,
42 | has_bounded_size<{{ service_typename }}_Request>::value &&
43 | has_bounded_size<{{ service_typename }}_Response>::value
44 | >
45 | {
46 | };
47 |
48 | template<>
49 | struct is_service<{{ service_typename }}>
50 | : std::true_type
51 | {
52 | };
53 |
54 | template<>
55 | struct is_service_request<{{ service_typename }}_Request>
56 | : std::true_type
57 | {
58 | };
59 |
60 | template<>
61 | struct is_service_response<{{ service_typename }}_Response>
62 | : std::true_type
63 | {
64 | };
65 |
66 | } // namespace rosidl_generator_traits
67 |
--------------------------------------------------------------------------------
/.devcontainer/Dockerfile.rhel9:
--------------------------------------------------------------------------------
1 | # From https://github.com/ros-controls/ros2_control_ci/blob/master/ros2_rhel/Dockerfile.rhel9
2 | FROM almalinux:9
3 | ARG ROS_DISTRO=rolling
4 |
5 | # ROS prerequisites
6 | # see https://docs.ros.org/en/rolling/Installation/RHEL-Install-RPMs.html
7 | RUN dnf install -y langpacks-en glibc-langpack-en && \
8 | export LANG=en_US.UTF-8 && \
9 | dnf install -y 'dnf-command(config-manager)' epel-release && \
10 | dnf config-manager --set-enabled crb && \
11 | dnf clean all
12 |
13 | # Setup Sources
14 | RUN set -eux; \
15 | export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') && \
16 | if [ -z "$ROS_APT_SOURCE_VERSION" ]; then \
17 | echo "Failed to fetch ROS_APT_SOURCE_VERSION" >&2; \
18 | exit 1; \
19 | fi ; \
20 | ROS_RPM_URL="https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-release-${ROS_APT_SOURCE_VERSION}-1.noarch.rpm" ; \
21 | echo "Installing ROS RPM: $ROS_RPM_URL" ; \
22 | dnf install -y "$ROS_RPM_URL"
23 |
24 | # install ros
25 | RUN dnf makecache -y
26 | RUN dnf install -y \
27 | gcc-c++ \
28 | git \
29 | make \
30 | patch \
31 | python3-colcon-common-extensions \
32 | python3-mypy \
33 | python3-pip \
34 | python3-pydocstyle \
35 | python3-pytest \
36 | python3-pytest-repeat \
37 | python3-pytest-rerunfailures \
38 | python3-rosdep \
39 | python3-setuptools \
40 | python3-vcstool \
41 | wget \
42 | && dnf clean all
43 |
44 | # Create overlay workspace
45 | WORKDIR /root/ros_ws/src
46 | COPY packages.repos .
47 |
48 | RUN vcs import < packages.repos; \
49 | cd ..; \
50 | rosdep init; \
51 | rosdep update; \
52 | rosdep install --from-paths src --ignore-src -r -y;
53 |
54 | # Add sourcing ROS setup.bash to .bashrc
55 | RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
56 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/resource/rosidl_typesupport_fastrtps_c__visibility_control.h.in:
--------------------------------------------------------------------------------
1 | // generated from
2 | // rosidl_typesupport_fastrtps_c/resource/rosidl_typesupport_fastrtps_c__visibility_control.h.in
3 | // generated code does not contain a copyright notice
4 |
5 | #ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_C__VISIBILITY_CONTROL_H_
6 | #define @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_C__VISIBILITY_CONTROL_H_
7 |
8 | #if __cplusplus
9 | extern "C"
10 | {
11 | #endif
12 |
13 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
14 | // https://gcc.gnu.org/wiki/Visibility
15 |
16 | #if defined _WIN32 || defined __CYGWIN__
17 | #ifdef __GNUC__
18 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport))
19 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport))
20 | #else
21 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_EXPORT_@PROJECT_NAME@ __declspec(dllexport)
22 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_IMPORT_@PROJECT_NAME@ __declspec(dllimport)
23 | #endif
24 | #ifdef ROSIDL_TYPESUPPORT_FASTRTPS_C_BUILDING_DLL_@PROJECT_NAME@
25 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_FASTRTPS_C_EXPORT_@PROJECT_NAME@
26 | #else
27 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_FASTRTPS_C_IMPORT_@PROJECT_NAME@
28 | #endif
29 | #else
30 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default")))
31 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_IMPORT_@PROJECT_NAME@
32 | #if __GNUC__ >= 4
33 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default")))
34 | #else
35 | #define ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_@PROJECT_NAME@
36 | #endif
37 | #endif
38 |
39 | #if __cplusplus
40 | }
41 | #endif
42 |
43 | #endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_C__VISIBILITY_CONTROL_H_
44 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/include/rosidlcpp_generator_type_description/json_utils.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 | #include
19 |
20 | #include
21 |
22 | struct dump_parameters {
23 | const std::string object_start = "{";
24 | const std::string object_end = "}";
25 | const std::string object_key_sep = ": ";
26 | const std::string object_value_sep = ",";
27 | const std::string object_empty = "";
28 | const unsigned int object_newline_indent = 3;
29 |
30 | const std::string array_start = "[";
31 | const std::string array_end = "]";
32 | const std::string array_sep = ", ";
33 | const std::string array_empty = "";
34 | const unsigned int array_newline_indent = 3;
35 |
36 | unsigned int current_indent = 0;
37 | };
38 |
39 | const dump_parameters compact = {"{", "}", ":", ",", "", 0,
40 | "[", "]", ",", "", 0, 0};
41 | const dump_parameters pretty = {"{", "}", ": ", ",", "", 3,
42 | "[", "]", ", ", "", 3, 0};
43 | const dump_parameters array_oneliner = {"{", "}", ": ", ",", "", 3,
44 | "[", "]", ", ", "", 0, 0};
45 |
46 | void dump(const nlohmann::ordered_json &data, std::ostream &o, const dump_parameters ¶m);
47 |
48 | std::string dump(const nlohmann::ordered_json &data, const dump_parameters ¶m);
49 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl__type_support.h.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl__type_support.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 |
5 | // IWYU pragma: private, include "{{ package_name }}/{{ interface_path.filedir }}/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}.h"
6 |
7 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__TYPE_SUPPORT_H_" %}
8 | {% set include_directives = set_global_variable("include_directives", []) %}
9 |
10 | #ifndef {{ header_guard_variable }}
11 | #define {{ header_guard_variable }}
12 |
13 | #include "rosidl_typesupport_interface/macros.h"
14 |
15 | #include "{{ package_name }}/msg/rosidl_generator_c__visibility_control.h"
16 |
17 | #ifdef __cplusplus
18 | extern "C"
19 | {
20 | #endif
21 |
22 | {########################################################################}
23 | {# Handle message #}
24 | {########################################################################}
25 | {% for msg_object in messages %}
26 | {% set message=msg_object.message %}
27 | {% include "msg__type_support.h.template" %}
28 |
29 | {% endfor %}
30 | {########################################################################}
31 | {# Handle service #}
32 | {########################################################################}
33 | {% for service in services %}
34 | {% include "srv__type_support.h.template" %}
35 |
36 | {% endfor %}
37 | {########################################################################}
38 | {# Handle action #}
39 | {########################################################################}
40 | {% for action in actions %}
41 | {% include "action__type_support.h.template" %}
42 |
43 | {% endfor %}
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif // {{ header_guard_variable }}
49 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/resource/rosidl_typesupport_fastrtps_cpp__visibility_control.h.in:
--------------------------------------------------------------------------------
1 | // generated from
2 | // rosidl_typesupport_fastrtps_cpp/resource/rosidl_typesupport_fastrtps_cpp__visibility_control.h.in
3 | // generated code does not contain a copyright notice
4 |
5 | #ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_CPP__VISIBILITY_CONTROL_H_
6 | #define @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_CPP__VISIBILITY_CONTROL_H_
7 |
8 | #if __cplusplus
9 | extern "C"
10 | {
11 | #endif
12 |
13 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
14 | // https://gcc.gnu.org/wiki/Visibility
15 |
16 | #if defined _WIN32 || defined __CYGWIN__
17 | #ifdef __GNUC__
18 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport))
19 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport))
20 | #else
21 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_EXPORT_@PROJECT_NAME@ __declspec(dllexport)
22 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_IMPORT_@PROJECT_NAME@ __declspec(dllimport)
23 | #endif
24 | #ifdef ROSIDL_TYPESUPPORT_FASTRTPS_CPP_BUILDING_DLL_@PROJECT_NAME@
25 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_FASTRTPS_CPP_EXPORT_@PROJECT_NAME@
26 | #else
27 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_FASTRTPS_CPP_IMPORT_@PROJECT_NAME@
28 | #endif
29 | #else
30 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default")))
31 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_IMPORT_@PROJECT_NAME@
32 | #if __GNUC__ >= 4
33 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default")))
34 | #else
35 | #define ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_@PROJECT_NAME@
36 | #endif
37 | #endif
38 |
39 | #if __cplusplus
40 | }
41 | #endif
42 |
43 | #endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_FASTRTPS_CPP__VISIBILITY_CONTROL_H_
44 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/resource/rosidl_typesupport_introspection_c__visibility_control.h.in:
--------------------------------------------------------------------------------
1 | // generated from
2 | // rosidl_typesupport_introspection_c/resource/rosidl_typesupport_introspection_c__visibility_control.h.in
3 | // generated code does not contain a copyright notice
4 |
5 | #ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_INTROSPECTION_C__VISIBILITY_CONTROL_H_
6 | #define @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_INTROSPECTION_C__VISIBILITY_CONTROL_H_
7 |
8 | #ifdef __cplusplus
9 | extern "C"
10 | {
11 | #endif
12 |
13 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
14 | // https://gcc.gnu.org/wiki/Visibility
15 |
16 | #if defined _WIN32 || defined __CYGWIN__
17 | #ifdef __GNUC__
18 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport))
19 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport))
20 | #else
21 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_@PROJECT_NAME@ __declspec(dllexport)
22 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_IMPORT_@PROJECT_NAME@ __declspec(dllimport)
23 | #endif
24 | #ifdef ROSIDL_TYPESUPPORT_INTROSPECTION_C_BUILDING_DLL_@PROJECT_NAME@
25 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_@PROJECT_NAME@
26 | #else
27 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_INTROSPECTION_C_IMPORT_@PROJECT_NAME@
28 | #endif
29 | #else
30 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default")))
31 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_IMPORT_@PROJECT_NAME@
32 | #if __GNUC__ >= 4
33 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default")))
34 | #else
35 | #define ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_@PROJECT_NAME@
36 | #endif
37 | #endif
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_INTROSPECTION_C__VISIBILITY_CONTROL_H_
44 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/cmake/custom_command.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2016 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Unlike other generators, this custom command depends on the target
16 | # ${rosidl_generate_interfaces_TARGET} and not the IDL files.
17 | # The IDL files could be generated files,as they are for .action files.
18 | # CMake does not allow `add_custom_command()` to depend on files generated in
19 | # a different CMake subdirectory, and this command is invoked after an
20 | # add_subdirectory() call.
21 | add_custom_command(
22 | OUTPUT ${_generated_extension_files} ${_generated_py_files} ${_generated_c_files}
23 | # This assumes that python_cmake_module was found, which is always the case since this is only
24 | # called from rosidl_generator_py_generate_interfaces.cmake
25 | COMMAND ${rosidlcpp_generator_py_BIN}
26 | --generator-arguments-file "${generator_arguments_file}"
27 | --typesupport-impls "${_typesupport_impls}"
28 | DEPENDS ${target_dependencies} ${rosidl_generate_interfaces_TARGET}
29 | COMMENT "Generating Python code for ROS interfaces"
30 | VERBATIM
31 | DEPENDS_EXPLICIT_ONLY
32 | )
33 |
34 | if(TARGET ${rosidl_generate_interfaces_TARGET}${_target_suffix})
35 | message(WARNING "Custom target ${rosidl_generate_interfaces_TARGET}${_target_suffix} already exists")
36 | else()
37 | add_custom_target(
38 | ${rosidl_generate_interfaces_TARGET}${_target_suffix}
39 | DEPENDS
40 | ${_generated_extension_files}
41 | ${_generated_py_files}
42 | ${_generated_c_files}
43 | )
44 | endif()
45 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/srv__type_support.h.template:
--------------------------------------------------------------------------------
1 | {% set message = service.request_message %}
2 | {% include "msg__type_support.h.template" %}
3 |
4 | {% set message = service.response_message %}
5 | {% include "msg__type_support.h.template" %}
6 |
7 | {% set message = service.event_message %}
8 | {% include "msg__type_support.h.template" %}
9 |
10 | {% set header_file = "rosidl_runtime_c/service_type_support_struct.h" %}
11 | {% set include_directives = get_global_variable("include_directives") %}
12 | {% if header_file in include_directives %}
13 | // already included above
14 | // {{ "" -}}
15 | {% else %}
16 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
17 | {% endif %}
18 | #include "{{ header_file }}"
19 |
20 | // Forward declare the get type support functions for this type.
21 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
22 | const rosidl_service_type_support_t *
23 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(
24 | rosidl_typesupport_c,
25 | {% for ns in service.type.namespaces %}
26 | {{ ns }},
27 | {% endfor %}
28 | {{ service.type.name }}
29 | )(void);
30 |
31 | // Forward declare the function to create a service event message for this type.
32 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
33 | void *
34 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_CREATE_EVENT_MESSAGE_SYMBOL_NAME(
35 | rosidl_typesupport_c,
36 | {% for ns in service.type.namespaces %}
37 | {{ ns }},
38 | {% endfor %}
39 | {{ service.type.name }}
40 | )(
41 | const rosidl_service_introspection_info_t * info,
42 | rcutils_allocator_t * allocator,
43 | const void * request_message,
44 | const void * response_message);
45 |
46 | // Forward declare the function to destroy a service event message for this type.
47 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
48 | bool
49 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_DESTROY_EVENT_MESSAGE_SYMBOL_NAME(
50 | rosidl_typesupport_c,
51 | {% for ns in service.type.namespaces %}
52 | {{ ns }},
53 | {% endfor %}
54 | {{ service.type.name }}
55 | )(
56 | void * event_msg,
57 | rcutils_allocator_t * allocator);
58 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_srv_pkg_typesupport_entry_point.c.template:
--------------------------------------------------------------------------------
1 | {# Included from rosidl_generator_py/resource/_idl_pkg_typesupport_entry_point.c.em #}
2 | {% set message = service.request_message %}
3 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
4 |
5 | {% set message = service.response_message %}
6 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
7 |
8 | {% set message = service.event_message %}
9 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
10 | {% set type_name = convert_camel_case_to_lower_case_underscore(service.type.name) %}
11 | {% set function_name = "type_support" %}
12 |
13 | ROSIDL_GENERATOR_C_IMPORT
14 | const rosidl_service_type_support_t *
15 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, {{ join(service.type.namespaces, ", ") + ", " + service.type.name }})();
16 |
17 | {% set register_function = "_register_srv_type__" + join(span(service.type.namespaces, 1, length(service.type.namespaces)), "__") + "__" + type_name %}
18 | {% set register_functions = set_global_variable("register_functions", push_back(get_global_variable("register_functions"), register_function)) %}
19 | int8_t
20 | {{ register_function }}(PyObject * pymodule)
21 | {
22 | int8_t err;
23 | PyObject * pyobject_{{ function_name }} = NULL;
24 | pyobject_{{ function_name }} = PyCapsule_New(
25 | (void *)ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, {{ join(service.type.namespaces, ", ") + ", " + service.type.name }})(),
26 | NULL, NULL);
27 | if (!pyobject_{{ function_name }}) {
28 | // previously added objects will be removed when the module is destroyed
29 | return -1;
30 | }
31 | err = PyModule_AddObject(
32 | pymodule,
33 | "{{ function_name }}_srv__{{ join(span(service.type.namespaces, 1, length(service.type.namespaces)), "__") + "__" + type_name }}",
34 | pyobject_{{ function_name }});
35 | if (err) {
36 | // the created capsule needs to be decremented
37 | Py_XDECREF(pyobject_{{ function_name }});
38 | // previously added objects will be removed when the module is destroyed
39 | return err;
40 | }
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_cpp
5 | 0.4.0
6 | Generate the type support for C++ messages.
7 |
8 | Anthony Welte
9 |
10 | Apache License 2.0
11 |
12 | ament_cmake_ros
13 | ament_cmake_ros_core
14 |
15 |
16 | ros_environment
17 |
18 | rcutils
19 | rcpputils
20 | rosidl_runtime_c
21 | rosidl_typesupport_c
22 |
23 | nlohmann-json-dev
24 | fmt
25 | rosidlcpp_parser
26 | rosidlcpp_generator_core
27 |
28 |
29 | rosidl_typesupport_introspection_cpp
30 |
31 | ament_cmake_core
32 | rosidl_typesupport_c
33 | rosidl_runtime_c
34 | rosidl_runtime_cpp
35 |
36 | ament_index_python
37 | rosidl_cli
38 | rosidl_generator_c
39 | rosidl_generator_type_description
40 | rosidl_pycommon
41 | rosidl_typesupport_interface
42 |
43 | rosidl_typesupport_cpp_packages
44 |
45 | rosidl_generator_packages
46 |
47 |
48 | ament_cmake
49 |
50 |
51 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl__description.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl__description.c.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {% set type_description_msg = type_description_info.type_description_msg %}
5 | {% set hash_lookup = get_hash_lookup(type_description_info.type_hashes) %}
6 | {##}
7 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
8 | {% set implicit_type_descriptions = get_implicit_type_descriptions(services, actions, type_description_info) %}
9 | {% set toplevel_type_description = get_toplevel_type_description(messages, services, actions, type_description_info) %}
10 |
11 | #include "{{ include_base }}__functions.h"
12 |
13 | {########################################################################}
14 | {# Define get_type_hash functions #}
15 | {########################################################################}
16 | {% set full_type_descriptions = insert(implicit_type_descriptions, 0, toplevel_type_description) %}
17 | {% for type_description in full_type_descriptions %}
18 | {% set typename = type_description.msg.type_description.type_name %}
19 | {% set c_typename = replace(typename, "/", "__") %}
20 | ROSIDL_GENERATOR_C_PUBLIC_{{ package_name }}
21 | const rosidl_type_hash_t *
22 | {{ c_typename }}__{{ GET_HASH_FUNC }}(
23 | const rosidl_{{ type_description.type }}_type_support_t * type_support)
24 | {
25 | (void)type_support;
26 | static rosidl_type_hash_t hash = {{ type_hash_to_c_definition(at(hash_lookup, typename), 4) }};
27 | return &hash;
28 | }
29 |
30 | {% endfor %}
31 | {#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#}
32 | {##}
33 | {#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#}
34 | {# Descriptions and sources functions (optionally disabled) #}
35 | {% if disable_description_codegen %}
36 | {% include "empty__description.c.template" %}
37 | {% else %}
38 | {% include "full__description.c.template" %}
39 | {% endif %}
40 | {#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#}
41 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/resource/idl__type_support_c.cpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_fastrtps_c/resource/idl__type_support_c.cpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
6 | #include "{{ include_base }}__rosidl_typesupport_fastrtps_c.h"
7 |
8 |
9 | {% set include_directives = set_global_variable("include_directives", []) %}
10 | {% set forward_declared_types = set_global_variable("forward_declared_types", []) %}
11 | {########################################################################}
12 | {# Handle message #}
13 | {########################################################################}
14 | {% for msg_object in messages %}
15 | {% set message=msg_object.message %}
16 | {% include "msg__type_support_c.cpp.template" %}
17 |
18 | {% endfor %}
19 | {########################################################################}
20 | {# Handle service #}
21 | {########################################################################}
22 | {% for service in services %}
23 | {% set message=service.request_message %}
24 | {% include "srv__type_support_c.cpp.template" %}
25 |
26 | {% endfor %}
27 | {########################################################################}
28 | {# Handle action #}
29 | {########################################################################}
30 | {% for action in actions %}
31 | {% set message=action.goal %}
32 | {% include "msg__type_support_c.cpp.template" %}
33 |
34 |
35 | {% set message=action.result %}
36 | {% include "msg__type_support_c.cpp.template" %}
37 |
38 |
39 | {% set message=action.feedback %}
40 | {% include "msg__type_support_c.cpp.template" %}
41 |
42 |
43 | {% set service=action.send_goal_service %}
44 | {% include "srv__type_support_c.cpp.template" %}
45 |
46 |
47 | {% set service=action.get_result_service %}
48 | {% include "srv__type_support_c.cpp.template" %}
49 |
50 |
51 | {% set message=action.feedback_message %}
52 | {% include "msg__type_support_c.cpp.template" %}
53 |
54 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rosidlcpp_typesupport_introspection_cpp
5 | 0.4.0
6 |
7 | Generate the message type support for dynamic message construction in C++.
8 |
9 |
10 | Anthony Welte
11 |
12 | Apache License 2.0
13 |
14 | ament_cmake_ros
15 | ament_cmake_ros_core
16 |
17 |
18 | ros_environment
19 |
20 | nlohmann-json-dev
21 | fmt
22 | rosidlcpp_parser
23 | rosidlcpp_generator_core
24 |
25 | ament_cmake
26 | rosidl_generator_c
27 | rosidl_generator_cpp
28 | rosidl_pycommon
29 |
30 | rosidl_cmake
31 | rosidl_runtime_c
32 | rosidl_runtime_cpp
33 |
34 | rosidl_runtime_cpp
35 | rosidl_typesupport_introspection_c
36 |
37 | ament_index_python
38 | rosidl_cli
39 | rosidl_generator_c
40 | rosidl_generator_cpp
41 | rosidl_parser
42 | rosidl_pycommon
43 | rosidl_typesupport_interface
44 | rosidl_typesupport_introspection_c
45 |
46 | rosidl_generator_packages
47 |
48 |
49 | ament_cmake
50 |
51 |
52 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/resource/idl__type_support.cpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_fastrtps_cpp/resource/idl__type_support.cpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
6 | #include "{{ include_base }}__rosidl_typesupport_fastrtps_cpp.hpp"
7 | #include "{{ include_base }}__functions.h"
8 | #include "{{ include_base }}__struct.hpp"
9 |
10 | {# #}
11 | {% set include_directives = set_global_variable("include_directives", []) %}
12 | {% set forward_declared_types = set_global_variable("forward_declared_types", []) %}
13 | {########################################################################}
14 | {# Handle message #}
15 | {########################################################################}
16 | {% for msg_object in messages %}
17 | {% set message=msg_object.message %}
18 | {% include "msg__type_support.cpp.template" %}
19 |
20 | {% endfor %}
21 | {########################################################################}
22 | {# Handle service #}
23 | {########################################################################}
24 | {% for service in services %}
25 | {% set message=service.request_message %}
26 | {% include "srv__type_support.cpp.template" %}
27 |
28 | {% endfor %}
29 | {########################################################################}
30 | {# Handle action #}
31 | {########################################################################}
32 | {% for action in actions %}
33 | {% set message=action.goal %}
34 | {% include "msg__type_support.cpp.template" %}
35 |
36 | {% set message=action.result %}
37 | {% include "msg__type_support.cpp.template" %}
38 |
39 | {% set message=action.feedback %}
40 | {% include "msg__type_support.cpp.template" %}
41 |
42 | {% set service=action.send_goal_service %}
43 | {% include "srv__type_support.cpp.template" %}
44 |
45 | {% set service=action.get_result_service %}
46 | {% include "srv__type_support.cpp.template" %}
47 |
48 | {% set message=action.feedback_message %}
49 | {% include "msg__type_support.cpp.template" %}
50 |
51 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_c)
4 |
5 | # Default to C++23
6 | if(NOT CMAKE_CXX_STANDARD)
7 | set(CMAKE_CXX_STANDARD 23)
8 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
9 | endif()
10 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
11 | add_compile_options(-Wall -Wextra -Wpedantic)
12 | endif()
13 |
14 | if($ENV{ROS_DISTRO} STREQUAL "jazzy")
15 | find_package(ament_cmake_ros REQUIRED)
16 | else()
17 | find_package(ament_cmake_ros_core REQUIRED)
18 | endif()
19 | find_package(rcpputils REQUIRED)
20 | find_package(rcutils REQUIRED)
21 | find_package(rosidl_runtime_c REQUIRED)
22 |
23 | ament_export_dependencies(rcutils)
24 | ament_export_dependencies(rcpputils)
25 | ament_export_dependencies(rosidl_runtime_c)
26 | ament_export_dependencies(rosidl_typesupport_interface)
27 |
28 | find_package(fmt REQUIRED)
29 | find_package(nlohmann_json REQUIRED)
30 |
31 | find_package(rosidlcpp_parser REQUIRED)
32 | find_package(rosidlcpp_generator_core REQUIRED)
33 |
34 | add_executable(rosidlcpp_typesupport_c src/rosidlcpp_typesupport_c/rosidlcpp_typesupport_c.cpp)
35 |
36 | target_include_directories(rosidlcpp_typesupport_c PUBLIC include)
37 | target_link_libraries(
38 | rosidlcpp_typesupport_c
39 | PUBLIC
40 | fmt::fmt
41 | nlohmann_json::nlohmann_json
42 | rosidlcpp_parser::rosidlcpp_parser
43 | rosidlcpp_generator_core::rosidlcpp_generator_core
44 | )
45 |
46 | ament_index_register_resource("rosidl_generator_packages")
47 |
48 | if(BUILD_TESTING)
49 | # TODO
50 | endif()
51 |
52 | if(BUILD_SHARED_LIBS)
53 | set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED")
54 | else()
55 | set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC")
56 | endif()
57 |
58 | ament_package(
59 | CONFIG_EXTRAS "rosidlcpp_typesupport_c-extras.cmake.in"
60 | )
61 |
62 | install(
63 | TARGETS rosidlcpp_typesupport_c
64 | DESTINATION lib/${PROJECT_NAME}
65 | )
66 |
67 | install(
68 | DIRECTORY cmake resource
69 | DESTINATION share/${PROJECT_NAME}
70 | )
71 | install(
72 | DIRECTORY include/
73 | DESTINATION include/${PROJECT_NAME}
74 | )
75 | install(
76 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
77 | ARCHIVE DESTINATION lib
78 | LIBRARY DESTINATION lib
79 | RUNTIME DESTINATION bin
80 | )
81 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_introspection_c)
4 |
5 | # TODO: Specify C vs C++ for library and executable
6 | # Default to C++23
7 | if(NOT CMAKE_CXX_STANDARD)
8 | set(CMAKE_CXX_STANDARD 23)
9 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
10 | endif()
11 | if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
12 | add_compile_options(-Wall -Wextra -Wpedantic)
13 | endif()
14 |
15 | find_package(ament_cmake REQUIRED)
16 | if($ENV{ROS_DISTRO} STREQUAL "jazzy")
17 | find_package(ament_cmake_ros REQUIRED)
18 | else()
19 | find_package(ament_cmake_ros_core REQUIRED)
20 | endif()
21 |
22 | ament_export_dependencies(rosidl_runtime_c)
23 | ament_export_dependencies(rosidl_typesupport_interface)
24 |
25 | find_package(fmt REQUIRED)
26 | find_package(nlohmann_json REQUIRED)
27 |
28 | find_package(rosidlcpp_parser REQUIRED)
29 | find_package(rosidlcpp_generator_core REQUIRED)
30 |
31 | add_executable(rosidlcpp_typesupport_introspection_c src/rosidlcpp_typesupport_introspection_c/rosidlcpp_typesupport_introspection_c.cpp)
32 |
33 | target_include_directories(rosidlcpp_typesupport_introspection_c PUBLIC include)
34 | target_link_libraries(
35 | rosidlcpp_typesupport_introspection_c
36 | PUBLIC
37 | fmt::fmt
38 | nlohmann_json::nlohmann_json
39 | rosidlcpp_parser::rosidlcpp_parser
40 | rosidlcpp_generator_core::rosidlcpp_generator_core
41 | )
42 |
43 | ament_index_register_resource("rosidl_generator_packages")
44 |
45 | if(BUILD_TESTING)
46 | # TODO
47 | endif()
48 |
49 | if(BUILD_SHARED_LIBS)
50 | set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED")
51 | else()
52 | set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC")
53 | endif()
54 |
55 | ament_package(
56 | CONFIG_EXTRAS "rosidlcpp_typesupport_introspection_c-extras.cmake.in"
57 | )
58 |
59 | install(
60 | TARGETS rosidlcpp_typesupport_introspection_c
61 | DESTINATION lib/${PROJECT_NAME}
62 | )
63 | install(
64 | DIRECTORY cmake resource
65 | DESTINATION share/${PROJECT_NAME}
66 | )
67 | install(
68 | DIRECTORY include/
69 | DESTINATION include/${PROJECT_NAME}
70 | )
71 | install(
72 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
73 | ARCHIVE DESTINATION lib
74 | LIBRARY DESTINATION lib
75 | RUNTIME DESTINATION bin
76 | )
77 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/msg__builder.hpp.template:
--------------------------------------------------------------------------------
1 | {% set message_typename = join(message.type.namespaces, "::") + "::" + message.type.name %}
2 | {% for ns in message.type.namespaces %}
3 | namespace {{ ns }}
4 | {
5 |
6 | {% endfor %}
7 | {% if length(message.members) != 1 or at(message.members, 0).name != "structure_needs_at_least_one_member" %}
8 | namespace builder
9 | {
10 | {% for index in custom_range(length(message.members) - 1, -1 , -1) %}
11 |
12 | {% set member = at(message.members, index) %}
13 | class Init_{{ message.type.name }}_{{ member.name }}
14 | {
15 | public:
16 | {% if index != 0 %}
17 | explicit {% else %}
18 | {{ "" }}{% endif -%} Init_{{ message.type.name }}_{{ member.name }}{% if index == 0 %}
19 | ()
20 | : msg_(::rosidl_runtime_cpp::MessageInitialization::SKIP)
21 | {% else %}
22 | (::{{ message_typename }} & msg)
23 | : msg_(msg)
24 | {% endif %}
25 | {}
26 | {% if index == length(message.members) - 1 %}
27 | ::{{ message_typename }}{{ " " -}}
28 | {% else %}
29 | Init_{{ message.type.name }}_{{ at(message.members, index+1).name }}{{ " " -}}
30 | {% endif %}
31 | {{- member.name }}(::{{ message_typename }}::_{{ member.name }}_type arg)
32 | {
33 | msg_.{{ member.name }} = std::move(arg);
34 | {% if index == length(message.members) - 1 %}
35 | return std::move(msg_);
36 | {% else %}
37 | return Init_{{ message.type.name }}_{{ at(message.members, index + 1).name }}(msg_);
38 | {% endif %}
39 | }
40 |
41 | private:
42 | ::{{ message_typename }} msg_;
43 | };
44 | {% endfor %}
45 |
46 | } // namespace builder
47 | {% endif %}
48 | {% for i in range(length(message.type.namespaces)) %}
49 |
50 | {% if i == length(message.type.namespaces) - 1 %}
51 | template
52 | auto build();
53 |
54 | template<>
55 | inline
56 | auto build<::{{ message_typename }}>()
57 | {
58 | {% if length(message.members) == 1 and at(message.members, 0).name == "structure_needs_at_least_one_member" %}
59 | return ::{{ message_typename }}(rosidl_runtime_cpp::MessageInitialization::ZERO);
60 | {% else %}
61 | return {{ join(message.type.namespaces, "::") }}::builder::Init_{{ message.type.name }}_{{ at(message.members, 0).name }}();
62 | {% endif %}
63 | }
64 |
65 | {% endif %}
66 | } // namespace {{ at(message.type.namespaces, length(message.type.namespaces) - 1 - i) }}
67 | {% endfor %}
68 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_cpp)
4 |
5 | # Default to C++23
6 | if(NOT CMAKE_CXX_STANDARD)
7 | set(CMAKE_CXX_STANDARD 23)
8 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
9 | endif()
10 |
11 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
12 | add_compile_options(-Wall -Wextra -Wpedantic)
13 | endif()
14 |
15 | if($ENV{ROS_DISTRO} STREQUAL "jazzy")
16 | find_package(ament_cmake_ros REQUIRED)
17 | else()
18 | find_package(ament_cmake_ros_core REQUIRED)
19 | endif()
20 |
21 | find_package(rcutils REQUIRED)
22 | find_package(rcpputils REQUIRED)
23 | find_package(rosidl_runtime_c REQUIRED)
24 | find_package(rosidl_typesupport_c REQUIRED)
25 |
26 | ament_export_dependencies(rcutils)
27 | ament_export_dependencies(rcpputils)
28 | ament_export_dependencies(rosidl_runtime_c)
29 | ament_export_dependencies(rosidl_typesupport_c)
30 |
31 | find_package(fmt REQUIRED)
32 | find_package(nlohmann_json REQUIRED)
33 |
34 | find_package(rosidlcpp_parser REQUIRED)
35 | find_package(rosidlcpp_generator_core REQUIRED)
36 |
37 | add_executable(rosidlcpp_typesupport_cpp src/rosidlcpp_typesupport_cpp/rosidlcpp_typesupport_cpp.cpp)
38 |
39 | target_include_directories(rosidlcpp_typesupport_cpp PUBLIC include)
40 | target_link_libraries(
41 | rosidlcpp_typesupport_cpp
42 | PUBLIC
43 | fmt::fmt
44 | nlohmann_json::nlohmann_json
45 | rosidlcpp_parser::rosidlcpp_parser
46 | rosidlcpp_generator_core::rosidlcpp_generator_core
47 | )
48 |
49 | ament_index_register_resource("rosidl_runtime_packages")
50 |
51 | if(BUILD_TESTING)
52 | # TODO
53 | endif()
54 |
55 | if(BUILD_SHARED_LIBS)
56 | set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED")
57 | else()
58 | set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC")
59 | endif()
60 |
61 | ament_package(
62 | CONFIG_EXTRAS "rosidlcpp_typesupport_cpp-extras.cmake.in"
63 | )
64 |
65 | install(
66 | TARGETS rosidlcpp_typesupport_cpp
67 | DESTINATION lib/${PROJECT_NAME}
68 | )
69 |
70 | install(
71 | DIRECTORY cmake resource
72 | DESTINATION share/${PROJECT_NAME}
73 | )
74 | install(
75 | DIRECTORY include/
76 | DESTINATION include/${PROJECT_NAME}
77 | )
78 | install(
79 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
80 | ARCHIVE DESTINATION lib
81 | LIBRARY DESTINATION lib
82 | RUNTIME DESTINATION bin
83 | )
84 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_action_pkg_typesupport_entry_point.c.template:
--------------------------------------------------------------------------------
1 | {% set action_name = "_" + convert_camel_case_to_lower_case_underscore(action.type.name) %}
2 | {% set module_name = "_" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
3 | {% set message = action.goal %}
4 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
5 |
6 | {% set message = action.result %}
7 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
8 |
9 | {% set message = action.feedback %}
10 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
11 |
12 | {% set service = action.send_goal_service %}
13 | {% include "_srv_pkg_typesupport_entry_point.c.template" %}
14 |
15 | {% set service = action.get_result_service %}
16 | {% include "_srv_pkg_typesupport_entry_point.c.template" %}
17 |
18 | {% set message = action.feedback_message %}
19 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
20 |
21 | {% set type_name = convert_camel_case_to_lower_case_underscore(action.type.name) %}
22 | {% set function_name = "type_support" %}
23 | {% set register_function = "_register_action_type__" + join(span(action.type.namespaces, 1, length(action.type.namespaces)), "__") + "__" + type_name %}
24 | {% set register_functions = set_global_variable("register_functions", push_back(get_global_variable("register_functions"), register_function)) %}
25 |
26 | int8_t
27 | {{ register_function }}(PyObject * pymodule)
28 | {
29 | int8_t err;
30 | PyObject * pyobject_{{ function_name }} = NULL;
31 | pyobject_{{ function_name }} = PyCapsule_New(
32 | (void *)ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME(rosidl_typesupport_c, {{ join(action.type.namespaces, ", ") + ", " + action.type.name }})(),
33 | NULL, NULL);
34 | if (!pyobject_{{ function_name }}) {
35 | // previously added objects will be removed when the module is destroyed
36 | return -1;
37 | }
38 | err = PyModule_AddObject(
39 | pymodule,
40 | "{{ function_name }}_action__{{ join(span(action.type.namespaces, 1, length(action.type.namespaces)), "__") + "__" + type_name }}",
41 | pyobject_{{ function_name }});
42 | if (err) {
43 | // the created capsule needs to be decremented
44 | Py_XDECREF(pyobject_{{ function_name }});
45 | // previously added objects will be removed when the module is destroyed
46 | return err;
47 | }
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_introspection_cpp)
4 |
5 | # Default to C++23
6 | if(NOT CMAKE_CXX_STANDARD)
7 | set(CMAKE_CXX_STANDARD 23)
8 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
9 | endif()
10 |
11 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
12 | add_compile_options(-Wall -Wextra -Wpedantic)
13 | endif()
14 |
15 | if($ENV{ROS_DISTRO} STREQUAL "jazzy")
16 | find_package(ament_cmake_ros REQUIRED)
17 | else()
18 | find_package(ament_cmake_ros_core REQUIRED)
19 | endif()
20 | find_package(rosidl_runtime_cpp REQUIRED)
21 | find_package(rosidl_typesupport_introspection_c REQUIRED)
22 |
23 | ament_export_dependencies(rosidl_runtime_cpp rosidl_typesupport_introspection_c)
24 |
25 | find_package(fmt REQUIRED)
26 | find_package(nlohmann_json REQUIRED)
27 |
28 | find_package(rosidlcpp_parser REQUIRED)
29 | find_package(rosidlcpp_generator_core REQUIRED)
30 |
31 | add_executable(rosidlcpp_typesupport_introspection_cpp src/rosidlcpp_typesupport_introspection_cpp/rosidlcpp_typesupport_introspection_cpp.cpp)
32 |
33 | target_include_directories(rosidlcpp_typesupport_introspection_cpp PUBLIC include)
34 | target_link_libraries(
35 | rosidlcpp_typesupport_introspection_cpp
36 | PUBLIC
37 | fmt::fmt
38 | nlohmann_json::nlohmann_json
39 | rosidlcpp_parser::rosidlcpp_parser
40 | rosidlcpp_generator_core::rosidlcpp_generator_core
41 | )
42 |
43 | ament_index_register_resource("rosidl_generator_packages")
44 |
45 | if(BUILD_TESTING)
46 | find_package(ament_lint_auto REQUIRED)
47 | ament_lint_auto_find_test_dependencies()
48 | endif()
49 |
50 | if(BUILD_SHARED_LIBS)
51 | set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED")
52 | else()
53 | set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC")
54 | endif()
55 |
56 | ament_package(
57 | CONFIG_EXTRAS "rosidlcpp_typesupport_introspection_cpp-extras.cmake.in"
58 | )
59 |
60 | install(
61 | TARGETS rosidlcpp_typesupport_introspection_cpp
62 | DESTINATION lib/${PROJECT_NAME}
63 | )
64 | install(
65 | DIRECTORY cmake resource
66 | DESTINATION share/${PROJECT_NAME}
67 | )
68 | install(
69 | DIRECTORY include/
70 | DESTINATION include/${PROJECT_NAME}
71 | )
72 | install(
73 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
74 | ARCHIVE DESTINATION lib
75 | LIBRARY DESTINATION lib
76 | RUNTIME DESTINATION bin
77 | )
78 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/resource/idl__rosidl_typesupport_fastrtps_c.h.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_fastrtps_c/resource/idl__rosidl_typesupport_fastrtps_c.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__ROSIDL_TYPESUPPORT_FASTRTPS_C_H_" %}
7 | {# #}
8 | #ifndef {{ header_guard_variable }}
9 | #define {{ header_guard_variable }}
10 |
11 | {########################################################################}
12 | {# Handle message #}
13 | {########################################################################}
14 | {% for msg_object in messages %}
15 | {% set message=msg_object.message %}
16 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
17 |
18 | {% endfor %}
19 | {########################################################################}
20 | {# Handle service #}
21 | {########################################################################}
22 | {% for service in services %}
23 | {% set message=service.request_message %}
24 | {% include "srv__rosidl_typesupport_fastrtps_c.h.template" %}
25 |
26 | {% endfor %}
27 | {########################################################################}
28 | {# Handle action #}
29 | {########################################################################}
30 | {% for action in actions %}
31 | {% set message=action.goal %}
32 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
33 |
34 | {% set message=action.result %}
35 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
36 |
37 | {% set message=action.feedback %}
38 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
39 |
40 | {% set service=action.send_goal_service %}
41 | {% include "srv__rosidl_typesupport_fastrtps_c.h.template" %}
42 |
43 | {% set service=action.get_result_service %}
44 | {% include "srv__rosidl_typesupport_fastrtps_c.h.template" %}
45 |
46 | {% set message=action.feedback_message %}
47 | {% include "msg__rosidl_typesupport_fastrtps_c.h.template" %}
48 |
49 | {% endfor %}
50 |
51 | #endif // {{ header_guard_variable }}
52 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_fastrtps_cpp)
4 |
5 | if(DEFINED ENV{FASTRTPS_STATIC_DISABLE})
6 | set(FASTRTPS_STATIC_DISABLE $ENV{FASTRTPS_STATIC_DISABLE}
7 | CACHE BOOL "If Connext Static should be disabled.")
8 | else()
9 | set(FASTRTPS_STATIC_DISABLE FALSE
10 | CACHE BOOL "If Connext Static should be disabled.")
11 | endif()
12 |
13 | # Default to C++23
14 | if(NOT CMAKE_CXX_STANDARD)
15 | set(CMAKE_CXX_STANDARD 23)
16 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
17 | endif()
18 |
19 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
20 | add_compile_options(-Wall -Wextra -Wpedantic)
21 | endif()
22 |
23 | find_package(ament_cmake REQUIRED)
24 |
25 | find_package(fastcdr 2 REQUIRED CONFIG)
26 |
27 | find_package(ament_cmake_python REQUIRED)
28 |
29 | find_package(rmw REQUIRED)
30 | find_package(rosidl_runtime_c REQUIRED)
31 |
32 | ament_export_dependencies(rmw)
33 | ament_export_dependencies(rosidl_runtime_c)
34 | ament_export_dependencies(fastcdr)
35 |
36 | find_package(fmt REQUIRED)
37 | find_package(nlohmann_json REQUIRED)
38 |
39 | find_package(rosidlcpp_parser REQUIRED)
40 | find_package(rosidlcpp_generator_core REQUIRED)
41 |
42 | add_executable(rosidlcpp_typesupport_fastrtps_cpp src/rosidlcpp_typesupport_fastrtps_cpp/rosidlcpp_typesupport_fastrtps_cpp.cpp)
43 |
44 | target_include_directories(rosidlcpp_typesupport_fastrtps_cpp PUBLIC include)
45 | target_link_libraries(
46 | rosidlcpp_typesupport_fastrtps_cpp
47 | PUBLIC
48 | fmt::fmt
49 | nlohmann_json::nlohmann_json
50 | rosidlcpp_parser::rosidlcpp_parser
51 | rosidlcpp_generator_core::rosidlcpp_generator_core
52 | )
53 |
54 | ament_index_register_resource("rosidl_generator_packages")
55 |
56 | if(BUILD_TESTING)
57 | # TODO
58 | endif()
59 |
60 | ament_package(
61 | CONFIG_EXTRAS "rosidlcpp_typesupport_fastrtps_cpp-extras.cmake.in"
62 | )
63 |
64 | install(
65 | TARGETS rosidlcpp_typesupport_fastrtps_cpp
66 | DESTINATION lib/${PROJECT_NAME}
67 | )
68 |
69 | install(
70 | DIRECTORY cmake resource
71 | DESTINATION share/${PROJECT_NAME}
72 | )
73 | install(
74 | DIRECTORY include/
75 | DESTINATION include/${PROJECT_NAME}
76 | )
77 | install(
78 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
79 | ARCHIVE DESTINATION lib
80 | LIBRARY DESTINATION lib
81 | RUNTIME DESTINATION bin
82 | )
83 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_cpp/resource/idl__rosidl_typesupport_fastrtps_cpp.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_fastrtps_cpp/resource/idl__rosidl_typesupport_fastrtps_cpp.hpp.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__ROSIDL_TYPESUPPORT_FASTRTPS_CPP_HPP_" %}
7 |
8 | #ifndef {{ header_guard_variable }}
9 | #define {{ header_guard_variable }}
10 |
11 | {########################################################################}
12 | {# Handle message #}
13 | {########################################################################}
14 | {% for msg_object in messages %}
15 | {% set message=msg_object.message %}
16 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
17 |
18 | {% endfor %}
19 | {########################################################################}
20 | {# Handle service #}
21 | {########################################################################}
22 | {% for service in services %}
23 | {% set message=service.request_message %}
24 | {% include "srv__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
25 |
26 | {% endfor %}
27 | {########################################################################}
28 | {# Handle action #}
29 | {########################################################################}
30 | {% for action in actions %}
31 | {% set message=action.goal %}
32 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
33 | {% set message=action.result %}
34 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
35 | {% set message=action.feedback %}
36 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
37 | {% set service=action.send_goal_service %}
38 | {% include "srv__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
39 | {% set service=action.get_result_service %}
40 | {% include "srv__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
41 | {% set message=action.feedback_message %}
42 | {% include "msg__rosidl_typesupport_fastrtps_cpp.hpp.template" %}
43 |
44 | {% endfor %}
45 | #endif // {{ header_guard_variable }}
46 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "osrf/ros:rolling-desktop-full",
3 | "build": {
4 | "dockerfile": "Dockerfile",
5 | "args": {
6 | "ROS_DISTRO": "rolling"
7 | }
8 | },
9 | "runArgs": [
10 | "--cap-add=SYS_PTRACE", // Allows the container to trace processes using ptrace system call
11 | "--security-opt=seccomp=unconfined", // Disables seccomp security profiles for the container
12 | // "--ipc=host", // Shares the host's IPC namespace with the container
13 | // "--network=host", // Shares the host's network namespace with the container
14 | // "--pid=host", // Shares the host's PID namespace with the container
15 | // "--privileged", // Gives the container full access to the host's devices and allows it to run with root privileges
16 | ],
17 | "workspaceMount": "source=${localWorkspaceFolder},target=/root/ros_ws/src/${localWorkspaceFolderBasename},type=bind",
18 | "workspaceFolder": "/root/ros_ws/src",
19 | "containerEnv": {
20 | /* Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools
21 | "DISPLAY": "${localEnv:DISPLAY}"
22 | */
23 | },
24 | "mounts": [
25 | "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/root/.ssh,readonly,type=bind"
26 | /* Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools
27 | {
28 | "source": "/tmp/.X11-unix",
29 | "target": "/tmp/.X11-unix",
30 | "type": "bind"
31 | },
32 | {
33 | "source": "${localEnv:XAUTHORITY:-$HOME/.Xauthority}",
34 | "target": "/root/.Xauthority",
35 | "type": "bind"
36 | },
37 | */
38 | /* Uncomment to persist bash history between sessions
39 | {
40 | "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history",
41 | "target": "/root/.bash_history",
42 | "type": "bind"
43 | }
44 | */
45 | ],
46 | "customizations": {
47 | "vscode": {
48 | "settings": {},
49 | "extensions": [
50 | "mhutchie.git-graph",
51 | "ms-azuretools.vscode-docker",
52 | "llvm-vs-code-extensions.vscode-clangd",
53 | "twxs.cmake",
54 | "cschlosser.doxdocgen",
55 | "ms-vscode.makefile-tools",
56 | "yzhang.markdown-all-in-one"
57 | ]
58 | }
59 | },
60 | "features": {
61 | "ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {
62 | "setLocale": true,
63 | "theme": "robbyrussell",
64 | "plugins": "git docker",
65 | "desiredLocale": "en_US.UTF-8 UTF-8"
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_idl_pkg_typesupport_entry_point.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_py/resource/_idl_pkg_typesupport_entry_point.c.em
2 | // generated code does not contain a copyright notice
3 | {########################################################################}
4 | {# Handle messages #}
5 | {########################################################################}
6 | {% set include_directives = set_global_variable("include_directives", []) %}
7 | {% set register_functions = set_global_variable("register_functions", []) %}
8 | #include
9 |
10 | static PyMethodDef {{ package_name }}__methods[] = {
11 | {NULL, NULL, 0, NULL} /* sentinel */
12 | };
13 |
14 | static struct PyModuleDef {{ package_name }}__module = {
15 | PyModuleDef_HEAD_INIT,
16 | "_{{ package_name }}_support",
17 | "_{{ package_name }}_doc",
18 | -1, /* -1 means that the module keeps state in global variables */
19 | {{ package_name }}__methods,
20 | NULL,
21 | NULL,
22 | NULL,
23 | NULL,
24 | };
25 |
26 | {% for message_obj in messages %}
27 | {% set message = message_obj.message %}
28 | {% set interface_path = message_obj.interface_path %}
29 | {% include "_msg_pkg_typesupport_entry_point.c.template" %}
30 |
31 | {% endfor %}
32 | {########################################################################}
33 | {# Handle services #}
34 | {########################################################################}
35 | {% for service in services %}
36 | {% set interface_path = service.interface_path %}
37 | {% include "_srv_pkg_typesupport_entry_point.c.template" %}
38 |
39 | {% endfor %}
40 | {########################################################################}
41 | {# Handle actions #}
42 | {########################################################################}
43 | {% for action in actions %}
44 | {% set interface_path = action.interface_path %}
45 | {% include "_action_pkg_typesupport_entry_point.c.template" %}
46 |
47 | {% endfor %}
48 | PyMODINIT_FUNC
49 | PyInit_{{ package_name }}_s__{{ typesupport_impl }}(void)
50 | {
51 | PyObject * pymodule = NULL;
52 | pymodule = PyModule_Create(&{{ package_name }}__module);
53 | if (!pymodule) {
54 | return NULL;
55 | }
56 | int8_t err;
57 | {% for register_function in get_global_variable("register_functions") %}
58 |
59 | err = {{ register_function }}(pymodule);
60 | if (err) {
61 | Py_XDECREF(pymodule);
62 | return NULL;
63 | }
64 | {% endfor %}
65 |
66 | return pymodule;
67 | }
68 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_cpp/resource/idl__rosidl_typesupport_introspection_cpp.hpp.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_introspection_cpp/resource/idl__rosidl_typesupport_introspection_cpp.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_HPP_" %}
7 |
8 | #ifndef {{ header_guard_variable }}
9 | #define {{ header_guard_variable }}
10 |
11 | {########################################################################}
12 | {# Handle message #}
13 | {########################################################################}
14 | {% for msg_object in messages %}
15 | {% set message=msg_object.message %}
16 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
17 |
18 | {% endfor %}
19 | {########################################################################}
20 | {# Handle service #}
21 | {########################################################################}
22 | {% for service in services %}
23 | {% set message=service.request_message %}
24 | {% include "srv__rosidl_typesupport_introspection_cpp.hpp.template" %}
25 |
26 | {% endfor %}
27 | {########################################################################}
28 | {# Handle action #}
29 | {########################################################################}
30 | {% for action in actions %}
31 | {% set message=action.goal %}
32 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
33 |
34 | {% set message=action.result %}
35 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
36 |
37 | {% set message=action.feedback %}
38 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
39 |
40 | {% set service=action.send_goal_service %}
41 | {% include "srv__rosidl_typesupport_introspection_cpp.hpp.template" %}
42 |
43 | {% set service=action.get_result_service %}
44 | {% include "srv__rosidl_typesupport_introspection_cpp.hpp.template" %}
45 |
46 | {% set message=action.feedback_message %}
47 | {% include "msg__rosidl_typesupport_introspection_cpp.hpp.template" %}
48 |
49 | {% endfor %}
50 |
51 | #endif // {{ header_guard_variable }}
52 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_idl_support.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_py/resource/_idl_support.c.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {########################################################################}
5 | {# Handle messages #}
6 | {########################################################################}
7 | {% set include_directives = set_global_variable("include_directives", []) %}
8 | {% for message_obj in messages %}
9 | {% set message = message_obj.message %}
10 | {% include "_msg_support.c.template" %}
11 |
12 | {% endfor %}
13 | {########################################################################}
14 | {# Handle services #}
15 | {########################################################################}
16 | {% for service in services %}
17 | {% set message = service.request_message %}
18 | {% include "_msg_support.c.template" %}
19 |
20 |
21 | {% set message = service.response_message %}
22 | {% include "_msg_support.c.template" %}
23 |
24 |
25 | {% set message = service.event_message %}
26 | {% include "_msg_support.c.template" %}
27 |
28 | {% endfor %}
29 | {########################################################################}
30 | {# Handle actions #}
31 | {########################################################################}
32 | {% for action in actions %}
33 | {% set message = action.goal %}
34 | {% include "_msg_support.c.template" %}
35 |
36 |
37 | {% set message = action.result %}
38 | {% include "_msg_support.c.template" %}
39 |
40 |
41 | {% set message = action.feedback %}
42 | {% include "_msg_support.c.template" %}
43 |
44 |
45 | {% set message = action.send_goal_service.request_message %}
46 | {% include "_msg_support.c.template" %}
47 |
48 |
49 | {% set message = action.send_goal_service.response_message %}
50 | {% include "_msg_support.c.template" %}
51 |
52 |
53 | {% set message = action.send_goal_service.event_message %}
54 | {% include "_msg_support.c.template" %}
55 |
56 |
57 | {% set message = action.get_result_service.request_message %}
58 | {% include "_msg_support.c.template" %}
59 |
60 |
61 | {% set message = action.get_result_service.response_message %}
62 | {% include "_msg_support.c.template" %}
63 |
64 |
65 | {% set message = action.get_result_service.event_message %}
66 | {% include "_msg_support.c.template" %}
67 |
68 |
69 | {% set message = action.feedback_message%}
70 | {% include "_msg_support.c.template" %}
71 |
72 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {# #}
5 | {% set include_directives = set_global_variable("include_directives", []) %}
6 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_" %}
7 |
8 | #ifndef {{ header_guard_variable }}
9 | #define {{ header_guard_variable }}
10 |
11 | #ifdef __cplusplus
12 | extern "C"
13 | {
14 | #endif
15 |
16 |
17 | {########################################################################}
18 | {# Handle message #}
19 | {########################################################################}
20 | {% for msg_object in messages %}
21 | {% set message=msg_object.message %}
22 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
23 |
24 | {% endfor %}
25 | {########################################################################}
26 | {# Handle service #}
27 | {########################################################################}
28 | {% for service in services %}
29 | {% set message=service.request_message %}
30 | {% include "srv__rosidl_typesupport_introspection_c.h.template" %}
31 |
32 | {% endfor %}
33 | {########################################################################}
34 | {# Handle action #}
35 | {########################################################################}
36 | {% for action in actions %}
37 | {% set message=action.goal %}
38 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
39 |
40 | {% set message=action.result %}
41 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
42 |
43 | {% set message=action.feedback %}
44 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
45 |
46 | {% set service=action.send_goal_service %}
47 | {% include "srv__rosidl_typesupport_introspection_c.h.template" %}
48 |
49 | {% set service=action.get_result_service %}
50 | {% include "srv__rosidl_typesupport_introspection_c.h.template" %}
51 |
52 | {% set message=action.feedback_message %}
53 | {% include "msg__rosidl_typesupport_introspection_c.h.template" %}
54 |
55 | {% endfor %}
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 |
60 | #endif // {{ header_guard_variable }}
61 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_fastrtps_c/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 |
3 | project(rosidlcpp_typesupport_fastrtps_c)
4 |
5 | if(DEFINED ENV{FASTRTPS_STATIC_DISABLE})
6 | set(FASTRTPS_STATIC_DISABLE $ENV{FASTRTPS_STATIC_DISABLE}
7 | CACHE BOOL "If fastrtps Static should be disabled.")
8 | else()
9 | set(FASTRTPS_STATIC_DISABLE FALSE
10 | CACHE BOOL "If fastrtps Static should be disabled.")
11 | endif()
12 |
13 | # Default to C99
14 | if(NOT CMAKE_C_STANDARD)
15 | set(CMAKE_C_STANDARD 99)
16 | endif()
17 |
18 | # Default to C++23
19 | if(NOT CMAKE_CXX_STANDARD)
20 | set(CMAKE_CXX_STANDARD 23)
21 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
22 | endif()
23 |
24 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
25 | add_compile_options(-Wall -Wextra -Wpedantic)
26 | endif()
27 |
28 | find_package(ament_cmake REQUIRED)
29 |
30 | if(FASTRTPS_STATIC_DISABLE)
31 | ament_package()
32 | message(STATUS "fastrtps static rmw implementation explicitly disabled - skipping '${PROJECT_NAME}'")
33 | return()
34 | endif()
35 |
36 | find_package(ament_cmake_python REQUIRED)
37 | find_package(rosidl_runtime_c REQUIRED)
38 | find_package(fastcdr REQUIRED CONFIG)
39 |
40 | ament_export_dependencies(rosidl_runtime_c)
41 | ament_export_dependencies(fastcdr)
42 |
43 | find_package(fmt REQUIRED)
44 | find_package(nlohmann_json REQUIRED)
45 |
46 | find_package(rosidlcpp_parser REQUIRED)
47 | find_package(rosidlcpp_generator_core REQUIRED)
48 |
49 | add_executable(rosidlcpp_typesupport_fastrtps_c src/rosidlcpp_typesupport_fastrtps_c/rosidlcpp_typesupport_fastrtps_c.cpp)
50 |
51 | target_include_directories(rosidlcpp_typesupport_fastrtps_c PUBLIC include)
52 | target_link_libraries(
53 | rosidlcpp_typesupport_fastrtps_c
54 | PUBLIC
55 | fmt::fmt
56 | nlohmann_json::nlohmann_json
57 | rosidlcpp_parser::rosidlcpp_parser
58 | rosidlcpp_generator_core::rosidlcpp_generator_core
59 | )
60 |
61 | ament_index_register_resource("rosidl_generator_packages")
62 |
63 | if(BUILD_TESTING)
64 | # TODO
65 | endif()
66 |
67 | ament_package(
68 | CONFIG_EXTRAS "rosidlcpp_typesupport_fastrtps_c-extras.cmake.in"
69 | )
70 |
71 | install(
72 | TARGETS rosidlcpp_typesupport_fastrtps_c
73 | DESTINATION lib/${PROJECT_NAME}
74 | )
75 |
76 | install(
77 | DIRECTORY cmake resource
78 | DESTINATION share/${PROJECT_NAME}
79 | )
80 |
81 | install(
82 | DIRECTORY include/
83 | DESTINATION include/${PROJECT_NAME}
84 | )
85 |
86 | install(
87 | TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
88 | ARCHIVE DESTINATION lib
89 | LIBRARY DESTINATION lib
90 | RUNTIME DESTINATION bin
91 | )
92 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_py/resource/_srv.py.template:
--------------------------------------------------------------------------------
1 | {# Included from rosidl_generator_py/resource/_idl.py.em #}
2 | {% set service_name = "_" + convert_camel_case_to_lower_case_underscore(service.type.name) %}
3 | {% set module_name = "_" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
4 | {% set message = service.request_message %}
5 | {% include "_msg.py.template" %}
6 | {% set message = service.response_message %}
7 | {% include "_msg.py.template" %}
8 | {% set message = service.event_message %}
9 | {% include "_msg.py.template" %}
10 |
11 |
12 | class Metaclass_{{ service.type.name }}(type):
13 | """Metaclass of service '{{ service.type.name }}'."""
14 |
15 | _TYPE_SUPPORT = None
16 |
17 | @classmethod
18 | def __import_type_support__(cls):
19 | try:
20 | from rosidl_generator_py import import_type_support
21 | module = import_type_support('{{ package_name }}')
22 | except ImportError:
23 | import logging
24 | import traceback
25 | logger = logging.getLogger(
26 | '{{ join(service.type.namespaces, ".") + "." + service.type.name }}')
27 | logger.debug(
28 | 'Failed to import needed modules for type support:\n' +
29 | traceback.format_exc())
30 | else:
31 | cls._TYPE_SUPPORT = module.type_support_srv__{{ join(span(service.type.namespaces, 1, length(service.type.namespaces)), "__") }}_{{ service_name }}
32 |
33 | from {{ join(service.type.namespaces, ".") }} import {{ module_name }}
34 | if {{ module_name }}.Metaclass_{{ service.request_message.type.name }}._TYPE_SUPPORT is None:
35 | {{ module_name }}.Metaclass_{{ service.request_message.type.name }}.__import_type_support__()
36 | if {{ module_name }}.Metaclass_{{ service.response_message.type.name }}._TYPE_SUPPORT is None:
37 | {{ module_name }}.Metaclass_{{ service.response_message.type.name }}.__import_type_support__()
38 | if {{ module_name }}.Metaclass_{{ service.event_message.type.name }}._TYPE_SUPPORT is None:
39 | {{ module_name }}.Metaclass_{{ service.event_message.type.name }}.__import_type_support__()
40 |
41 |
42 | class {{ service.type.name }}(metaclass=Metaclass_{{ service.type.name }}):
43 | from {{ join(service.type.namespaces, ".") }}.{{ module_name }} import {{ service.request_message.type.name }} as Request
44 | from {{ join(service.type.namespaces, ".") }}.{{ module_name }} import {{ service.response_message.type.name }} as Response
45 | from {{ join(service.type.namespaces, ".") }}.{{ module_name }} import {{ service.event_message.type.name }} as Event
46 |
47 | def __init__(self):
48 | raise NotImplementedError('Service classes can not be instantiated')
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | Language: Cpp
2 | # BasedOnStyle: Google
3 | AccessModifierOffset: -1
4 | AlignAfterOpenBracket: Align
5 | AlignConsecutiveAssignments: false
6 | AlignConsecutiveDeclarations: false
7 | AlignEscapedNewlinesLeft: true
8 | AlignOperands: true
9 | AlignTrailingComments: true
10 | AllowAllParametersOfDeclarationOnNextLine: true
11 | AllowShortBlocksOnASingleLine: false
12 | AllowShortCaseLabelsOnASingleLine: false
13 | AllowShortFunctionsOnASingleLine: All
14 | AllowShortIfStatementsOnASingleLine: true
15 | AllowShortLoopsOnASingleLine: true
16 | AlwaysBreakAfterDefinitionReturnType: None
17 | AlwaysBreakAfterReturnType: None
18 | AlwaysBreakBeforeMultilineStrings: true
19 | AlwaysBreakTemplateDeclarations: true
20 | BinPackArguments: true
21 | BinPackParameters: true
22 | BraceWrapping:
23 | AfterClass: false
24 | AfterControlStatement: false
25 | AfterEnum: false
26 | AfterFunction: false
27 | AfterNamespace: false
28 | AfterObjCDeclaration: false
29 | AfterStruct: false
30 | AfterUnion: false
31 | BeforeCatch: false
32 | BeforeElse: false
33 | IndentBraces: false
34 | BreakBeforeBinaryOperators: None
35 | BreakBeforeBraces: Attach
36 | BreakBeforeTernaryOperators: true
37 | BreakConstructorInitializersBeforeComma: false
38 | # ColumnLimit: 80
39 | ColumnLimit: 0
40 | CommentPragmas: '^ IWYU pragma:'
41 | ConstructorInitializerAllOnOneLineOrOnePerLine: true
42 | ConstructorInitializerIndentWidth: 4
43 | ContinuationIndentWidth: 4
44 | Cpp11BracedListStyle: true
45 | DerivePointerAlignment: true
46 | DisableFormat: false
47 | ExperimentalAutoDetectBinPacking: false
48 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
49 | IncludeCategories:
50 | - Regex: '^<.*\.h>'
51 | Priority: 1
52 | - Regex: '^<.*'
53 | Priority: 2
54 | - Regex: '.*'
55 | Priority: 3
56 | IndentCaseLabels: true
57 | IndentWidth: 2
58 | IndentWrappedFunctionNames: false
59 | KeepEmptyLinesAtTheStartOfBlocks: false
60 | MacroBlockBegin: ''
61 | MacroBlockEnd: ''
62 | MaxEmptyLinesToKeep: 1
63 | NamespaceIndentation: None
64 | ObjCBlockIndentWidth: 2
65 | ObjCSpaceAfterProperty: false
66 | ObjCSpaceBeforeProtocolList: false
67 | PenaltyBreakBeforeFirstCallParameter: 1
68 | # PenaltyBreakComment: 300
69 | # PenaltyBreakFirstLessLess: 120
70 | # PenaltyBreakString: 1000
71 | # PenaltyExcessCharacter: 1000000
72 | # PenaltyReturnTypeOnItsOwnLine: 200
73 | PointerAlignment: Left
74 | ReflowComments: true
75 | SortIncludes: true
76 | SpaceAfterCStyleCast: false
77 | SpaceBeforeAssignmentOperators: true
78 | SpaceBeforeParens: ControlStatements
79 | SpaceInEmptyParentheses: false
80 | SpacesBeforeTrailingComments: 2
81 | SpacesInAngles: false
82 | SpacesInContainerLiterals: true
83 | SpacesInCStyleCastParentheses: false
84 | SpacesInParentheses: false
85 | SpacesInSquareBrackets: false
86 | Standard: Auto
87 | TabWidth: 8
88 | UseTab: Never
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl__functions.c.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl__functions.c.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 | {% set include_base = package_name + "/" + interface_path.filedir + "/detail/" + convert_camel_case_to_lower_case_underscore(interface_path.filename) %}
5 | {% set include_directives = set_global_variable("include_directives", push_back(push_back([], include_base + "__functions.h"), "rcutils/allocator.h")) %}
6 | #include "{{ include_base }}__functions.h"
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | #include "rcutils/allocator.h"
14 | {########################################################################}
15 | {# Handle message #}
16 | {########################################################################}
17 | {% for msg_object in messages %}
18 |
19 | {% set message=msg_object.message %}
20 | {% include "msg__functions.c.template" %}
21 | {% endfor %}
22 | {########################################################################}
23 | {# Handle service #}
24 | {########################################################################}
25 | {% for service in services %}
26 | {% set message=service.request_message %}
27 | {% include "msg__functions.c.template" %}
28 |
29 | {% set message=service.response_message %}
30 | {% include "msg__functions.c.template" %}
31 |
32 | {% set message=service.event_message %}
33 | {% include "msg__functions.c.template" %}
34 | {% endfor %}
35 | {########################################################################}
36 | {# Handle action #}
37 | {########################################################################}
38 | {% for action in actions %}
39 |
40 | {% set message=action.goal %}
41 | {% include "msg__functions.c.template" %}
42 |
43 | {% set message=action.result %}
44 | {% include "msg__functions.c.template" %}
45 |
46 | {% set message=action.feedback %}
47 | {% include "msg__functions.c.template" %}
48 |
49 | {% set message=action.send_goal_service.request_message %}
50 | {% include "msg__functions.c.template" %}
51 |
52 | {% set message=action.send_goal_service.response_message %}
53 | {% include "msg__functions.c.template" %}
54 |
55 | {% set message=action.send_goal_service.event_message %}
56 | {% include "msg__functions.c.template" %}
57 |
58 | {% set message=action.get_result_service.request_message %}
59 | {% include "msg__functions.c.template" %}
60 |
61 | {% set message=action.get_result_service.response_message %}
62 | {% include "msg__functions.c.template" %}
63 |
64 | {% set message=action.get_result_service.event_message %}
65 | {% include "msg__functions.c.template" %}
66 |
67 | {% set message=action.feedback_message %}
68 | {% include "msg__functions.c.template" %}
69 | {% endfor %}
--------------------------------------------------------------------------------
/rosidlcpp_generator_cpp/resource/action__struct.hpp.template:
--------------------------------------------------------------------------------
1 | {% set action_includes = [
2 | "action_msgs/srv/cancel_goal.hpp",
3 | "action_msgs/msg/goal_info.hpp",
4 | "action_msgs/msg/goal_status_array.hpp"] %}
5 | {% set action_name = join(action.type.namespaces, "::") + "::" + action.type.name %}
6 | {% set message = action.goal %}
7 | {% include "msg__struct.hpp.template" %}
8 |
9 | {% set message = action.result %}
10 | {% include "msg__struct.hpp.template" %}
11 |
12 | {% set message = action.feedback %}
13 | {% include "msg__struct.hpp.template" %}
14 |
15 | {% set service = action.send_goal_service %}
16 | {% include "srv__struct.hpp.template" %}
17 |
18 | {% set service = action.get_result_service %}
19 | {% include "srv__struct.hpp.template" %}
20 |
21 | {% set message = action.feedback_message %}
22 | {% include "msg__struct.hpp.template" %}
23 |
24 | {% for header_file in action_includes %}
25 | {% set include_directives = get_global_variable("include_directives") %}
26 | {% if header_file in include_directives %}
27 | // already included above
28 | // {{ "" -}}
29 | {% else %}
30 | {% set include_directives = set_global_variable("include_directives", push_back(include_directives, header_file)) %}
31 | {% endif %}
32 | #include "{{ header_file }}"
33 | {% endfor %}
34 |
35 | {% for ns in action.type.namespaces %}
36 | namespace {{ ns }}
37 | {
38 |
39 | {% endfor %}
40 | struct {{ action.type.name }}
41 | {
42 | /// The goal message defined in the action definition.
43 | using Goal = {{ action_name }}{{ ACTION_GOAL_SUFFIX }};
44 | /// The result message defined in the action definition.
45 | using Result = {{ action_name }}{{ ACTION_RESULT_SUFFIX }};
46 | /// The feedback message defined in the action definition.
47 | using Feedback = {{ action_name }}{{ ACTION_FEEDBACK_SUFFIX }};
48 |
49 | struct Impl
50 | {
51 | /// The send_goal service using a wrapped version of the goal message as a request.
52 | using SendGoalService = {{ action_name }}{{ ACTION_GOAL_SERVICE_SUFFIX }};
53 | /// The get_result service using a wrapped version of the result message as a response.
54 | using GetResultService = {{ action_name }}{{ ACTION_RESULT_SERVICE_SUFFIX }};
55 | /// The feedback message with generic fields which wraps the feedback message.
56 | using FeedbackMessage = {{ action_name }}{{ ACTION_FEEDBACK_MESSAGE_SUFFIX }};
57 |
58 | /// The generic service to cancel a goal.
59 | using CancelGoalService = action_msgs::srv::CancelGoal;
60 | /// The generic message for the status of a goal.
61 | using GoalStatusMessage = action_msgs::msg::GoalStatusArray;
62 | };
63 | };
64 |
65 | typedef struct {{ action.type.name }} {{ action.type.name }};
66 | {% for i in range(length(action.type.namespaces)) %}
67 |
68 | } // namespace {{ at(action.type.namespaces, length(action.type.namespaces) - 1 - i) }}
69 | {% endfor %}
--------------------------------------------------------------------------------
/.devcontainer/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: clean_rosidl clean_rosidlpp clean_rosidlcpp_no_precompiled clean_all build_rosidl build_rosidlcpp build_rosidlcpp_no_precompiled build_all
2 |
3 | clean_rosidl:
4 | @rm -rf build_rosidl/${PKG}
5 |
6 | clean_rosidlcpp:
7 | @rm -rf build_rosidlcpp/${PKG}
8 |
9 | clean_rosidlcpp_no_precompiled:
10 | @rm -rf build_rosidlcpp_no_precompiled/${PKG}
11 |
12 | clean_all:
13 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) clean_rosidl
14 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) clean_rosidlcpp
15 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) clean_rosidlcpp_no_precompiled
16 |
17 | build_rosidl:
18 | @env -i bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; colcon build --mixin ninja --packages-select ${PKG} --base-paths src --build-base build_rosidl --install-base install_rosidl --event-handlers=console_direct+"
19 |
20 | build_rosidlcpp:
21 | @env -i bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; source install/setup.bash; colcon build --mixin ninja --packages-select ${PKG} --base-paths src --build-base build_rosidlcpp --install-base install_rosidlcpp --event-handlers=console_direct+"
22 |
23 | build_rosidlcpp_no_precompiled:
24 | @env -i bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; source install/setup.bash; colcon build --mixin ninja --packages-select ${PKG} --base-paths src --build-base build_rosidlcpp_no_precompiled --install-base install_rosidlcpp_no_precompiled --cmake-args -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON"
25 |
26 | build_all:
27 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) build_rosidl
28 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) build_rosidlcpp
29 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) build_rosidlcpp_no_precompiled
30 |
31 | diff:
32 | @echo "----------------------------------------------------------------------------"
33 | @echo "Comparing ${PKG} for ${GENERATOR}"
34 | @echo "----------------------------------------------------------------------------"
35 | @diff --color -r -N build_rosidl/${PKG}/${GENERATOR} build_rosidlcpp/${PKG}/${GENERATOR} || true
36 |
37 | diff_all:
38 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_generator_c diff
39 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_generator_cpp diff
40 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_generator_py diff
41 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_generator_cpp diff
42 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_generator_type_description diff
43 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_c diff
44 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_cpp diff
45 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_fastrtps_c diff
46 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_fastrtps_cpp diff
47 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_introspection_c diff
48 | @$(MAKE) -f $(lastword $(MAKEFILE_LIST)) GENERATOR=rosidl_typesupport_introspection_cpp diff
--------------------------------------------------------------------------------
/rosidlcpp_generator_type_description/resource/HashedTypeDescription.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "HashedTypeDescription.schema.json",
4 | "title": "HashedTypeDescription",
5 | "description": "Contains hashes and full type description for a ROS 2 interface. TypeDescription, IndividualTypeDescription, Field, and FieldType are exact representations of type_description_interfaces/msg types, see their .msg files for semantic comments.",
6 | "type": "object",
7 | "properties": {
8 | "type_description_msg": { "$ref": "#/$defs/TypeDescription" },
9 | "type_hashes": {
10 | "type": "array",
11 | "items": { "$ref": "#/$defs/TypeNameAndHash" }
12 | }
13 | },
14 | "required": ["type_description_msg", "type_hashes"],
15 | "additionalProperties": false,
16 | "$defs": {
17 | "TypeNameAndHash": {
18 | "type": "object",
19 | "properties": {
20 | "type_name": { "type": "string" },
21 | "hash_string": { "type": "string" }
22 | },
23 | "required": [ "type_name", "hash_string" ],
24 | "additionalProperties": false
25 | },
26 | "TypeDescription": {
27 | "type": "object",
28 | "$comment": "For hashing: All whitespace must be excluded, which this schema cannot enforce.",
29 | "properties": {
30 | "type_description": {"$ref": "#/$defs/IndividualTypeDescription"},
31 | "referenced_type_descriptions": {
32 | "$comment": "For hashing: Referenced type descriptions must be alphabetized, which this schema cannot enforce.",
33 | "type": "array",
34 | "items": { "$ref": "#/$defs/IndividualTypeDescription" }
35 | }
36 | },
37 | "required": ["type_description", "referenced_type_descriptions"],
38 | "additionalProperties": false
39 | },
40 | "IndividualTypeDescription": {
41 | "type": "object",
42 | "properties": {
43 | "type_name": {"type": "string", "maxLength": 255},
44 | "fields": {
45 | "type": "array",
46 | "items": { "$ref": "#/$defs/Field" }
47 | }
48 | },
49 | "required": ["type_name", "fields"],
50 | "additionalProperties": false
51 | },
52 | "Field": {
53 | "type": "object",
54 | "properties": {
55 | "default_value": {"type": "string"},
56 | "name": {"type": "string"},
57 | "type": {"$ref": "#/$defs/FieldType"}
58 | },
59 | "required": ["name", "type"],
60 | "additionalProperties": false
61 | },
62 | "FieldType": {
63 | "type": "object",
64 | "properties": {
65 | "type_id": {"type": "integer", "minimum": 0, "maximum": 255},
66 | "capacity": {"type": "integer", "minimum": 0},
67 | "string_capacity": {"type": "integer", "minimum": 0},
68 | "nested_type_name": {"type": "string", "maxLength": 255}
69 | },
70 | "required": ["type_id", "capacity", "string_capacity", "nested_type_name"],
71 | "additionalProperties": false
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/rosidlcpp_parser/include/rosidlcpp_parser/rosidlcpp_parser.hpp:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Anthony Welte
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | #include
25 |
26 | namespace rosidlcpp_parser {
27 |
28 | using TypedefMap = std::unordered_map;
29 |
30 | auto split_string_view(std::string_view value, std::string_view sep) -> std::vector;
31 | auto split_string(const std::string& value, const std::string& sep) -> std::vector;
32 |
33 | auto consume_white_space(std::string_view& content_view) -> void;
34 | auto consume_comment(std::string_view& content_view) -> void;
35 | auto consume_white_space_and_comment(std::string_view& content_view) -> void;
36 |
37 | auto parse_include(std::string_view& content_view) -> std::string;
38 | auto parse_string(std::string_view& content_view) -> std::string;
39 | auto parse_string_part(std::string_view& content_view) -> std::string;
40 | auto parse_string_python(std::string_view& content_view) -> std::string;
41 | auto interpret_type(std::string_view content_view, TypedefMap typedefs = {}) -> nlohmann::json;
42 | auto parse_type(std::string_view& content_view) -> std::string;
43 | auto parse_name(std::string_view& content_view) -> std::string_view;
44 | auto parse_value(std::string_view& content_view) -> nlohmann::json;
45 | auto parse_constant(std::string_view& content_view, TypedefMap typedefs = {}) -> nlohmann::json;
46 | auto parse_member(std::string_view& content_view, TypedefMap typedefs = {}) -> nlohmann::json;
47 | auto parse_attribute(std::string_view& content_view) -> nlohmann::json;
48 | auto parse_typedef(std::string_view& content_view) -> std::pair;
49 | auto parse_structure(std::string_view& content_view, TypedefMap typedefs = {}) -> nlohmann::json;
50 | auto parse_module(std::string_view& content_view, TypedefMap tyepdefs = {}) -> nlohmann::json;
51 |
52 | auto parse_default_list(std::string_view default_value) -> nlohmann::json;
53 |
54 | auto has_non_ascii(const std::string& str) -> bool;
55 |
56 | auto parse_idl_file(const std::string& filename) -> nlohmann::json;
57 | auto parse_ros_idl_file(const std::string& filename) -> nlohmann::json;
58 |
59 | auto convert_idljson_to_rosjson(const nlohmann::json& idl_json, std::string_view file_path) -> nlohmann::json;
60 |
61 | } // namespace rosidlcpp_parser
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/idl__struct.h.template:
--------------------------------------------------------------------------------
1 | // generated from rosidl_generator_c/resource/idl__struct.h.em
2 | // with input from {{ package_name }}:{{ interface_path.filepath }}
3 | // generated code does not contain a copyright notice
4 |
5 | // IWYU pragma: private, include "{{ package_name }}/{{ interface_path.filedir }}/{{ convert_camel_case_to_lower_case_underscore(interface_path.filename) }}.h"
6 |
7 | {% set header_guard_variable = upper(package_name) + "__" + upper(join(split_string(interface_path.filedir, "/"), "__")) + "__DETAIL__" + upper(convert_camel_case_to_lower_case_underscore(interface_path.filename)) + "__STRUCT_H_" %}
8 | {% set include_directives = set_global_variable("include_directives", []) %}
9 |
10 | #ifndef {{ header_guard_variable }}
11 | #define {{ header_guard_variable }}
12 |
13 | #ifdef __cplusplus
14 | extern "C"
15 | {
16 | #endif
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | {########################################################################}
23 | {# Handle message #}
24 | {########################################################################}
25 | {% for msg_object in messages %}
26 | {% set message=msg_object.message %}
27 | {% include "msg__struct.h.template" %}
28 |
29 | {% endfor %}
30 | {########################################################################}
31 | {# Handle service #}
32 | {########################################################################}
33 | {% for service in services %}
34 |
35 | {% set message=service.request_message %}
36 | {% include "msg__struct.h.template" %}
37 |
38 | {% set message=service.response_message %}
39 | {% include "msg__struct.h.template" %}
40 |
41 | {% set message=service.event_message %}
42 | {% include "msg__struct.h.template" %}
43 |
44 | {% endfor %}
45 | {########################################################################}
46 | {# Handle action #}
47 | {########################################################################}
48 | {% for action in actions %}
49 |
50 | {% set message=action.goal %}
51 | {% include "msg__struct.h.template" %}
52 |
53 | {% set message=action.result %}
54 | {% include "msg__struct.h.template" %}
55 |
56 | {% set message=action.feedback %}
57 | {% include "msg__struct.h.template" %}
58 |
59 | {% set message=action.send_goal_service.request_message %}
60 | {% include "msg__struct.h.template" %}
61 |
62 | {% set message=action.send_goal_service.response_message %}
63 | {% include "msg__struct.h.template" %}
64 |
65 | {% set message=action.send_goal_service.event_message %}
66 | {% include "msg__struct.h.template" %}
67 |
68 | {% set message=action.get_result_service.request_message %}
69 | {% include "msg__struct.h.template" %}
70 |
71 | {% set message=action.get_result_service.response_message %}
72 | {% include "msg__struct.h.template" %}
73 |
74 | {% set message=action.get_result_service.event_message %}
75 | {% include "msg__struct.h.template" %}
76 |
77 | {% set message=action.feedback_message %}
78 | {% include "msg__struct.h.template" %}
79 |
80 | {% endfor %}
81 | #ifdef __cplusplus
82 | }
83 | #endif
84 |
85 | #endif // {{ header_guard_variable }}
86 |
--------------------------------------------------------------------------------
/rosidlcpp_generator_c/resource/srv__type_support.c.template:
--------------------------------------------------------------------------------
1 | {% set event_type = package_name + "__" + replace(interface_path.filedir, "/", "__") + "__" + service.type.name + SERVICE_EVENT_MESSAGE_SUFFIX %}
2 | {% set request_type = package_name + "__" + replace(interface_path.filedir, "/", "__") + "__" + service.type.name + SERVICE_REQUEST_MESSAGE_SUFFIX %}
3 | {% set response_type = package_name + "__" + replace(interface_path.filedir, "/", "__") + "__" + service.type.name + SERVICE_RESPONSE_MESSAGE_SUFFIX %}
4 | void *
5 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_CREATE_EVENT_MESSAGE_SYMBOL_NAME(
6 | rosidl_typesupport_c,
7 | {% for ns in service.type.namespaces %}
8 | {{ ns }},
9 | {% endfor %}
10 | {{ service.type.name }}
11 | )(
12 | const rosidl_service_introspection_info_t * info,
13 | rcutils_allocator_t * allocator,
14 | const void * request_message,
15 | const void * response_message)
16 | {
17 | if (!allocator || !info) {
18 | return NULL;
19 | }
20 | {{ event_type }} * event_msg = ({{ event_type }} *)(allocator->allocate(sizeof({{ event_type }}), allocator->state));
21 | if (!{{ event_type }}__init(event_msg)) {
22 | allocator->deallocate(event_msg, allocator->state);
23 | return NULL;
24 | }
25 |
26 | event_msg->info.event_type = info->event_type;
27 | event_msg->info.sequence_number = info->sequence_number;
28 | event_msg->info.stamp.sec = info->stamp_sec;
29 | event_msg->info.stamp.nanosec = info->stamp_nanosec;
30 | memcpy(event_msg->info.client_gid, info->client_gid, 16);
31 | if (request_message) {
32 | {{ request_type }}__Sequence__init(
33 | &event_msg->request,
34 | 1);
35 | if (!{{ request_type }}__copy((const {{ request_type }} *)(request_message), event_msg->request.data)) {
36 | allocator->deallocate(event_msg, allocator->state);
37 | return NULL;
38 | }
39 | }
40 | if (response_message) {
41 | {{ response_type }}__Sequence__init(
42 | &event_msg->response,
43 | 1);
44 | if (!{{ response_type }}__copy((const {{ response_type }} *)(response_message), event_msg->response.data)) {
45 | allocator->deallocate(event_msg, allocator->state);
46 | return NULL;
47 | }
48 | }
49 | return event_msg;
50 | }
51 |
52 | // Forward declare the get type support functions for this type.
53 | bool
54 | ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_DESTROY_EVENT_MESSAGE_SYMBOL_NAME(
55 | rosidl_typesupport_c,
56 | {% for ns in service.type.namespaces %}
57 | {{ ns }},
58 | {% endfor %}
59 | {{ service.type.name }}
60 | )(
61 | void * event_msg,
62 | rcutils_allocator_t * allocator)
63 | {
64 | if (!allocator) {
65 | return false;
66 | }
67 | if (NULL == event_msg) {
68 | return false;
69 | }
70 | {{ event_type }} * _event_msg = ({{ event_type }} *)(event_msg);
71 |
72 | {{ event_type }}__fini(({{ event_type }} *)(_event_msg));
73 | if (_event_msg->request.data) {
74 | allocator->deallocate(_event_msg->request.data, allocator->state);
75 | }
76 | if (_event_msg->response.data) {
77 | allocator->deallocate(_event_msg->response.data, allocator->state);
78 | }
79 | allocator->deallocate(_event_msg, allocator->state);
80 | return true;
81 | }
82 |
--------------------------------------------------------------------------------
/rosidlcpp_typesupport_c/cmake/get_used_typesupports.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2016-2020 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | #
16 | # Get the concrete typesupport names to be used.
17 | #
18 | # The result can be overridden by setting either a CMake or environment
19 | # variable named ``STATIC_${typesupport_type}`` (all uppercase).
20 | # The variable can contain ROS IDL typesupport names separated by the platform
21 | # specific path separator.
22 | # Including an unavailable ROS IDL typesupport results in a fatal error message.
23 | #
24 | # :param var: the output variable name for the typesupport names
25 | # :type var: list of strings
26 | # :param typesupport_type: the type of the typesupport to look for
27 | # :type typesupport_type: string
28 | #
29 | # @public
30 | #
31 | function(get_used_typesupports var typesupport_type)
32 | # all type supports available
33 | ament_index_get_resources(available_typesupports "${typesupport_type}")
34 | if(available_typesupports STREQUAL "")
35 | message(FATAL_ERROR "No '${typesupport_type}' found")
36 | endif()
37 |
38 | # use explicitly provided list if provided
39 | # option()
40 | string(TOUPPER "${typesupport_type}" typesupport_type_upper)
41 | if(NOT "$ENV{STATIC_${typesupport_type_upper}}" STREQUAL "")
42 | string(REPLACE ":" ";" STATIC_${typesupport_type_upper} "$ENV{STATIC_${typesupport_type_upper}}")
43 | endif()
44 | if(NOT "${STATIC_${typesupport_type_upper}}" STREQUAL "")
45 | # check if given ROS IDL typesupports are available
46 | foreach(typesupport ${STATIC_${typesupport_type_upper}})
47 | if(NOT "${typesupport}" IN_LIST available_typesupports)
48 | message(FATAL_ERROR
49 | "The ROS IDL typesupport '${typesupport}' specified in "
50 | "'STATIC_${typesupport_type_upper}' is not available ("
51 | "${available_typesupports})")
52 | endif()
53 | endforeach()
54 | set(selected_typesupports ${STATIC_${typesupport_type_upper}})
55 | message(STATUS "Filtered available ROS IDL typesupport implementations: ${selected_typesupports}")
56 | set(msg_used_typesupports "selected")
57 | else()
58 | set(selected_typesupports ${available_typesupports})
59 | set(msg_used_typesupports "all available")
60 | endif()
61 |
62 | # if only one type support is available / selected the caller might decide to
63 | # bypass the dynamic dispatch
64 | list(LENGTH selected_typesupports count)
65 | if(count EQUAL 1)
66 | set(msg_used_typesupports "single")
67 | endif()
68 | message(STATUS "Using ${msg_used_typesupports} ${typesupport_type}: ${selected_typesupports}")
69 | set(${var} "${selected_typesupports}" PARENT_SCOPE)
70 | endfunction()
71 |
--------------------------------------------------------------------------------