mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 18:05:17 +02:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c248aea28 | ||
|
|
4a750220d2 | ||
|
|
b5a0d0b6ee | ||
|
|
114a043ee2 | ||
|
|
b0ebf5ab3f |
+10
-10
@@ -3,27 +3,27 @@ name: CI micro-ROS Agent
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- 'jazzy'
|
- 'humble'
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '33 6 * * *'
|
- cron: '33 6 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
microros_agent_ci:
|
microros_agent_ci:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-latest ]
|
os: [ ubuntu-20.04 ]
|
||||||
ros_distribution: [ jazzy ]
|
ros_distribution: [ humble ]
|
||||||
include:
|
include:
|
||||||
- docker_image: ubuntu:24.04
|
- docker_image: ubuntu:jammy
|
||||||
ros_distribution: jazzy
|
ros_distribution: humble
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.docker_image }}
|
image: ubuntu:jammy
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v2
|
||||||
- uses: ros-tooling/setup-ros@0.7.13
|
- uses: ros-tooling/setup-ros@0.3.2
|
||||||
with:
|
with:
|
||||||
use-ros2-testing: false
|
use-ros2-testing: false
|
||||||
required-ros-distributions: ${{ matrix.ros_distribution }}
|
required-ros-distributions: ${{ matrix.ros_distribution }}
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
apt-get install ros-${{ matrix.ros_distribution }}-micro-ros-msgs
|
apt-get install ros-${{ matrix.ros_distribution }}-micro-ros-msgs
|
||||||
apt-get install ros-${{ matrix.ros_distribution }}-rmw-fastrtps-cpp
|
apt-get install ros-${{ matrix.ros_distribution }}-rmw-fastrtps-cpp
|
||||||
- uses : ros-tooling/action-ros-ci@0.4.3
|
- uses : ros-tooling/action-ros-ci@0.2.5
|
||||||
with:
|
with:
|
||||||
package-name: "micro_ros_agent"
|
package-name: "micro_ros_agent"
|
||||||
target-ros2-distro: ${{ matrix.ros_distribution }}
|
target-ros2-distro: ${{ matrix.ros_distribution }}
|
||||||
|
|||||||
@@ -2,30 +2,7 @@
|
|||||||
Changelog for package micro-ros_agent
|
Changelog for package micro-ros_agent
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
5.0.2 (2024-05-31)
|
3.0.2 (2022-05-25)
|
||||||
------------------
|
|
||||||
* Jazzy Release
|
|
||||||
* Bump Micro XRCE-DDS Agent (`#226 <https://github.com/micro-ROS/micro-ROS-Agent/issues/226>`_)
|
|
||||||
|
|
||||||
5.0.1 (2024-01-29)
|
|
||||||
------------------
|
|
||||||
* Fix thread include (`#216 <https://github.com/micro-ROS/micro-ROS-Agent/issues/216>`_) (`#218 <https://github.com/micro-ROS/micro-ROS-Agent/issues/218>`_)
|
|
||||||
|
|
||||||
5.0.0 (2023-06-06)
|
|
||||||
------------------
|
|
||||||
* Add empty type key hash to GraphCache (`#189 <https://github.com/micro-ROS/micro-ROS-Agent/issues/189>`_)
|
|
||||||
* Contributors: Antonio Cuadros
|
|
||||||
|
|
||||||
4.0.2 (2022-09-28)
|
|
||||||
------------------
|
|
||||||
* Fix Datawriter destruction (`#169 <https://github.com/micro-ROS/micro-ROS-Agent/issues/169>`_) (`#170 <https://github.com/micro-ROS/micro-ROS-Agent/issues/170>`_)
|
|
||||||
* Synchronise predicate (`#160 <https://github.com/micro-ROS/micro-ROS-Agent/issues/160>`_) (`#165 <https://github.com/micro-ROS/micro-ROS-Agent/issues/165>`_)
|
|
||||||
|
|
||||||
4.0.1 (2022-06-13)
|
|
||||||
------------------
|
|
||||||
* Fix memory leak in graph manager (`#147 <https://github.com/micro-ROS/micro-ROS-Agent/issues/147>`_) (`#148 <https://github.com/micro-ROS/micro-ROS-Agent/issues/148>`_)
|
|
||||||
|
|
||||||
4.0.0 (2022-05-25)
|
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
3.0.1 (2022-03-25)
|
3.0.1 (2022-03-25)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.11)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
option(UROSAGENT_GENERATE_PROFILE
|
option(UROSAGENT_GENERATE_PROFILE
|
||||||
"Generates agent.refs according to the .msgs provided in the .repos" OFF
|
"Generates agent.refs according to the .msgs provided in the .repos" OFF
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ if(NOT xrceagent_FOUND)
|
|||||||
GIT_REPOSITORY
|
GIT_REPOSITORY
|
||||||
https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||||
GIT_TAG
|
GIT_TAG
|
||||||
v2.4.3
|
ros2
|
||||||
PREFIX
|
PREFIX
|
||||||
${PROJECT_BINARY_DIR}/agent
|
${PROJECT_BINARY_DIR}/agent
|
||||||
INSTALL_DIR
|
INSTALL_DIR
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ private:
|
|||||||
|
|
||||||
eprosima::uxr::AgentInstance& xrce_dds_agent_instance_;
|
eprosima::uxr::AgentInstance& xrce_dds_agent_instance_;
|
||||||
std::map<eprosima::fastdds::dds::DomainId_t, std::shared_ptr<graph_manager::GraphManager>> graph_manager_map_;
|
std::map<eprosima::fastdds::dds::DomainId_t, std::shared_ptr<graph_manager::GraphManager>> graph_manager_map_;
|
||||||
|
std::string namespace_remapping = "";
|
||||||
|
|
||||||
std::shared_ptr<graph_manager::GraphManager> find_or_create_graph_manager(eprosima::fastdds::dds::DomainId_t domain_id);
|
std::shared_ptr<graph_manager::GraphManager> find_or_create_graph_manager(eprosima::fastdds::dds::DomainId_t domain_id);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,7 +65,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace uros {
|
namespace uros {
|
||||||
namespace agent {
|
namespace agent {
|
||||||
@@ -81,7 +80,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Default constructor.
|
* @brief Default constructor.
|
||||||
*/
|
*/
|
||||||
GraphManager(eprosima::fastdds::dds::DomainId_t domain_id);
|
GraphManager(eprosima::fastdds::dds::DomainId_t domain_id, std::string namespace_remapping);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default destructor.
|
* @brief Default destructor.
|
||||||
@@ -112,12 +111,6 @@ public:
|
|||||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||||
bool from_microros = true);
|
bool from_microros = true);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Getter for the graph cache.
|
|
||||||
* @return Reference to inner graph cache
|
|
||||||
*/
|
|
||||||
rmw_dds_common::GraphCache& get_graph_cache() { return graphCache_; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds a DDS datawriter to the graph tree.
|
* @brief Adds a DDS datawriter to the graph tree.
|
||||||
* @param datawriter_guid rtps::GUID_t of the datawriter to be added.
|
* @param datawriter_guid rtps::GUID_t of the datawriter to be added.
|
||||||
@@ -281,6 +274,7 @@ private:
|
|||||||
std::string& node_namespace);
|
std::string& node_namespace);
|
||||||
|
|
||||||
eprosima::fastdds::dds::DomainId_t domain_id_;
|
eprosima::fastdds::dds::DomainId_t domain_id_;
|
||||||
|
std::string namespace_remapping_;
|
||||||
bool graph_changed_;
|
bool graph_changed_;
|
||||||
bool display_on_change_;
|
bool display_on_change_;
|
||||||
std::thread microros_graph_publisher_;
|
std::thread microros_graph_publisher_;
|
||||||
@@ -306,7 +300,7 @@ private:
|
|||||||
// Store a auxiliary publishers and datawriter for each participant created in micro-ROS
|
// Store a auxiliary publishers and datawriter for each participant created in micro-ROS
|
||||||
std::map<
|
std::map<
|
||||||
const eprosima::fastdds::dds::DomainParticipant*,
|
const eprosima::fastdds::dds::DomainParticipant*,
|
||||||
eprosima::fastdds::dds::DataWriter*
|
std::unique_ptr<eprosima::fastdds::dds::DataWriter>
|
||||||
> micro_ros_graph_datawriters_;
|
> micro_ros_graph_datawriters_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||||
<package format="3">
|
<package format="3">
|
||||||
<name>micro_ros_agent</name>
|
<name>micro_ros_agent</name>
|
||||||
<version>5.0.2</version>
|
<version>3.0.2</version>
|
||||||
<description>micro-ROS Agent package</description>
|
<description>micro-ROS Agent package</description>
|
||||||
<maintainer email="eugeniocollado@eprosima.com">Eugenio Collado</maintainer>
|
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
|
||||||
<maintainer email="davidlaseca@eprosima.com">David Laseca</maintainer>
|
<maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer>
|
||||||
<license>Apache License 2.0</license>
|
<license>Apache License 2.0</license>
|
||||||
|
|
||||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ bool Agent::create(
|
|||||||
char** argv)
|
char** argv)
|
||||||
{
|
{
|
||||||
bool result = xrce_dds_agent_instance_.create(argc, argv);
|
bool result = xrce_dds_agent_instance_.create(argc, argv);
|
||||||
|
|
||||||
|
// Find namespace remapping
|
||||||
|
for (int i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(argv[i], "--namespace-remapping") == 0 && i + 1 < argc)
|
||||||
|
{
|
||||||
|
namespace_remapping = argv[i + 1];
|
||||||
|
std::cout << "Remapping all entities to namespace " << namespace_remapping << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -293,7 +304,6 @@ void Agent::run()
|
|||||||
|
|
||||||
std::shared_ptr<graph_manager::GraphManager> Agent::find_or_create_graph_manager(eprosima::fastdds::dds::DomainId_t domain_id)
|
std::shared_ptr<graph_manager::GraphManager> Agent::find_or_create_graph_manager(eprosima::fastdds::dds::DomainId_t domain_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto it = graph_manager_map_.find(domain_id);
|
auto it = graph_manager_map_.find(domain_id);
|
||||||
|
|
||||||
if (it != graph_manager_map_.end()) {
|
if (it != graph_manager_map_.end()) {
|
||||||
@@ -302,7 +312,7 @@ auto it = graph_manager_map_.find(domain_id);
|
|||||||
return graph_manager_map_.insert(
|
return graph_manager_map_.insert(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
domain_id,
|
domain_id,
|
||||||
std::make_shared<graph_manager::GraphManager>(domain_id)
|
std::make_shared<graph_manager::GraphManager>(domain_id, namespace_remapping)
|
||||||
)
|
)
|
||||||
).first->second;
|
).first->second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ namespace uros {
|
|||||||
namespace agent {
|
namespace agent {
|
||||||
namespace graph_manager {
|
namespace graph_manager {
|
||||||
|
|
||||||
GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
|
GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id, std::string namespace_remapping)
|
||||||
: domain_id_(domain_id)
|
: domain_id_(domain_id)
|
||||||
|
, namespace_remapping_(namespace_remapping)
|
||||||
, graph_changed_(false)
|
, graph_changed_(false)
|
||||||
, display_on_change_(false)
|
, display_on_change_(false)
|
||||||
, mtx_()
|
, mtx_()
|
||||||
@@ -125,11 +126,9 @@ GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
|
|||||||
|
|
||||||
// Set graph cache on change callback function
|
// Set graph cache on change callback function
|
||||||
graphCache_.set_on_change_callback([this]()
|
graphCache_.set_on_change_callback([this]()
|
||||||
{
|
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(this->mtx_);
|
std::unique_lock<std::mutex> lock(this->mtx_);
|
||||||
this->graph_changed_ = true;
|
this->graph_changed_ = true;
|
||||||
}
|
|
||||||
this->cv_.notify_one();
|
this->cv_.notify_one();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -146,7 +145,6 @@ inline void GraphManager::publish_microros_graph()
|
|||||||
{
|
{
|
||||||
return this->graph_changed_;
|
return this->graph_changed_;
|
||||||
});
|
});
|
||||||
graph_changed_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display_on_change_)
|
if (display_on_change_)
|
||||||
@@ -154,6 +152,7 @@ inline void GraphManager::publish_microros_graph()
|
|||||||
std::cout << "Updated uros Graph: graph changed" << std::endl;
|
std::cout << "Updated uros Graph: graph changed" << std::endl;
|
||||||
std::cout << graphCache_ << std::endl;
|
std::cout << graphCache_ << std::endl;
|
||||||
}
|
}
|
||||||
|
graph_changed_ = false;
|
||||||
|
|
||||||
micro_ros_msgs::msg::Graph graph_message;
|
micro_ros_msgs::msg::Graph graph_message;
|
||||||
|
|
||||||
@@ -315,6 +314,8 @@ void GraphManager::add_participant(
|
|||||||
std::string isolated_node_name, isolated_namespace;
|
std::string isolated_node_name, isolated_namespace;
|
||||||
get_name_and_namespace(qos.name().to_string(), isolated_node_name, isolated_namespace);
|
get_name_and_namespace(qos.name().to_string(), isolated_node_name, isolated_namespace);
|
||||||
|
|
||||||
|
isolated_namespace = namespace_remapping_ + isolated_namespace;
|
||||||
|
|
||||||
rmw_dds_common::msg::ParticipantEntitiesInfo info =
|
rmw_dds_common::msg::ParticipantEntitiesInfo info =
|
||||||
graphCache_.add_node(gid, isolated_node_name, isolated_namespace);
|
graphCache_.add_node(gid, isolated_node_name, isolated_namespace);
|
||||||
|
|
||||||
@@ -322,10 +323,11 @@ void GraphManager::add_participant(
|
|||||||
if (it == micro_ros_graph_datawriters_.end())
|
if (it == micro_ros_graph_datawriters_.end())
|
||||||
{
|
{
|
||||||
// Create datawriter
|
// Create datawriter
|
||||||
eprosima::fastdds::dds::DataWriter * datawriter = publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_);
|
std::unique_ptr<eprosima::fastdds::dds::DataWriter> datawriter;
|
||||||
|
datawriter.reset(publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_));
|
||||||
|
|
||||||
it = micro_ros_graph_datawriters_.insert(
|
it = micro_ros_graph_datawriters_.insert(
|
||||||
std::make_pair(participant, datawriter)).first;
|
std::make_pair(participant, std::move(datawriter))).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
it->second->write(static_cast<void *>(&info));
|
it->second->write(static_cast<void *>(&info));
|
||||||
@@ -345,9 +347,8 @@ void GraphManager::remove_participant(
|
|||||||
rmw_dds_common::convert_gid_to_msg(&gid, &info.gid);
|
rmw_dds_common::convert_gid_to_msg(&gid, &info.gid);
|
||||||
auto it = micro_ros_graph_datawriters_.find(participant);
|
auto it = micro_ros_graph_datawriters_.find(participant);
|
||||||
it->second->write(static_cast<void *>(&info));
|
it->second->write(static_cast<void *>(&info));
|
||||||
publisher_->delete_datawriter(it->second);
|
|
||||||
micro_ros_graph_datawriters_.erase(participant);
|
|
||||||
}
|
}
|
||||||
|
micro_ros_graph_datawriters_.erase(participant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::add_datawriter(
|
void GraphManager::add_datawriter(
|
||||||
@@ -357,7 +358,10 @@ void GraphManager::add_datawriter(
|
|||||||
{
|
{
|
||||||
const std::string& topic_name = datawriter->get_topic()->get_name();
|
const std::string& topic_name = datawriter->get_topic()->get_name();
|
||||||
const std::string& type_name = datawriter->get_topic()->get_type_name();
|
const std::string& type_name = datawriter->get_topic()->get_type_name();
|
||||||
this->add_datawriter(datawriter_guid, topic_name, type_name,
|
|
||||||
|
auto remapped_topic_name = namespace_remapping_ + "/" + topic_name;
|
||||||
|
|
||||||
|
this->add_datawriter(datawriter_guid, remapped_topic_name, type_name,
|
||||||
participant->guid(), datawriter->get_qos());
|
participant->guid(), datawriter->get_qos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,8 +378,10 @@ void GraphManager::add_datawriter(
|
|||||||
"rmw_fastrtps_cpp", participant_guid);
|
"rmw_fastrtps_cpp", participant_guid);
|
||||||
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(writer_qos);
|
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(writer_qos);
|
||||||
|
|
||||||
graphCache_.add_entity(datawriter_gid, topic_name, type_name,
|
auto remapped_topic_name = namespace_remapping_ + "/" + topic_name;
|
||||||
rosidl_get_zero_initialized_type_hash(), participant_gid, qos_profile, false);
|
|
||||||
|
graphCache_.add_entity(datawriter_gid, remapped_topic_name,
|
||||||
|
type_name, participant_gid, qos_profile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::remove_datawriter(
|
void GraphManager::remove_datawriter(
|
||||||
@@ -411,13 +417,8 @@ void GraphManager::add_datareader(
|
|||||||
"rmw_fastrtps_cpp", participant_guid);
|
"rmw_fastrtps_cpp", participant_guid);
|
||||||
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(reader_qos);
|
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(reader_qos);
|
||||||
|
|
||||||
// TODO(acuadros95): Use typesupport to calculate type hash on micro-ROS and save and get it from reader_qos.user_data.
|
graphCache_.add_entity(datareader_gid, topic_name,
|
||||||
// Related PRs:
|
type_name, participant_gid, qos_profile, true);
|
||||||
// https://github.com/ros2/rmw_dds_common/pull/70
|
|
||||||
// https://github.com/ros2/rmw_fastrtps/pull/671
|
|
||||||
// https://github.com/ros2/rmw_fastrtps/pull/680
|
|
||||||
graphCache_.add_entity(datareader_gid, topic_name, type_name,
|
|
||||||
rosidl_get_zero_initialized_type_hash(), participant_gid, qos_profile, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::remove_datareader(
|
void GraphManager::remove_datareader(
|
||||||
@@ -448,6 +449,7 @@ void GraphManager::associate_entity(
|
|||||||
{
|
{
|
||||||
std::string isolated_node_name, isolated_namespace;
|
std::string isolated_node_name, isolated_namespace;
|
||||||
get_name_and_namespace(qos.name().c_str(), isolated_node_name, isolated_namespace);
|
get_name_and_namespace(qos.name().c_str(), isolated_node_name, isolated_namespace);
|
||||||
|
isolated_namespace = namespace_remapping_ + isolated_namespace;
|
||||||
info = graphCache_.associate_writer(
|
info = graphCache_.associate_writer(
|
||||||
entity_gid, participant_gid, isolated_node_name, isolated_namespace);
|
entity_gid, participant_gid, isolated_node_name, isolated_namespace);
|
||||||
break;
|
break;
|
||||||
@@ -456,6 +458,7 @@ void GraphManager::associate_entity(
|
|||||||
{
|
{
|
||||||
std::string isolated_node_name, isolated_namespace;
|
std::string isolated_node_name, isolated_namespace;
|
||||||
get_name_and_namespace(qos.name().c_str(), isolated_node_name, isolated_namespace);
|
get_name_and_namespace(qos.name().c_str(), isolated_node_name, isolated_namespace);
|
||||||
|
isolated_namespace = namespace_remapping_ + isolated_namespace;
|
||||||
info = graphCache_.associate_reader(
|
info = graphCache_.associate_reader(
|
||||||
entity_gid, participant_gid, isolated_node_name, isolated_namespace);
|
entity_gid, participant_gid, isolated_node_name, isolated_namespace);
|
||||||
break;
|
break;
|
||||||
@@ -604,7 +607,7 @@ GraphManager::ParticipantListener::ParticipantListener(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::ParticipantListener::on_participant_discovery(
|
void GraphManager::ParticipantListener::on_participant_discovery(
|
||||||
eprosima::fastdds::dds::DomainParticipant* /* participant */,
|
eprosima::fastdds::dds::DomainParticipant* participant,
|
||||||
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info)
|
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info)
|
||||||
{
|
{
|
||||||
switch (info.status)
|
switch (info.status)
|
||||||
@@ -621,15 +624,13 @@ void GraphManager::ParticipantListener::on_participant_discovery(
|
|||||||
const std::string enclave =
|
const std::string enclave =
|
||||||
std::string(name_found->second.begin(), name_found->second.end());
|
std::string(name_found->second.begin(), name_found->second.end());
|
||||||
|
|
||||||
const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
|
graphManager_from_->add_participant(participant, false, enclave);
|
||||||
graphManager_from_->get_graph_cache().add_participant(gid, enclave);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT:
|
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT:
|
||||||
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT:
|
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT:
|
||||||
{
|
{
|
||||||
const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
|
graphManager_from_->remove_participant(participant, false);
|
||||||
graphManager_from_->get_graph_cache().remove_participant(gid);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -54,14 +54,14 @@ bool ParticipantEntitiesInfoTypeSupport::serialize(
|
|||||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||||
payload->max_size);
|
payload->max_size);
|
||||||
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||||
eprosima::fastcdr::DDS_CDR);
|
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||||
|
|
||||||
scdr.serialize_encapsulation();
|
scdr.serialize_encapsulation();
|
||||||
if (callbacks_->cdr_serialize(data, scdr))
|
if (callbacks_->cdr_serialize(data, scdr))
|
||||||
{
|
{
|
||||||
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
||||||
CDR_BE : CDR_LE;
|
CDR_BE : CDR_LE;
|
||||||
payload->length = static_cast<uint32_t>(scdr.get_serialized_data_length());
|
payload->length = static_cast<uint32_t>(scdr.getSerializedDataLength());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -77,7 +77,7 @@ bool ParticipantEntitiesInfoTypeSupport::deserialize(
|
|||||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||||
payload->length);
|
payload->length);
|
||||||
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||||
eprosima::fastcdr::DDS_CDR);
|
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||||
|
|
||||||
dcdr.read_encapsulation();
|
dcdr.read_encapsulation();
|
||||||
return callbacks_->cdr_deserialize(dcdr, data);
|
return callbacks_->cdr_deserialize(dcdr, data);
|
||||||
@@ -146,14 +146,14 @@ bool MicrorosGraphInfoTypeSupport::serialize(
|
|||||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||||
payload->max_size);
|
payload->max_size);
|
||||||
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||||
eprosima::fastcdr::DDS_CDR);
|
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||||
|
|
||||||
scdr.serialize_encapsulation();
|
scdr.serialize_encapsulation();
|
||||||
if (callbacks_->cdr_serialize(data, scdr))
|
if (callbacks_->cdr_serialize(data, scdr))
|
||||||
{
|
{
|
||||||
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
||||||
CDR_BE : CDR_LE;
|
CDR_BE : CDR_LE;
|
||||||
payload->length = static_cast<uint32_t>(scdr.get_serialized_data_length());
|
payload->length = static_cast<uint32_t>(scdr.getSerializedDataLength());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -169,7 +169,7 @@ bool MicrorosGraphInfoTypeSupport::deserialize(
|
|||||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||||
payload->length);
|
payload->length);
|
||||||
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||||
eprosima::fastcdr::DDS_CDR);
|
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||||
|
|
||||||
dcdr.read_encapsulation();
|
dcdr.read_encapsulation();
|
||||||
return callbacks_->cdr_deserialize(dcdr, data);
|
return callbacks_->cdr_deserialize(dcdr, data);
|
||||||
|
|||||||
Reference in New Issue
Block a user