Skip to content

Commit

Permalink
Release v2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Acuadros95 committed Jul 10, 2023
2 parents 9311555 + f3f704e commit 40954c2
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 13 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ option(UAGENT_SECURITY_PROFILE "Build security profile." OFF)
option(UAGENT_BUILD_EXECUTABLE "Build Micro XRCE-DDS Agent provided executable." ON)
option(UAGENT_BUILD_USAGE_EXAMPLES "Build Micro XRCE-DDS Agent built-in usage examples" OFF)

set(UAGENT_P2P_CLIENT_VERSION 2.4.0 CACHE STRING "Sets Micro XRCE-DDS client version for P2P")
set(UAGENT_P2P_CLIENT_TAG v2.4.0 CACHE STRING "Sets Micro XRCE-DDS client tag for P2P")
set(UAGENT_P2P_CLIENT_VERSION 2.4.1 CACHE STRING "Sets Micro XRCE-DDS client version for P2P")
set(UAGENT_P2P_CLIENT_TAG v2.4.1 CACHE STRING "Sets Micro XRCE-DDS client tag for P2P")

option(UAGENT_BUILD_CI_TESTS "Build CI test cases.")
if(UAGENT_BUILD_CI_TESTS)
Expand Down Expand Up @@ -80,8 +80,8 @@ set(_deps "")
if(UAGENT_USE_SYSTEM_FASTCDR)
set(_fastcdr_version 1)
else()
set(_fastcdr_version 1.0.27)
set(_fastcdr_tag v1.0.27)
set(_fastcdr_version 1.1.0)
set(_fastcdr_tag v1.1.0)
endif()
list(APPEND _deps "fastcdr\;${_fastcdr_version}")

Expand All @@ -95,8 +95,8 @@ if(UAGENT_FAST_PROFILE)
if(UAGENT_USE_SYSTEM_FASTDDS)
set(_fastdds_version 2)
else()
set(_fastdds_version 2.10)
set(_fastdds_tag 2.10.x)
set(_fastdds_version 2.11)
set(_fastdds_tag 2.11.x)
set(_foonathan_memory_tag v0.7-3) # This tag should be updated every time it gets updated in foonathan_memory_vendor eProsima's package
endif()
list(APPEND _deps "fastrtps\;${_fastdds_version}")
Expand All @@ -117,7 +117,7 @@ endif()
###############################################################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
if(NOT UAGENT_SUPERBUILD)
project(microxrcedds_agent VERSION "2.4.0" LANGUAGES C CXX)
project(microxrcedds_agent VERSION "2.4.1" LANGUAGES C CXX)
else()
project(uagent_superbuild NONE)
include(${PROJECT_SOURCE_DIR}/cmake/SuperBuild.cmake)
Expand Down
5 changes: 4 additions & 1 deletion include/uxr/agent/middleware/Middleware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include <functional>
#include <chrono>

#define UXR_CLIENT_DOMAIN_ID_TO_USE_FROM_REF (255)
#define UXR_CLIENT_DOMAIN_ID_TO_OVERRIDE_WITH_ENV (255)

namespace eprosima {
namespace uxr {

Expand Down Expand Up @@ -296,7 +299,7 @@ class Middleware
/**********************************************************************************************************************
* Members.
**********************************************************************************************************************/
protected:
protected:
bool intraprocess_enabled_;
};

Expand Down
3 changes: 3 additions & 0 deletions include/uxr/agent/middleware/fastdds/FastDDSMiddleware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ class FastDDSMiddleware : public Middleware
std::shared_ptr<FastDDSParticipant>& participant,
const fastrtps::ReplierAttributes& attrs);

int16_t get_domain_id_from_env();

int16_t agent_domain_id_ = 0;
std::unordered_map<uint16_t, std::shared_ptr<FastDDSParticipant>> participants_;
std::unordered_map<uint16_t, std::shared_ptr<FastDDSTopic>> topics_;
std::unordered_map<uint16_t, std::shared_ptr<FastDDSPublisher>> publishers_;
Expand Down
8 changes: 6 additions & 2 deletions src/cpp/middleware/fast/FastMiddleware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ bool FastMiddleware::create_participant_by_ref(
fastrtps::ParticipantAttributes attrs;
if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(ref, attrs))
{
attrs.domainId = uint32_t(domain_id);
if(domain_id != UXR_CLIENT_DOMAIN_ID_TO_USE_FROM_REF) {
attrs.domainId = domain_id;
}
fastrtps::Participant* impl = fastrtps::Domain::createParticipant(attrs, &listener_);
if (nullptr != impl)
{
Expand Down Expand Up @@ -773,7 +775,9 @@ bool FastMiddleware::matched_participant_from_ref(
fastrtps::ParticipantAttributes attrs;
if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(ref, attrs))
{
attrs.domainId = uint32_t(domain_id);
if(domain_id != UXR_CLIENT_DOMAIN_ID_TO_USE_FROM_REF) {
attrs.domainId = domain_id;
}
rv = it->second->match(attrs);
}
}
Expand Down
46 changes: 43 additions & 3 deletions src/cpp/middleware/fastdds/FastDDSMiddleware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <uxr/agent/middleware/fastdds/FastDDSMiddleware.hpp>
#include <uxr/agent/utils/Conversion.hpp>
#include <uxr/agent/logger/Logger.hpp>

#include <fastrtps/xmlparser/XMLProfileManager.h>
#include <fastdds/dds/subscriber/SampleInfo.hpp>
Expand Down Expand Up @@ -51,6 +52,14 @@ FastDDSMiddleware::FastDDSMiddleware(bool intraprocess_enabled)
, repliers_()
, callback_factory_(callback_factory_.getInstance())
{
agent_domain_id_ = get_domain_id_from_env();
if (agent_domain_id_)
{
UXR_AGENT_LOG_INFO(
UXR_DECORATE_GREEN("Micro XRCE-DDS Agent DOMAIN_ID read from env"),
"domain_id: {}", agent_domain_id_);
}

}

/**********************************************************************************************************************
Expand All @@ -62,7 +71,13 @@ bool FastDDSMiddleware::create_participant_by_ref(
const std::string& ref)
{
bool rv = false;
std::shared_ptr<FastDDSParticipant> participant(new FastDDSParticipant(domain_id));
fastrtps::ParticipantAttributes attrs;
auto participant_domain_id = domain_id;
if(domain_id == UXR_CLIENT_DOMAIN_ID_TO_USE_FROM_REF && XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(ref, attrs))
{
participant_domain_id = static_cast<int16_t>(attrs.domainId);
}
std::shared_ptr<FastDDSParticipant> participant(new FastDDSParticipant(participant_domain_id));
if (participant->create_by_ref(ref))
{
auto emplace_res = participants_.emplace(participant_id, std::move(participant));
Expand Down Expand Up @@ -102,8 +117,17 @@ bool FastDDSMiddleware::create_participant_by_bin(
uint16_t participant_id,
const dds::xrce::OBJK_DomainParticipant_Binary& participant_xrce)
{
auto participant_domain_id = static_cast<int16_t>(participant_xrce.domain_id());
if(participant_domain_id == UXR_CLIENT_DOMAIN_ID_TO_OVERRIDE_WITH_ENV){
participant_domain_id = agent_domain_id_;
UXR_AGENT_LOG_WARN(
UXR_DECORATE_YELLOW("Overriding Micro XRCE-DDS Client DOMAIN_ID"),
"domain_id: {}", participant_domain_id
);
}

bool rv = false;
std::shared_ptr<FastDDSParticipant> participant(new FastDDSParticipant((int16_t) participant_xrce.domain_id()));
std::shared_ptr<FastDDSParticipant> participant(new FastDDSParticipant(participant_domain_id));
if (participant->create_by_bin(participant_xrce))
{
auto emplace_res = participants_.emplace(participant_id, std::move(participant));
Expand Down Expand Up @@ -986,7 +1010,13 @@ bool FastDDSMiddleware::matched_participant_from_ref(
auto it = participants_.find(participant_id);
if (participants_.end() != it)
{
rv = (domain_id == it->second->domain_id()) && (it->second->match_from_ref(ref));
fastrtps::ParticipantAttributes attrs;
auto participant_domain_id = domain_id;
if(domain_id == UXR_CLIENT_DOMAIN_ID_TO_USE_FROM_REF && XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(ref, attrs))
{
participant_domain_id = static_cast<int16_t>(attrs.domainId);
}
rv = (participant_domain_id== it->second->domain_id()) && (it->second->match_from_ref(ref));
}
return rv;
}
Expand Down Expand Up @@ -1230,5 +1260,15 @@ bool FastDDSMiddleware::matched_replier_from_bin(
return rv;
}

int16_t FastDDSMiddleware::get_domain_id_from_env(){
int16_t agent_domain_id = 0;
const char * agent_domain_id_env = std::getenv( "XRCE_DOMAIN_ID_OVERRIDE" );
if (nullptr != agent_domain_id_env)
{
agent_domain_id = static_cast<int16_t>(std::atoi(agent_domain_id_env));
}
return agent_domain_id;
}

} // namespace uxr
} // namespace eprosima

0 comments on commit 40954c2

Please sign in to comment.