Skip to content

Commit

Permalink
Event listeners distinct (#109)
Browse files Browse the repository at this point in the history
* Add sequence numbers to message info structure (#74)

* Fill reception_sequence_number/publication_sequence_number in all rmw_take_*_with_info() functions

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

* Add rmw_feature_supported()

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

* add stub for content filtered topic (#77)

* add stub for content filtered topic

Signed-off-by: Chen Lihui <lihui.chen@sony.com>

* Add support for user-specified content filters (#68)

* Add support for user-specified content filters.

Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* - Resolve memory leak of custom content-filter resources
- Add missing package dependencies for rti_connext_dds_custom_sql_filter
- Clean up all participants upon factory finalization
- Reset context state upon finalization (rmw_connextddsmicro)
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Assume non-null options argument
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* - Return error when retrieving content-filter from a subscription that doesn't have one.
- Rename internal functions related to content-filters
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Fix compilation error, oops.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* - Define RMW_CONNEXT_DEBUG when building Debug libraries.
- Make sure participant is enabled before deleting contained entities when using Connext debug libraries.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Resolve memory leak for finalization on error.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Rename content filter public API.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Add client/service QoS getters (#67)

Signed-off-by: Mauro Passerino <mpasserino@irobot.com>

* Changelogs

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

* 0.8.1

* Fix cpplint errors (#69)

* Use static_cast instead of C-style cast

Fixes cpplint error.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Update NOLINT category

Relates to ament/ament_lint#324

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* 0.8.2

Signed-off-by: Audrow Nash <audrow@hey.com>

* Update rti-connext-dds dependency to 6.0.1. (#71)

Now that this package is available in the ROS bootstrap repository for Ubuntu Focal and Jammy we can bump the expected dependency version.

* 0.8.3

* Add rmw listener apis (#44)

* Add stubs for setting listener callbacks

Signed-off-by: Mauro Passerino <mpasserino@irobot.com>

* Address PR suggestions

Signed-off-by: Mauro Passerino <mpasserino@irobot.com>

* Fix linter issues

Signed-off-by: Mauro Passerino <mpasserino@irobot.com>

Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Alberto Soragna <alberto.soragna@gmail.com>

* Changelog. (#73)

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* 0.9.0

* add stub for content filtered topic

Signed-off-by: Chen Lihui <lihui.chen@sony.com>

* * Rebased branch asorbini/cft on top of 0.9.0.
* Resolved CFT finalization issues on error.
* Verified and cleaned up build for rmw_connextddsmicro.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Move custom SQL filter to rmw_connextdds_common
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Try to resolve linking error on Windows.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Optionally disable writer-side CFT optimizations to support Windows.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* No need to declare private CFT function on Windows.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* remove stub implementation for ContentFilteredTopic.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* address cpplint error.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* Avoid conversion warnings on Windows.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Use strtol instead of sscanf to avoid warnings on Windows.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Avoid finalizing participants if factory is not available.
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

Co-authored-by: mauropasse <mauropasse@hotmail.com>
Co-authored-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Co-authored-by: Jacob Perron <jacob@openrobotics.org>
Co-authored-by: Audrow Nash <audrow@hey.com>
Co-authored-by: Steven! Ragnarök <nuclearsandwich@users.noreply.github.com>
Co-authored-by: Steven! Ragnarök <steven@nuclearsandwich.com>
Co-authored-by: iRobot ROS <49500531+irobot-ros@users.noreply.github.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Alberto Soragna <alberto.soragna@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: Chen Lihui <lihui.chen@sony.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* 0.10.0

Signed-off-by: Audrow Nash <audrow@hey.com>

* Update launch_testing_ros output filter prefixes for Connext6 (#80)

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

* Properly initialize CDR stream before using it for filtering (#81)

Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Exclude missing sample info fields when building rmw_connextddsmicro (#79)

* Exclude missing sample info fields when building micro.
* Report features individually for each RMW implementation.
* Return special value for unsupported sequence numbers.

Signed-off-by: Andrea Sorbini <asorbini@rti.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>

* 0.11.0

Signed-off-by: Audrow Nash <audrow@hey.com>

* Resolve build error with RTI Connext DDS 5.3.1 (#82)

Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Changelog.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* 0.11.1

* Use destinct callbacks for each event type

---------

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Audrow Nash <audrow@hey.com>
Signed-off-by: Andrea Sorbini <asorbini@rti.com>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Co-authored-by: Chen Lihui <lihui.chen@sony.com>
Co-authored-by: Andrea Sorbini <asorbini@rti.com>
Co-authored-by: mauropasse <mauropasse@hotmail.com>
Co-authored-by: Jacob Perron <jacob@openrobotics.org>
Co-authored-by: Audrow Nash <audrow@hey.com>
Co-authored-by: Steven! Ragnarök <nuclearsandwich@users.noreply.github.com>
Co-authored-by: Steven! Ragnarök <steven@nuclearsandwich.com>
Co-authored-by: iRobot ROS <49500531+irobot-ros@users.noreply.github.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Alberto Soragna <alberto.soragna@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
14 people authored Mar 30, 2023
1 parent 2dd4e92 commit 3a88dad
Show file tree
Hide file tree
Showing 31 changed files with 1,752 additions and 155 deletions.
15 changes: 15 additions & 0 deletions rmw_connextdds/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
Changelog for package rmw_connextdds
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.11.1 (2022-04-26)
-------------------

0.11.0 (2022-04-08)
-------------------
* Exclude missing sample info fields when building rmw_connextddsmicro (`#79 <https://github.com/ros2/rmw_connextdds/issues/79>`_)
* Update launch_testing_ros output filter prefixes for Connext6 (`#80 <https://github.com/ros2/rmw_connextdds/issues/80>`_)
* Contributors: Andrea Sorbini, Ivan Santiago Paunovic

0.10.0 (2022-03-28)
-------------------
* Add support for user-specified content filters (`#68 <https://github.com/ros2/rmw_connextdds/issues/68>`_)
* add stub for content filtered topic (`#77 <https://github.com/ros2/rmw_connextdds/issues/77>`_)
* Contributors: Andrea Sorbini, Chen Lihui, Ivan Santiago Paunovic

0.9.0 (2022-03-01)
------------------
* Add rmw listener apis (`#44 <https://github.com/rticommunity/rmw_connextdds/issues/44>`_)
Expand Down
2 changes: 1 addition & 1 deletion rmw_connextdds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ ament_package(
)

ament_index_register_resource("rmw_output_prefixes"
CONTENT "RTI Data Distribution Service\nExpires on")
CONTENT "RTI Data Distribution Service\nRTI Connext DDS\nExpires on")
2 changes: 1 addition & 1 deletion rmw_connextdds/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rmw_connextdds</name>
<version>0.9.0</version>
<version>0.11.1</version>
<description>A ROS2 RMW implementation built with RTI Connext DDS Professional.</description>
<maintainer email="asorbini@rti.com">Andrea Sorbini</maintainer>
<license>Apache License 2.0</license>
Expand Down
37 changes: 37 additions & 0 deletions rmw_connextdds/src/rmw_api_impl_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,24 @@ rmw_subscription_get_actual_qos(
return rmw_api_connextdds_subscription_get_actual_qos(subscription, qos);
}

rmw_ret_t
rmw_subscription_set_content_filter(
rmw_subscription_t * subscription,
const rmw_subscription_content_filter_options_t * options)
{
return rmw_api_connextdds_subscription_set_content_filter(
subscription, options);
}

rmw_ret_t
rmw_subscription_get_content_filter(
const rmw_subscription_t * subscription,
rcutils_allocator_t * allocator,
rmw_subscription_content_filter_options_t * options)
{
return rmw_api_connextdds_subscription_get_content_filter(
subscription, allocator, options);
}

rmw_ret_t
rmw_destroy_subscription(
Expand Down Expand Up @@ -937,3 +955,22 @@ rmw_subscription_get_network_flow_endpoints(
allocator,
network_flow_endpoint_array);
}

/******************************************************************************
* Feature support functions
******************************************************************************/
bool
rmw_feature_supported(rmw_feature_t feature)
{
switch (feature) {
case RMW_FEATURE_MESSAGE_INFO_RECEPTION_SEQUENCE_NUMBER:
case RMW_FEATURE_MESSAGE_INFO_PUBLICATION_SEQUENCE_NUMBER:
{
return true;
}
default:
{
return false;
}
}
}
18 changes: 18 additions & 0 deletions rmw_connextdds_common/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
Changelog for package rmw_connextdds_common
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.11.1 (2022-04-26)
-------------------
* Resolve build error with RTI Connext DDS 5.3.1 (`#82 <https://github.com/ros2/rmw_connextdds/issues/82>`_)
* Contributors: Andrea Sorbini

0.11.0 (2022-04-08)
-------------------
* Exclude missing sample info fields when building rmw_connextddsmicro (`#79 <https://github.com/ros2/rmw_connextdds/issues/79>`_)
* Properly initialize CDR stream before using it for filtering (`#81 <https://github.com/ros2/rmw_connextdds/issues/81>`_)
* Contributors: Andrea Sorbini

0.10.0 (2022-03-28)
-------------------
* Add support for user-specified content filters (`#68 <https://github.com/ros2/rmw_connextdds/issues/68>`_)
* add stub for content filtered topic (`#77 <https://github.com/ros2/rmw_connextdds/issues/77>`_)
* Add sequence numbers to message info structure (`#74 <https://github.com/ros2/rmw_connextdds/issues/74>`_)
* Contributors: Andrea Sorbini, Chen Lihui, Ivan Santiago Paunovic

0.9.0 (2022-03-01)
------------------
* Add rmw listener apis (`#44 <https://github.com/rticommunity/rmw_connextdds/issues/44>`_)
Expand Down
11 changes: 11 additions & 0 deletions rmw_connextdds_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ function(rtirmw_add_library)
ament_target_dependencies(${_rti_build_NAME}
${_rti_build_DEPS})

set(_extra_defines)
if("${CMAKE_BUILD_TYPE}" MATCHES "[dD]ebug")
list(APPEND _extra_defines "RMW_CONNEXT_DEBUG=1")
endif()

target_compile_definitions(${_rti_build_NAME}
PUBLIC
RMW_VERSION_MAJOR=${rmw_VERSION_MAJOR}
RMW_VERSION_MINOR=${rmw_VERSION_MINOR}
RMW_VERSION_PATCH=${rmw_VERSION_PATCH}
RMW_CONNEXT_DDS_API=RMW_CONNEXT_DDS_API_${_rti_build_API}
${_rti_build_DEFINES}
${_extra_defines}
)

set(private_defines)
Expand Down Expand Up @@ -188,6 +194,9 @@ else()
if("${CONNEXTDDS_VERSION}" VERSION_LESS "6.0.0")
list(APPEND extra_defines "RMW_CONNEXT_DDS_API_PRO_LEGACY=1")
endif()
if(CONNEXTDDS_ARCH MATCHES ".*Win.*")
list(APPEND extra_defines "RMW_CONNEXT_BUILTIN_CFT_COMPATIBILITY_MODE=1")
endif()
rtirmw_add_library(
NAME ${PROJECT_NAME}_pro
API PRO
Expand All @@ -196,8 +205,10 @@ else()
src/ndds/rmw_type_support_ndds.cpp
src/ndds/rmw_typecode.cpp
src/ndds/dds_api_ndds.cpp
src/ndds/custom_sql_filter.cpp
include/rmw_connextdds/typecode.hpp
include/rmw_connextdds/dds_api_ndds.hpp
include/rmw_connextdds/custom_sql_filter.hpp
DEPS ${RMW_CONNEXT_DEPS}
LIBRARIES RTIConnextDDS::c_api
DEFINES ${extra_defines})
Expand Down
66 changes: 66 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/custom_sql_filter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2021 Real-Time Innovations, Inc. (RTI)
//
// 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_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_
#define RMW_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_

#include "rmw_connextdds/dds_api.hpp"

#if RMW_CONNEXT_DDS_API == RMW_CONNEXT_DDS_API_PRO

namespace rti_connext_dds_custom_sql_filter
{

struct CustomSqlFilterData
{
DDS_SqlFilterGeneratorQos base;

CustomSqlFilterData();

DDS_ReturnCode_t
set_memory_management_property(
const DDS_DomainParticipantQos & dp_qos);
};

RMW_CONNEXTDDS_PUBLIC
DDS_ReturnCode_t
register_content_filter(
DDS_DomainParticipant * const participant,
CustomSqlFilterData * const filter_data);

RMW_CONNEXTDDS_PUBLIC
extern const char * const PLUGIN_NAME;

} // namespace rti_connext_dds_custom_sql_filter

#if !RMW_CONNEXT_BUILTIN_CFT_COMPATIBILITY_MODE
extern "C" {
// This is an internal function from RTI Connext DDS which allows a filter to
// be registered as "built-in". We need this because we want this custom filter
// to be a replacement for the built-in SQL-like filter.
RMW_CONNEXTDDS_PUBLIC
DDS_ReturnCode_t
DDS_ContentFilter_register_filter(
DDS_DomainParticipant * participant,
const char * name,
const struct DDS_ContentFilter * filter,
const DDS_ContentFilterEvaluateFunction evaluateOnSerialized,
const DDS_ContentFilterWriterEvaluateFunction writerEvaluateOnSerialized,
const DDS_ContentFilterQueryFunction query,
DDS_Boolean isBuiltin);
}
#endif // RMW_CONNEXT_BUILTIN_CFT_COMPATIBILITY_MODE

#endif // RMW_CONNEXT_DDS_API == RMW_CONNEXT_DDS_API_PRO

#endif // RMW_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_
18 changes: 18 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/dds_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ rmw_connextdds_initialize_participant_qos_impl(
rmw_context_impl_t * const ctx,
DDS_DomainParticipantQos * const dp_qos);

rmw_ret_t
rmw_connextdds_configure_participant(
rmw_context_impl_t * const ctx,
DDS_DomainParticipant * const participant);

rmw_ret_t
rmw_connextdds_create_contentfilteredtopic(
rmw_context_impl_t * const ctx,
DDS_DomainParticipant * const dp,
DDS_Topic * const base_topic,
const char * const cft_name,
const char * const cft_filter,
const rcutils_string_array_t * const cft_expression_parameters,
DDS_TopicDescription ** const cft_out);

rmw_ret_t
Expand Down Expand Up @@ -263,4 +269,16 @@ rmw_connextdds_enable_security(
DDS_SECURITY_PROPERTY_PREFIX ".logging.log_level"
#endif /* DDS_SECURITY_LOGGING_LEVEL_PROPERTY */

rmw_ret_t
rmw_connextdds_set_cft_filter_expression(
DDS_TopicDescription * const topic_desc,
const char * const cft_expression,
const rcutils_string_array_t * const cft_expression_parameters);

rmw_ret_t
rmw_connextdds_get_cft_filter_expression(
DDS_TopicDescription * const topic_desc,
rcutils_allocator_t * const allocator,
rmw_subscription_content_filter_options_t * const options);

#endif // RMW_CONNEXTDDS__DDS_API_HPP_
12 changes: 0 additions & 12 deletions rmw_connextdds_common/include/rmw_connextdds/dds_api_ndds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@

#include "rcutils/types.h"

DDS_SEQUENCE(RMW_Connext_Uint8ArrayPtrSeq, rcutils_uint8_array_t *);

typedef RMW_Connext_Uint8ArrayPtrSeq RMW_Connext_UntypedSampleSeq;

#define RMW_Connext_UntypedSampleSeq_INITIALIZER DDS_SEQUENCE_INITIALIZER

#define DDS_UntypedSampleSeq_get_reference(seq_, i_) \
*RMW_Connext_Uint8ArrayPtrSeq_get_reference(seq_, i_)

#define DDS_UntypedSampleSeq_get_length(seq_) \
RMW_Connext_Uint8ArrayPtrSeq_get_length(seq_)

#if RMW_CONNEXT_DDS_API_PRO_LEGACY
#ifndef RTIXCdrLong_MAX
#define RTIXCdrLong_MAX 2147483647
Expand Down
21 changes: 21 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/rmw_api_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "rmw_connextdds/context.hpp"

#include "rmw/features.h"

/*****************************************************************************
* Context API
*****************************************************************************/
Expand Down Expand Up @@ -481,6 +483,18 @@ rmw_api_connextdds_subscription_get_actual_qos(
const rmw_subscription_t * subscription,
rmw_qos_profile_t * qos);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_subscription_set_content_filter(
rmw_subscription_t * subscription,
const rmw_subscription_content_filter_options_t * options);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_subscription_get_content_filter(
const rmw_subscription_t * subscription,
rcutils_allocator_t * const allocator,
rmw_subscription_content_filter_options_t * options);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
Expand Down Expand Up @@ -637,4 +651,11 @@ rmw_api_connextdds_subscription_get_network_flow_endpoints(
rcutils_allocator_t * allocator,
rmw_network_flow_endpoint_array_t * network_flow_endpoint_array);

/******************************************************************************
* Feature support functions
******************************************************************************/
RMW_CONNEXTDDS_PUBLIC
bool
rmw_api_connextdds_feature_supported(rmw_feature_t feature);

#endif // RMW_CONNEXTDDS__RMW_API_IMPL_HPP_
22 changes: 22 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/rmw_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ class RMW_Connext_Subscriber
rmw_message_info_t * const message_info,
bool * const taken);

rmw_ret_t
set_content_filter(
const rmw_subscription_content_filter_options_t * const options);

rmw_ret_t
get_content_filter(
rcutils_allocator_t * allocator,
rmw_subscription_content_filter_options_t * const options);

bool
has_data()
{
Expand Down Expand Up @@ -494,6 +503,17 @@ class RMW_Connext_Subscriber
return this->dds_topic;
}

static std::string get_atomic_id()
{
static std::atomic_uint64_t id;
return std::to_string(id++);
}

bool is_cft_enabled()
{
return !this->cft_expression.empty();
}

const bool internal;
const bool ignore_local;

Expand All @@ -502,6 +522,7 @@ class RMW_Connext_Subscriber
DDS_DataReader * dds_reader;
DDS_Topic * dds_topic;
DDS_TopicDescription * dds_topic_cft;
std::string cft_expression;
RMW_Connext_MessageTypeSupport * type_support;
rmw_gid_t ros_gid;
const bool created_topic;
Expand All @@ -520,6 +541,7 @@ class RMW_Connext_Subscriber
const bool ignore_local,
const bool created_topic,
DDS_TopicDescription * const dds_topic_cft,
const char * const cft_expression,
const bool internal);

friend class RMW_Connext_SubscriberStatusCondition;
Expand Down
Loading

0 comments on commit 3a88dad

Please sign in to comment.