mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 18:05:17 +02:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93aa9e6a73 | ||
|
|
e62154a1cf | ||
|
|
495733690c | ||
|
|
179ae80b94 | ||
|
|
5ad09cec70 | ||
|
|
dfd6966cd1 |
@@ -3,24 +3,24 @@ name: CI micro-ROS Agent
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- 'humble'
|
- 'main'
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '33 6 * * *'
|
- cron: '33 6 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
microros_agent_ci:
|
microros_agent_ci:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-20.04 ]
|
os: [ ubuntu-20.04 ]
|
||||||
ros_distribution: [ humble ]
|
ros_distribution: [ rolling ]
|
||||||
include:
|
include:
|
||||||
- docker_image: ubuntu:jammy
|
- docker_image: ubuntu:22.04
|
||||||
ros_distribution: humble
|
ros_distribution: rolling
|
||||||
container:
|
container:
|
||||||
image: ubuntu:jammy
|
image: ubuntu:22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ros-tooling/setup-ros@0.3.2
|
- uses: ros-tooling/setup-ros@0.3.2
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
Changelog for package micro-ros_agent
|
Changelog for package micro-ros_agent
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
3.0.2 (2022-05-25)
|
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)
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ 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);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Default constructor.
|
* @brief Default constructor.
|
||||||
*/
|
*/
|
||||||
GraphManager(eprosima::fastdds::dds::DomainId_t domain_id, std::string namespace_remapping);
|
GraphManager(eprosima::fastdds::dds::DomainId_t domain_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default destructor.
|
* @brief Default destructor.
|
||||||
@@ -111,6 +111,12 @@ 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.
|
||||||
@@ -274,7 +280,6 @@ 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_;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<?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>3.0.2</version>
|
<version>4.0.1</version>
|
||||||
<description>micro-ROS Agent package</description>
|
<description>micro-ROS Agent package</description>
|
||||||
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
|
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
|
||||||
<maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer>
|
<maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer>
|
||||||
|
|||||||
@@ -33,17 +33,6 @@ 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)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -304,6 +293,7 @@ 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()) {
|
||||||
@@ -312,7 +302,7 @@ std::shared_ptr<graph_manager::GraphManager> Agent::find_or_create_graph_manager
|
|||||||
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, namespace_remapping)
|
std::make_shared<graph_manager::GraphManager>(domain_id)
|
||||||
)
|
)
|
||||||
).first->second;
|
).first->second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ namespace uros {
|
|||||||
namespace agent {
|
namespace agent {
|
||||||
namespace graph_manager {
|
namespace graph_manager {
|
||||||
|
|
||||||
GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id, std::string namespace_remapping)
|
GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
|
||||||
: 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_()
|
||||||
@@ -314,8 +313,6 @@ 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);
|
||||||
|
|
||||||
@@ -358,10 +355,7 @@ 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,9 +372,7 @@ 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);
|
||||||
|
|
||||||
auto remapped_topic_name = namespace_remapping_ + "/" + topic_name;
|
graphCache_.add_entity(datawriter_gid, topic_name,
|
||||||
|
|
||||||
graphCache_.add_entity(datawriter_gid, remapped_topic_name,
|
|
||||||
type_name, participant_gid, qos_profile, false);
|
type_name, participant_gid, qos_profile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +441,6 @@ 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;
|
||||||
@@ -458,7 +449,6 @@ 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;
|
||||||
@@ -607,7 +597,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)
|
||||||
@@ -624,13 +614,15 @@ 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());
|
||||||
|
|
||||||
graphManager_from_->add_participant(participant, false, enclave);
|
const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
|
||||||
|
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:
|
||||||
{
|
{
|
||||||
graphManager_from_->remove_participant(participant, false);
|
const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
|
||||||
|
graphManager_from_->get_graph_cache().remove_participant(gid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user