Skip to content

Commit

Permalink
* Add QoS profile API.
Browse files Browse the repository at this point in the history
* Use time utils from rmw_dds_common when available.
  • Loading branch information
asorbini committed Mar 5, 2021
1 parent fac1c1b commit 91753dc
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 4 deletions.
22 changes: 22 additions & 0 deletions rmw_connextdds/src/rmw_api_impl_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,25 @@ rmw_wait(
return rmw_api_connextdds_wait(
subs, gcs, srvs, cls, evs, wait_set, wait_timeout);
}


/******************************************************************************
* QoS Profile functions
******************************************************************************/
#if RMW_CONNEXT_HAVE_QOS_PROFILE_API
rmw_ret_t
rmw_qos_profile_check_compatible(
const rmw_qos_profile_t publisher_profile,
const rmw_qos_profile_t subscription_profile,
rmw_qos_compatibility_type_t * compatibility,
char * reason,
size_t reason_size)
{
return rmw_api_connextdds_qos_profile_check_compatible(
publisher_profile,
subscription_profile,
compatibility,
reason,
reason_size);
}
#endif /* RMW_CONNEXT_HAVE_QOS_PROFILE_API */
1 change: 1 addition & 0 deletions rmw_connextdds_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ set(RMW_CONNEXT_COMMON_SOURCE_CPP
src/common/rmw_info.cpp
src/common/rmw_node.cpp
src/common/rmw_publication.cpp
src/common/rmw_qos.cpp
src/common/rmw_serde.cpp
src/common/rmw_service.cpp
src/common/rmw_subscription.cpp
Expand Down
5 changes: 5 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
#include "rmw_connextdds_common/msg/participant_entities_info.hpp"
#endif /* RMW_CONNEXT_HAVE_PKG_RMW_DDS_COMMON */

#if RMW_CONNEXT_HAVE_QOS_PROFILE_API
#include "rmw/qos_profiles.h"
#include "rmw_dds_common/qos.hpp"
#endif /* RMW_CONNEXT_HAVE_QOS_PROFILE_API */

#include "rcutils/strdup.h"

#if RMW_CONNEXT_HAVE_SCOPE_EXIT
Expand Down
13 changes: 13 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 @@ -604,5 +604,18 @@ rmw_api_connextdds_wait(
rmw_wait_set_t * wait_set,
const rmw_time_t * wait_timeout);

/******************************************************************************
* QoS Profile functions
******************************************************************************/
#if RMW_CONNEXT_HAVE_QOS_PROFILE_API
rmw_ret_t
rmw_api_connextdds_qos_profile_check_compatible(
const rmw_qos_profile_t publisher_profile,
const rmw_qos_profile_t subscription_profile,
rmw_qos_compatibility_type_t * compatibility,
char * reason,
size_t reason_size);
#endif /* RMW_CONNEXT_HAVE_QOS_PROFILE_API */


#endif // RMW_CONNEXTDDS__RMW_API_IMPL_HPP_
10 changes: 10 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/static_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,16 @@
(RMW_CONNEXT_RELEASE >= RMW_CONNEXT_RELEASE_DASHING)
#endif /* RMW_CONNEXT_HAVE_INTRO_TYPE_SUPPORT */

#ifndef RMW_CONNEXT_HAVE_QOS_PROFILE_API
#define RMW_CONNEXT_HAVE_QOS_PROFILE_API \
(RMW_CONNEXT_RELEASE > RMW_CONNEXT_RELEASE_FOXY)
#endif /* RMW_CONNEXT_HAVE_INTRO_TYPE_SUPPORT */

#ifndef RMW_CONNEXT_HAVE_TIME_UTILS
#define RMW_CONNEXT_HAVE_TIME_UTILS \
(RMW_CONNEXT_RELEASE > RMW_CONNEXT_RELEASE_FOXY)
#endif /* RMW_CONNEXT_HAVE_TIME_UTILS */

#include "resource_limits.hpp"

#endif // RMW_CONNEXTDDS__STATIC_CONFIG_HPP_
18 changes: 14 additions & 4 deletions rmw_connextdds_common/src/common/rmw_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include "rmw_connextdds/graph_cache.hpp"

#if RMW_CONNEXT_HAVE_TIME_UTILS
#include "rmw_dds_common/time_utils.hpp"
#endif /* RMW_CONNEXT_HAVE_TIME_UTILS */

#define ROS_SERVICE_REQUESTER_PREFIX_STR "rq"
#define ROS_SERVICE_RESPONSE_PREFIX_STR "rr"

Expand All @@ -34,10 +38,16 @@ rmw_connextdds_duration_from_ros_time(
DDS_Duration_t * const duration,
const rmw_time_t * const ros_time)
{
// TODO(asorbini) This function ignores possible overflows which
// occur if (ros_time->sec > INT32_MAX || ros_time->nsec > UINT32_MAX)
duration->sec = static_cast<DDS_Long>(ros_time->sec);
duration->nanosec = static_cast<DDS_UnsignedLong>(ros_time->nsec);
#if RMW_CONNEXT_HAVE_TIME_UTILS
rmw_time_t in_time = rmw_dds_common::clamp_rmw_time_to_dds_time(*ros_time);
#else
// TODO(asorbini) In older versions, this function ignores possible overflows
// which occur if (ros_time->sec > INT32_MAX || ros_time->nsec > UINT32_MAX)
rmw_time_t in_time = *ros_time;
#endif /* RMW_CONNEXT_HAVE_TIME_UTILS */

duration->sec = static_cast<DDS_Long>(in_time.sec);
duration->nanosec = static_cast<DDS_UnsignedLong>(in_time.nsec);
return RMW_RET_OK;
}

Expand Down
32 changes: 32 additions & 0 deletions rmw_connextdds_common/src/common/rmw_qos.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2020 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.

#include "rmw_connextdds/rmw_impl.hpp"

/******************************************************************************
* QoS Profile functions
******************************************************************************/
#if RMW_CONNEXT_HAVE_QOS_PROFILE_API
rmw_ret_t
rmw_api_connextdds_qos_profile_check_compatible(
const rmw_qos_profile_t publisher_profile,
const rmw_qos_profile_t subscription_profile,
rmw_qos_compatibility_type_t * compatibility,
char * reason,
size_t reason_size)
{
return rmw_dds_common::qos_profile_check_compatible(
publisher_profile, subscription_profile, compatibility, reason, reason_size);
}
#endif /* RMW_CONNEXT_HAVE_QOS_PROFILE_API */
21 changes: 21 additions & 0 deletions rmw_connextddsmicro/src/rmw_api_impl_rtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,24 @@ rmw_wait(
return rmw_api_connextdds_wait(
subs, gcs, srvs, cls, evs, wait_set, wait_timeout);
}

/******************************************************************************
* QoS Profile functions
******************************************************************************/
#if RMW_CONNEXT_HAVE_QOS_PROFILE_API
rmw_ret_t
rmw_qos_profile_check_compatible(
const rmw_qos_profile_t publisher_profile,
const rmw_qos_profile_t subscription_profile,
rmw_qos_compatibility_type_t * compatibility,
char * reason,
size_t reason_size)
{
return rmw_api_connextdds_qos_profile_check_compatible(
publisher_profile,
subscription_profile,
compatibility,
reason,
reason_size);
}
#endif /* RMW_CONNEXT_HAVE_QOS_PROFILE_API */

0 comments on commit 91753dc

Please sign in to comment.