Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XML files to describe built-in QoS configuration #42

Open
wants to merge 15 commits into
base: rolling
Choose a base branch
from
Open
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
1,508 changes: 1,465 additions & 43 deletions README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions rmw_connextdds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ install(
RUNTIME DESTINATION bin
)

install(
FILES
resource/xml/ros2_qos_profiles.xml
resource/xml/USER_QOS_PROFILES.example.xml
DESTINATION share/${PROJECT_NAME}/xml
)

ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(rmw_connextdds_common)

Expand Down
91 changes: 91 additions & 0 deletions rmw_connextdds/env_hook/rmw_connextdds_resources.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
################################################################################
# (c) 2021 Copyright, 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.
################################################################################
#
# This file was automatically generated from template
# `rmw_connextdds/env_hook/rmw_connextdds_resources.sh.in`
#
# The script will perform the following environment customizations:
#
# - Extend variable NDDS_QOS_PROFILES to load `ros2_qos_profiles.xml`.
#
################################################################################

################################################################################
# Determine path to rmw_connextdds' share/ directory
################################################################################
_rmw_connextdds_find_sharedir()
{
(
IFS=":"
for pfx_dir in ${AMENT_PREFIX_PATH}; do
sharedir="${pfx_dir}/share/rmw_connextdds"
if [ -d "${sharedir}" ]; then
cd "${sharedir}" && pwd
break
fi
done
)
}

_rmw_connextdds_dir="$(_rmw_connextdds_find_sharedir)"
_rmw_connextdds_xml_dir="${_rmw_connextdds_dir}/xml"

_ros2_qos_profiles="${_rmw_connextdds_xml_dir}/ros2_qos_profiles.xml"

################################################################################
# Update NDDS_QOS_PROFILES
################################################################################
_rmw_connextdds_append_profile()
{
local already_added=$(
IFS=";"
for qos_profile_pfx in ${NDDS_QOS_PROFILES}; do
qos_profile="${qos_profile_pfx#file://}"
qos_profile_dir=$(dirname ${qos_profile})
qos_profile_name=$(basename ${qos_profile})
cd ${qos_profile_dir} || continue
if [ "$(pwd)" = "${_rmw_connextdds_xml_dir}" -a \
"${qos_profile_name}" = "ros2_qos_profiles.xml" ]; then
printf "%s" "${qos_profile}"
break;
fi
done
) 2>/dev/null

if [ -z "${NDDS_QOS_PROFILES}" ]; then
export NDDS_QOS_PROFILES="file://${_ros2_qos_profiles}"
elif [ -z "${already_added}" ]; then
export NDDS_QOS_PROFILES="${NDDS_QOS_PROFILES};file://${_ros2_qos_profiles}"
fi

export RMW_CONNEXT_QOS_PROFILES="${_ros2_qos_profiles}"
}

if [ ! -f "${_ros2_qos_profiles}" ]; then
printf "[@PROJECT_NAME@][WARNING] file ros2_qos_profiles.xml NOT FOUND\n" 1>&2
printf "[@PROJECT_NAME@][WARNING] Custom built-in QoS profiles will not be available, unless you manually load them into the enviroment with variable NDDS_QOS_PROFILES.\n" 1>&2
else
_rmw_connextdds_append_profile
fi

################################################################################
# Clean up environment
################################################################################
unset _rmw_connextdds_dir \
_rmw_connextdds_xml_dir \
_ros2_qos_profiles \
_rmw_connextdds_append_profile \
_rmw_connextdds_find_sharedir
25 changes: 25 additions & 0 deletions rmw_connextdds/resource/xml/USER_QOS_PROFILES.example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/5.3.1/rti_dds_qos_profiles.xsd" version="5.3.1">
<qos_library name="my_application">
<qos_profile name="my_process" is_default_qos="true" base_name="ROS2QoS::rmw_connextdds.base_application">
<datareader_qos topic_filter="rt/chatter">
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<history>
<kind>KEEP_LAST_HISTORY_QOS</kind>
<depth>10</depth>
</history>
</datareader_qos>
<datawriter_qos topic_filter="rt/chatter">
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<history>
<kind>KEEP_LAST_HISTORY_QOS</kind>
<depth>7</depth>
</history>
</datawriter_qos>
</qos_profile>
</qos_library>
</dds>
Loading