Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rmw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ endif()
find_package(ament_cmake_ros REQUIRED)

find_package(rcutils REQUIRED)
find_package(rosidl_dynamic_typesupport REQUIRED)
find_package(rosidl_runtime_c REQUIRED)

include(cmake/configure_rmw_library.cmake)
Expand All @@ -28,6 +29,7 @@ set(rmw_sources
"src/allocators.c"
"src/convert_rcutils_ret_to_rmw_ret.c"
"src/discovery_options.c"
"src/dynamic_message_type_support.c"
"src/event.c"
"src/init.c"
"src/init_options.c"
Expand All @@ -54,6 +56,9 @@ add_library(${PROJECT_NAME} ${rmw_sources})
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
target_link_libraries(${PROJECT_NAME}
rosidl_dynamic_typesupport::rosidl_dynamic_typesupport
)

if(BUILD_TESTING AND NOT RCUTILS_DISABLE_FAULT_INJECTION)
target_compile_definitions(${PROJECT_NAME} PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
Expand All @@ -67,6 +72,7 @@ configure_rmw_library(${PROJECT_NAME} LANGUAGE "C")

ament_export_dependencies(
rcutils
rosidl_dynamic_typesupport
rosidl_runtime_c
)

Expand Down
87 changes: 87 additions & 0 deletions rmw/include/rmw/dynamic_message_type_support.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright 2022 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW__DYNAMIC_MESSAGE_TYPE_SUPPORT_H_
#define RMW__DYNAMIC_MESSAGE_TYPE_SUPPORT_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include <rosidl_dynamic_typesupport/api/serialization_support.h>
#include <rosidl_dynamic_typesupport/dynamic_message_type_support_struct.h>
#include <rosidl_dynamic_typesupport/identifier.h>
#include <rosidl_dynamic_typesupport/types.h>

#include <rosidl_runtime_c/message_type_support_struct.h>
#include <rosidl_runtime_c/type_description/type_description__struct.h>
#include <rosidl_runtime_c/type_description/type_source__struct.h>

#include "rmw/features.h"
#include "rmw/serialized_message.h"
#include "rmw/visibility_control.h"

/// Interfaces for runtime interface reflection

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_take_dynamic_message(
const rmw_subscription_t * subscription,
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_message,
bool * taken,
rmw_subscription_allocation_t * allocation);

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_take_dynamic_message_with_info(
const rmw_subscription_t * subscription,
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_message,
bool * taken,
rmw_message_info_t * message_info,
rmw_subscription_allocation_t * allocation);

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_get_serialization_support(
const char * serialization_lib_name,
rosidl_dynamic_typesupport_serialization_support_t ** serialization_support); // OUT

// TODO(methylDragon): Nice to have only
// RMW_PUBLIC
// RMW_WARN_UNUSED
// rmw_ret_t
// rmw_get_dynamic_type_from_middleware(
// const rmw_node_t * node,
// const char * topic_name,
// const rosidl_message_type_support_t type_support,
// rosidl_dynamic_typesupport_dynamic_type_t * dynamic_message_type);
//
// RMW_PUBLIC
// RMW_WARN_UNUSED
// rmw_ret_t
// rmw_get_dynamic_data_from_middleware(
// const rmw_node_t * node,
// const char * topic_name,
// const rosidl_message_type_support_t type_support,
// rosidl_dynamic_typesupport_dynamic_data_t * dynamic_message);

#ifdef __cplusplus
}
#endif

#endif // RMW__DYNAMIC_MESSAGE_TYPE_SUPPORT_H_
5 changes: 5 additions & 0 deletions rmw/include/rmw/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ typedef enum RMW_PUBLIC_TYPE rmw_feature_e
/// `rmw_message_info_t.reception_sequence_number` is filled correctly
/// by the rmw implementation.
RMW_FEATURE_MESSAGE_INFO_RECEPTION_SEQUENCE_NUMBER = 1,
/// deferred description dynamic type rosidl_message_type_support_t structs are allowed, and the
/// middleware MUST populate them on type discovery
RMW_MIDDLEWARE_SUPPORTS_TYPE_DISCOVERY = 2,
/// dynamic type subscriptions will use take_dynamic_message_with_info()
RMW_MIDDLEWARE_CAN_TAKE_DYNAMIC_MESSAGE = 3,
} rmw_feature_t;

/// Query if a feature is supported by the rmw implementation.
Expand Down
1 change: 1 addition & 0 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ extern "C"
#include "rmw/message_sequence.h"
#include "rmw/publisher_options.h"
#include "rmw/qos_profiles.h"
#include "rmw/dynamic_message_type_support.h"
#include "rmw/subscription_options.h"
#include "rmw/types.h"
#include "rmw/visibility_control.h"
Expand Down
2 changes: 2 additions & 0 deletions rmw/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
<build_depend>rcutils</build_depend>
<!-- Only needed because CMake versions less than 3.13 don't support CMP0079 -->
<build_depend>rosidl_runtime_c</build_depend>
<build_depend>rosidl_dynamic_typesupport</build_depend>

<build_export_depend>rcutils</build_export_depend>
<!-- This is required for the definition of the rosidl typesupport types -->
<build_export_depend>rosidl_runtime_c</build_export_depend>
<build_export_depend>rosidl_dynamic_typesupport</build_export_depend>

<test_depend>ament_cmake_gmock</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down