Fix graph manager datawriters behaviour (#84) (#86)

* Fix graph manager datawriters

Fixes

Fix

Fix destruction

* Revert "Fix graph manager datawriters"

This reverts commit 2847a2ebc3.

* Initial

(cherry picked from commit 646ca52aab)

Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
This commit is contained in:
mergify[bot]
2021-07-09 13:41:52 +02:00
committed by GitHub
co-authored by Pablo Garrido
parent 80916d4949
commit 7f3f560bc7
3 changed files with 78 additions and 91 deletions
@@ -89,28 +89,22 @@ public:
/**
* @brief Adds a DDS participant to the graph tree.
* @param participant Pointer to the participant to be added to the graph.
*/
void add_participant(
const eprosima::fastdds::dds::DomainParticipant* participant);
/**
* @brief Adds a DDS participant to the graph tree.
* @param guid rtps::GUID_t of the participant to be added.
* @param node_name Name of the ROS 2 node associated to the given participant.
* @param participant eprosima::fastdds::dds::DomainParticipant to be added.
* @param from_microros if this participant has been added from micro-ROS.
* @param enclave ROS 2 enclave.
*/
void add_participant(
const eprosima::fastrtps::rtps::GUID_t& guid,
const std::string& node_name,
const std::string& enclave);
const eprosima::fastdds::dds::DomainParticipant* participant,
bool from_microros = true,
const std::string& enclave = "/");
/**
* @brief Removes a DDS participant from the graph tree.
* @param guid rtps::GUID_t of the participant to be removed.
* @param participant eprosima::fastdds::dds::DomainParticipant to be removed.
*/
void remove_participant(
const eprosima::fastrtps::rtps::GUID_t& guid);
const eprosima::fastdds::dds::DomainParticipant* participant,
bool from_microros = true);
/**
* @brief Adds a DDS datawriter to the graph tree.
@@ -307,11 +301,12 @@ private:
eprosima::fastdds::dds::DomainId_t domain_id_;
bool graph_changed_;
bool display_on_change_;
const char * enclave_;
std::thread microros_graph_publisher_;
std::mutex mtx_;
std::condition_variable cv_;
eprosima::fastdds::dds::DataWriterQos datawriter_qos_;
rmw_dds_common::GraphCache graphCache_;
std::unique_ptr<ParticipantListener> participant_listener_;
std::unique_ptr<DatareaderListener> datareader_listener_;
@@ -323,9 +318,14 @@ private:
std::unique_ptr<eprosima::fastdds::dds::Subscriber> subscriber_;
std::unique_ptr<eprosima::fastdds::dds::Topic> ros_discovery_topic_;
std::unique_ptr<eprosima::fastdds::dds::Topic> ros_to_microros_graph_topic_;
std::unique_ptr<eprosima::fastdds::dds::DataWriter> ros_discovery_datawriter_;
std::unique_ptr<eprosima::fastdds::dds::DataWriter> ros_to_microros_graph_datawriter_;
std::unique_ptr<eprosima::fastdds::dds::DataReader> ros_discovery_datareader_;
// 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>
> micro_ros_graph_datawriters_;
};
} // namespace graph_manager