mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 18:05:17 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af007872b0 | ||
|
|
e8dc4deda2 | ||
|
|
29aab24f8a | ||
|
|
dc4a428a75 | ||
|
|
7f0af6b953 | ||
|
|
7372bbe5bd | ||
|
|
a88be1bbbb | ||
|
|
92b7343d1a | ||
|
|
e6b928b1e1 | ||
|
|
4c98e4f9f5 | ||
|
|
964b0aec1a | ||
|
|
03946126dd | ||
|
|
0142528a73 | ||
|
|
53ff7d409d | ||
|
|
9e9167b0d7 | ||
|
|
93aa9e6a73 | ||
|
|
e62154a1cf | ||
|
|
495733690c | ||
|
|
179ae80b94 | ||
|
|
5ad09cec70 | ||
|
|
dfd6966cd1 | ||
|
|
d91c98ab6e | ||
|
|
9ed4bb3c15 | ||
|
|
489dbddced | ||
|
|
ed0402c2dd | ||
|
|
5780038fcc | ||
|
|
57bdfc5463 | ||
|
|
1f1b5842c6 | ||
|
|
6d2d47490a | ||
|
|
61b1e6fc8c | ||
|
|
d7dab5c671 | ||
|
|
e85eccb7c0 | ||
|
|
ac9f09b656 | ||
|
|
7ffd5f0bb6 | ||
|
|
ceb1a1436c | ||
|
|
c98705319f | ||
|
|
d149bb7018 | ||
|
|
646ca52aab | ||
|
|
95fecd77ae | ||
|
|
69f17c28a8 | ||
|
|
f6a2aa3b60 | ||
|
|
a623308505 |
+25
-26
@@ -3,36 +3,35 @@ name: CI micro-ROS Agent
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
- 'jazzy'
|
||||
schedule:
|
||||
- cron: '33 6 * * *'
|
||||
|
||||
jobs:
|
||||
|
||||
microros_agent_ci:
|
||||
runs-on: ubuntu-20.04
|
||||
container: microros/base:galactic
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest ]
|
||||
ros_distribution: [ jazzy ]
|
||||
include:
|
||||
- docker_image: ubuntu:24.04
|
||||
ros_distribution: jazzy
|
||||
container:
|
||||
image: ${{ matrix.docker_image }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ros-tooling/setup-ros@0.7.7
|
||||
with:
|
||||
path: urosagent
|
||||
|
||||
- name: Download dependencies
|
||||
use-ros2-testing: false
|
||||
required-ros-distributions: ${{ matrix.ros_distribution }}
|
||||
- name : Download and install dependencies
|
||||
run: |
|
||||
apt update
|
||||
cd /uros_ws
|
||||
. /opt/ros/$ROS_DISTRO/setup.sh
|
||||
. install/local_setup.sh
|
||||
rosdep update
|
||||
ros2 run micro_ros_setup create_agent_ws.sh
|
||||
|
||||
- name: Patch branch
|
||||
run: |
|
||||
rm -rf /uros_ws/src/uros/micro-ROS-Agent/*
|
||||
cp -R urosagent/* /uros_ws/src/uros/micro-ROS-Agent/
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd /uros_ws
|
||||
. /opt/ros/$ROS_DISTRO/setup.sh
|
||||
. install/local_setup.sh
|
||||
ros2 run micro_ros_setup build_agent.sh
|
||||
apt-get install ros-${{ matrix.ros_distribution }}-micro-ros-msgs
|
||||
apt-get install ros-${{ matrix.ros_distribution }}-rmw-fastrtps-cpp
|
||||
- uses : ros-tooling/action-ros-ci@0.3.13
|
||||
with:
|
||||
package-name: "micro_ros_agent"
|
||||
target-ros2-distro: ${{ matrix.ros_distribution }}
|
||||
|
||||
@@ -55,3 +55,4 @@ see the file [3rd-party-licenses.txt](3rd-party-licenses.txt).
|
||||
Please notice the following issues/limitations:
|
||||
|
||||
* There is an unknown issue when dealing with serial ports shared with the micro-ROS agent running inside a Docker. Sometimes it works with a remarkable packet loss.
|
||||
* There is an known issues with serial port communication on micro-ros-agent snap version. It is recommended to use the dockerized version or build it from source.
|
||||
@@ -2,7 +2,45 @@
|
||||
Changelog for package micro-ros_agent
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
2.0.0 (2021-09-13)
|
||||
5.0.2 (2024-05-31)
|
||||
------------------
|
||||
* 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)
|
||||
------------------
|
||||
* Add services to graph manager (`#127 <https://github.com/micro-ROS/micro-ROS-Agent/issues/127>`_) (`#129 <https://github.com/micro-ROS/micro-ROS-Agent/issues/129>`_)
|
||||
* Add used missing includes (`#116 <https://github.com/micro-ROS/micro-ROS-Agent/issues/116>`_) (`#124 <https://github.com/micro-ROS/micro-ROS-Agent/issues/124>`_)
|
||||
* Add system logger flag (`#118 <https://github.com/micro-ROS/micro-ROS-Agent/issues/118>`_) (`#119 <https://github.com/micro-ROS/micro-ROS-Agent/issues/119>`_)
|
||||
* Add condition variable include (`#113 <https://github.com/micro-ROS/micro-ROS-Agent/issues/113>`_) (`#114 <https://github.com/micro-ROS/micro-ROS-Agent/issues/114>`_)
|
||||
* pass system name to xrceagent (`#110 <https://github.com/micro-ROS/micro-ROS-Agent/issues/110>`_) (`#112 <https://github.com/micro-ROS/micro-ROS-Agent/issues/112>`_)
|
||||
* Fix memory leak in FastDDS datawriter (`#107 <https://github.com/micro-ROS/micro-ROS-Agent/issues/107>`_) (`#109 <https://github.com/micro-ROS/micro-ROS-Agent/issues/109>`_)
|
||||
|
||||
3.0.0 (2021-09-13)
|
||||
------------------
|
||||
|
||||
1.0.1 (2021-09-13)
|
||||
------------------
|
||||
* Remove XRCE dependency and add superbuild (`#97 <https://github.com/micro-ROS/micro-ROS-Agent/issues/97>`_)
|
||||
* Fixed launch file by using a list for arguments. Ensures order of items is kept. (`#93 <https://github.com/micro-ROS/micro-ROS-Agent/issues/93>`_) (`#94 <https://github.com/micro-ROS/micro-ROS-Agent/issues/94>`_)
|
||||
|
||||
@@ -20,6 +20,7 @@ option(UROSAGENT_GENERATE_PROFILE
|
||||
set(CMAKE_C_CLANG_TIDY clang-tidy -checks=*)
|
||||
|
||||
option(MICROROSAGENT_SUPERBUILD "Enable superbuild compilation." ON)
|
||||
option(UAGENT_USE_SYSTEM_LOGGER "Force use of system installed spdlog logger on superbuild." OFF)
|
||||
|
||||
if(NOT MICROROSAGENT_SUPERBUILD)
|
||||
project(micro_ros_agent LANGUAGES CXX)
|
||||
|
||||
@@ -26,7 +26,7 @@ if(NOT xrceagent_FOUND)
|
||||
GIT_REPOSITORY
|
||||
https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||
GIT_TAG
|
||||
ros2
|
||||
v2.4.3
|
||||
PREFIX
|
||||
${PROJECT_BINARY_DIR}/agent
|
||||
INSTALL_DIR
|
||||
@@ -42,8 +42,10 @@ if(NOT xrceagent_FOUND)
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_PREFIX_PATH:PATH=<INSTALL_DIR>
|
||||
-DCMAKE_SYSTEM_NAME:STRING=${CMAKE_SYSTEM_NAME}
|
||||
-DUAGENT_USE_SYSTEM_FASTDDS:BOOL=ON
|
||||
-DUAGENT_USE_SYSTEM_FASTCDR:BOOL=ON
|
||||
-DUAGENT_USE_SYSTEM_LOGGER:BOOL=${UAGENT_USE_SYSTEM_LOGGER}
|
||||
-DUAGENT_CED_PROFILE:BOOL=OFF
|
||||
-DUAGENT_P2P_PROFILE:BOOL=OFF
|
||||
-DUAGENT_BUILD_EXECUTABLE:BOOL=OFF
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include <uxr/agent/middleware/utils/Callbacks.hpp>
|
||||
|
||||
#include <agent/graph_manager/graph_manager.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
// TODO(jamoralp): class Documentation
|
||||
namespace uros {
|
||||
namespace agent {
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _UROS_AGENT_GRAPH_MANAGER_HPP
|
||||
#define _UROS_AGENT_GRAPH_MANAGER_HPP
|
||||
|
||||
#include "fastrtps/Domain.h"
|
||||
#include <fastrtps/TopicDataType.h>
|
||||
#include "fastrtps/attributes/ParticipantAttributes.h"
|
||||
@@ -58,8 +61,11 @@
|
||||
#include <agent/graph_manager/graph_typesupport.hpp>
|
||||
#include <agent/utils/demangle.hpp>
|
||||
|
||||
#ifndef _UROS_AGENT_GRAPH_MANAGER_HPP
|
||||
#define _UROS_AGENT_GRAPH_MANAGER_HPP
|
||||
#include <condition_variable>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
|
||||
namespace uros {
|
||||
namespace agent {
|
||||
@@ -106,6 +112,12 @@ public:
|
||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
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.
|
||||
* @param datawriter_guid rtps::GUID_t of the datawriter to be added.
|
||||
@@ -294,7 +306,7 @@ private:
|
||||
// Store a auxiliary publishers and datawriter for each participant created in micro-ROS
|
||||
std::map<
|
||||
const eprosima::fastdds::dds::DomainParticipant*,
|
||||
std::unique_ptr<eprosima::fastdds::dds::DataWriter>
|
||||
eprosima::fastdds::dds::DataWriter*
|
||||
> micro_ros_graph_datawriters_;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>micro_ros_agent</name>
|
||||
<version>2.0.0</version>
|
||||
<version>5.0.2</version>
|
||||
<description>micro-ROS Agent package</description>
|
||||
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
|
||||
<maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer>
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#include <agent/Agent.hpp>
|
||||
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
|
||||
namespace uros {
|
||||
namespace agent {
|
||||
|
||||
@@ -76,14 +79,9 @@ bool Agent::create(
|
||||
{
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
// TODO(jamoralp): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datawriter->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datawriter_guid =
|
||||
iHandle2GUID(instance_handle);
|
||||
graph_manager_->add_datawriter(datawriter_guid, participant, datawriter);
|
||||
graph_manager_->add_datawriter(datawriter->guid(), participant, datawriter);
|
||||
graph_manager_->associate_entity(
|
||||
datawriter_guid, participant, dds::xrce::OBJK_DATAWRITER);
|
||||
datawriter->guid(), participant, dds::xrce::OBJK_DATAWRITER);
|
||||
});
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
@@ -103,12 +101,7 @@ bool Agent::create(
|
||||
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
// TODO(jamoralp): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datawriter->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datawriter_guid =
|
||||
eprosima::fastrtps::rtps::iHandle2GUID(instance_handle);
|
||||
graph_manager_->remove_datawriter(datawriter_guid);
|
||||
graph_manager_->remove_datawriter(datawriter->guid());
|
||||
});
|
||||
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
@@ -166,6 +159,128 @@ bool Agent::create(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
eprosima::uxr::middleware::CallbackKind::DELETE_DATAREADER,
|
||||
std::move(on_delete_datareader));
|
||||
|
||||
/**
|
||||
* Add CREATE_REQUESTER callback.
|
||||
*/
|
||||
std::function<void (
|
||||
const eprosima::fastdds::dds::DomainParticipant *,
|
||||
const eprosima::fastdds::dds::DataWriter *,
|
||||
const eprosima::fastdds::dds::DataReader *)> on_create_requester
|
||||
([&](
|
||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
const eprosima::fastdds::dds::DataWriter* datawriter,
|
||||
const eprosima::fastdds::dds::DataReader * datareader) -> void
|
||||
{
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
graph_manager_->add_datawriter(datawriter->guid(), participant, datawriter);
|
||||
graph_manager_->associate_entity(
|
||||
datawriter->guid(), participant, dds::xrce::OBJK_DATAWRITER);
|
||||
|
||||
// TODO(pablogs): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datareader->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datareader_guid =
|
||||
eprosima::fastrtps::rtps::iHandle2GUID(instance_handle);
|
||||
graph_manager_->add_datareader(datareader_guid, participant, datareader);
|
||||
graph_manager_->associate_entity(
|
||||
datareader_guid, participant, dds::xrce::OBJK_DATAREADER);
|
||||
});
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
eprosima::uxr::middleware::CallbackKind::CREATE_REQUESTER,
|
||||
std::move(on_create_requester));
|
||||
|
||||
/**
|
||||
* Add DELETE_REQUESTER callback.
|
||||
*/
|
||||
std::function<void (
|
||||
const eprosima::fastdds::dds::DomainParticipant *,
|
||||
const eprosima::fastdds::dds::DataWriter *,
|
||||
const eprosima::fastdds::dds::DataReader *)> on_delete_requester
|
||||
([&](
|
||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
const eprosima::fastdds::dds::DataWriter* datawriter,
|
||||
const eprosima::fastdds::dds::DataReader * datareader) -> void
|
||||
{
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
graph_manager_->remove_datawriter(datawriter->guid());
|
||||
|
||||
// TODO(pablogs): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datareader->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datareader_guid =
|
||||
eprosima::fastrtps::rtps::iHandle2GUID(instance_handle);
|
||||
graph_manager_->remove_datareader(datareader_guid);
|
||||
});
|
||||
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
eprosima::uxr::middleware::CallbackKind::DELETE_REQUESTER,
|
||||
std::move(on_delete_requester));
|
||||
|
||||
/**
|
||||
* Add CREATE_REPLIER callback.
|
||||
*/
|
||||
std::function<void (
|
||||
const eprosima::fastdds::dds::DomainParticipant *,
|
||||
const eprosima::fastdds::dds::DataWriter *,
|
||||
const eprosima::fastdds::dds::DataReader *)> on_create_replier
|
||||
([&](
|
||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
const eprosima::fastdds::dds::DataWriter* datawriter,
|
||||
const eprosima::fastdds::dds::DataReader * datareader) -> void
|
||||
{
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
graph_manager_->add_datawriter(datawriter->guid(), participant, datawriter);
|
||||
graph_manager_->associate_entity(
|
||||
datawriter->guid(), participant, dds::xrce::OBJK_DATAWRITER);
|
||||
|
||||
// TODO(pablogs): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datareader->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datareader_guid =
|
||||
eprosima::fastrtps::rtps::iHandle2GUID(instance_handle);
|
||||
graph_manager_->add_datareader(datareader_guid, participant, datareader);
|
||||
graph_manager_->associate_entity(
|
||||
datareader_guid, participant, dds::xrce::OBJK_DATAREADER);
|
||||
});
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
eprosima::uxr::middleware::CallbackKind::CREATE_REPLIER,
|
||||
std::move(on_create_replier));
|
||||
|
||||
/**
|
||||
* Add DELETE_REPLIER callback.
|
||||
*/
|
||||
std::function<void (
|
||||
const eprosima::fastdds::dds::DomainParticipant *,
|
||||
const eprosima::fastdds::dds::DataWriter *,
|
||||
const eprosima::fastdds::dds::DataReader *)> on_delete_replier
|
||||
([&](
|
||||
const eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
const eprosima::fastdds::dds::DataWriter* datawriter,
|
||||
const eprosima::fastdds::dds::DataReader * datareader) -> void
|
||||
{
|
||||
auto graph_manager_ = find_or_create_graph_manager(participant->get_domain_id());
|
||||
|
||||
graph_manager_->remove_datawriter(datawriter->guid());
|
||||
|
||||
// TODO(pablogs): Workaround for Fast-DDS bug #9977. Remove when fixed
|
||||
const eprosima::fastrtps::rtps::InstanceHandle_t instance_handle =
|
||||
datareader->get_instance_handle();
|
||||
const eprosima::fastrtps::rtps::GUID_t datareader_guid =
|
||||
eprosima::fastrtps::rtps::iHandle2GUID(instance_handle);
|
||||
graph_manager_->remove_datareader(datareader_guid);
|
||||
});
|
||||
|
||||
xrce_dds_agent_instance_.add_middleware_callback(
|
||||
eprosima::uxr::Middleware::Kind::FASTDDS,
|
||||
eprosima::uxr::middleware::CallbackKind::DELETE_REPLIER,
|
||||
std::move(on_delete_replier));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
|
||||
#include <agent/graph_manager/graph_manager.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace uros {
|
||||
namespace agent {
|
||||
namespace graph_manager {
|
||||
@@ -96,7 +101,7 @@ GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
|
||||
|
||||
eprosima::fastdds::dds::DataWriterQos ros_to_microros_datawriter_qos_ = datawriter_qos_;
|
||||
ros_to_microros_datawriter_qos_.history().kind =
|
||||
eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_ALL_HISTORY_QOS;
|
||||
eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS;
|
||||
ros_to_microros_graph_datawriter_.reset(
|
||||
publisher_->create_datawriter(ros_to_microros_graph_topic_.get(), ros_to_microros_datawriter_qos_));
|
||||
|
||||
@@ -120,9 +125,11 @@ GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
|
||||
|
||||
// Set graph cache on change callback function
|
||||
graphCache_.set_on_change_callback([this]()
|
||||
{
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->mtx_);
|
||||
this->graph_changed_ = true;
|
||||
}
|
||||
this->cv_.notify_one();
|
||||
});
|
||||
|
||||
@@ -139,6 +146,7 @@ inline void GraphManager::publish_microros_graph()
|
||||
{
|
||||
return this->graph_changed_;
|
||||
});
|
||||
graph_changed_ = false;
|
||||
}
|
||||
|
||||
if (display_on_change_)
|
||||
@@ -146,7 +154,6 @@ inline void GraphManager::publish_microros_graph()
|
||||
std::cout << "Updated uros Graph: graph changed" << std::endl;
|
||||
std::cout << graphCache_ << std::endl;
|
||||
}
|
||||
graph_changed_ = false;
|
||||
|
||||
micro_ros_msgs::msg::Graph graph_message;
|
||||
|
||||
@@ -315,11 +322,10 @@ void GraphManager::add_participant(
|
||||
if (it == micro_ros_graph_datawriters_.end())
|
||||
{
|
||||
// Create datawriter
|
||||
std::unique_ptr<eprosima::fastdds::dds::DataWriter> datawriter;
|
||||
datawriter.reset(publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_));
|
||||
eprosima::fastdds::dds::DataWriter * datawriter = publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_);
|
||||
|
||||
it = micro_ros_graph_datawriters_.insert(
|
||||
std::make_pair(participant, std::move(datawriter))).first;
|
||||
std::make_pair(participant, datawriter)).first;
|
||||
}
|
||||
|
||||
it->second->write(static_cast<void *>(&info));
|
||||
@@ -339,8 +345,9 @@ void GraphManager::remove_participant(
|
||||
rmw_dds_common::convert_gid_to_msg(&gid, &info.gid);
|
||||
auto it = micro_ros_graph_datawriters_.find(participant);
|
||||
it->second->write(static_cast<void *>(&info));
|
||||
}
|
||||
publisher_->delete_datawriter(it->second);
|
||||
micro_ros_graph_datawriters_.erase(participant);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphManager::add_datawriter(
|
||||
@@ -367,8 +374,8 @@ void GraphManager::add_datawriter(
|
||||
"rmw_fastrtps_cpp", participant_guid);
|
||||
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(writer_qos);
|
||||
|
||||
graphCache_.add_entity(datawriter_gid, topic_name,
|
||||
type_name, participant_gid, qos_profile, false);
|
||||
graphCache_.add_entity(datawriter_gid, topic_name, type_name,
|
||||
rosidl_get_zero_initialized_type_hash(), participant_gid, qos_profile, false);
|
||||
}
|
||||
|
||||
void GraphManager::remove_datawriter(
|
||||
@@ -404,8 +411,13 @@ void GraphManager::add_datareader(
|
||||
"rmw_fastrtps_cpp", participant_guid);
|
||||
const rmw_qos_profile_t qos_profile = fastdds_qos_to_rmw_qos(reader_qos);
|
||||
|
||||
graphCache_.add_entity(datareader_gid, topic_name,
|
||||
type_name, participant_gid, qos_profile, true);
|
||||
// TODO(acuadros95): Use typesupport to calculate type hash on micro-ROS and save and get it from reader_qos.user_data.
|
||||
// Related PRs:
|
||||
// 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(
|
||||
@@ -592,7 +604,7 @@ GraphManager::ParticipantListener::ParticipantListener(
|
||||
}
|
||||
|
||||
void GraphManager::ParticipantListener::on_participant_discovery(
|
||||
eprosima::fastdds::dds::DomainParticipant* participant,
|
||||
eprosima::fastdds::dds::DomainParticipant* /* participant */,
|
||||
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info)
|
||||
{
|
||||
switch (info.status)
|
||||
@@ -609,13 +621,15 @@ void GraphManager::ParticipantListener::on_participant_discovery(
|
||||
const std::string enclave =
|
||||
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;
|
||||
}
|
||||
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_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;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include <agent/graph_manager/graph_typesupport.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace uros {
|
||||
namespace agent {
|
||||
namespace graph_manager {
|
||||
@@ -41,7 +43,7 @@ ParticipantEntitiesInfoTypeSupport::ParticipantEntitiesInfoTypeSupport()
|
||||
ss << "dds_::" << message_name << "_";
|
||||
this->setName(ss.str().c_str());
|
||||
|
||||
bool full_bounded = true;
|
||||
char full_bounded;
|
||||
m_typeSize = 4 + callbacks_->max_serialized_size(full_bounded);
|
||||
}
|
||||
|
||||
@@ -52,14 +54,14 @@ bool ParticipantEntitiesInfoTypeSupport::serialize(
|
||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||
payload->max_size);
|
||||
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||
eprosima::fastcdr::DDS_CDR);
|
||||
|
||||
scdr.serialize_encapsulation();
|
||||
if (callbacks_->cdr_serialize(data, scdr))
|
||||
{
|
||||
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
||||
CDR_BE : CDR_LE;
|
||||
payload->length = static_cast<uint32_t>(scdr.getSerializedDataLength());
|
||||
payload->length = static_cast<uint32_t>(scdr.get_serialized_data_length());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -75,7 +77,7 @@ bool ParticipantEntitiesInfoTypeSupport::deserialize(
|
||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||
payload->length);
|
||||
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||
eprosima::fastcdr::DDS_CDR);
|
||||
|
||||
dcdr.read_encapsulation();
|
||||
return callbacks_->cdr_deserialize(dcdr, data);
|
||||
@@ -133,7 +135,7 @@ MicrorosGraphInfoTypeSupport::MicrorosGraphInfoTypeSupport()
|
||||
ss << "dds_::" << message_name << "_";
|
||||
this->setName(ss.str().c_str());
|
||||
|
||||
bool full_bounded = true;
|
||||
char full_bounded;
|
||||
m_typeSize = 4 + callbacks_->max_serialized_size(full_bounded);
|
||||
}
|
||||
|
||||
@@ -144,14 +146,14 @@ bool MicrorosGraphInfoTypeSupport::serialize(
|
||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||
payload->max_size);
|
||||
eprosima::fastcdr::Cdr scdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||
eprosima::fastcdr::DDS_CDR);
|
||||
|
||||
scdr.serialize_encapsulation();
|
||||
if (callbacks_->cdr_serialize(data, scdr))
|
||||
{
|
||||
payload->encapsulation = (scdr.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS) ?
|
||||
CDR_BE : CDR_LE;
|
||||
payload->length = static_cast<uint32_t>(scdr.getSerializedDataLength());
|
||||
payload->length = static_cast<uint32_t>(scdr.get_serialized_data_length());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -167,7 +169,7 @@ bool MicrorosGraphInfoTypeSupport::deserialize(
|
||||
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char *>(payload->data),
|
||||
payload->length);
|
||||
eprosima::fastcdr::Cdr dcdr(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
|
||||
eprosima::fastcdr::Cdr::DDS_CDR);
|
||||
eprosima::fastcdr::DDS_CDR);
|
||||
|
||||
dcdr.read_encapsulation();
|
||||
return callbacks_->cdr_deserialize(dcdr, data);
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#include <agent/Agent.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
uros::agent::Agent micro_ros_agent;
|
||||
|
||||
Reference in New Issue
Block a user