mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 09:55:15 +02:00
* Fix graph manager node namespaces (#72)
(cherry picked from commit a623308505)
# Conflicts:
# micro_ros_agent/src/agent/graph_manager/graph_manager.cpp
* Update graph_manager.cpp
Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
This commit is contained in:
co-authored by
Pablo Garrido
parent
a3fe4aa376
commit
9d3fbc63a0
@@ -309,8 +309,36 @@ void GraphManager::add_participant(
|
||||
|
||||
if (node_name != enclave) // Do not add root node
|
||||
{
|
||||
// Split node name in domain and node name
|
||||
std::istringstream iss(node_name);
|
||||
std::vector<std::string> result;
|
||||
std::string token;
|
||||
|
||||
while(std::getline(iss, token, '/'))
|
||||
{
|
||||
result.push_back(token);
|
||||
}
|
||||
|
||||
std::string isolated_node_name = "";
|
||||
std::string isolated_namespace = "";
|
||||
|
||||
if (result.size() > 1)
|
||||
{
|
||||
isolated_namespace = result[0];
|
||||
for (size_t i = 1; i < result.size(); i++)
|
||||
{
|
||||
isolated_node_name.append(result[i] + "/");
|
||||
}
|
||||
isolated_node_name.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
isolated_node_name = node_name;
|
||||
isolated_namespace = "";
|
||||
}
|
||||
|
||||
rmw_dds_common::msg::ParticipantEntitiesInfo info =
|
||||
graphCache_.add_node(gid, node_name, enclave_);
|
||||
graphCache_.add_node(gid, isolated_node_name, isolated_namespace);
|
||||
ros_discovery_datawriter_->write(static_cast<void *>(&info));
|
||||
}
|
||||
}
|
||||
@@ -684,4 +712,4 @@ void GraphManager::DatareaderListener::on_data_available(
|
||||
} // namespace agent
|
||||
} // namespace uros
|
||||
|
||||
#endif // _UROS_AGENT_GRAPH_MANAGER_CPP
|
||||
#endif // _UROS_AGENT_GRAPH_MANAGER_CPP
|
||||
|
||||
Reference in New Issue
Block a user