Skip to content

Commit e133754

Browse files
committed
Fix Rolling agent (#61)
* Initial * Remove deprecated FastDDS entities methods Remove headers * Add conversion functions
1 parent a3fe4aa commit e133754

File tree

3 files changed

+50
-70
lines changed

3 files changed

+50
-70
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
microros_agent_ci:
1111
runs-on: ubuntu-20.04
12-
container: microros/base:foxy
12+
container: microros/base:rolling
1313

1414
steps:
1515
- uses: actions/checkout@v2

micro_ros_agent/include/agent/graph_manager/graph_manager.hpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,6 @@ class GraphManager
138138
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
139139
const eprosima::fastdds::dds::DataWriterQos& writer_qos);
140140

141-
/**
142-
* @brief Adds a DDS datawriter to the graph tree.
143-
* @param datawriter_guid rtps::GUID_t of the datawriter to be added.
144-
* @param topic_name Name of the topic to which the datawriter sends information to.
145-
* @param type_name Type name of the sent topic.
146-
* @param participant_guid rtps::GUID_t of the participant which owns this datawriter.
147-
* @param writer_qos QOS of the datawriter to be included into the graph tree.
148-
*/
149-
void add_datawriter(
150-
const eprosima::fastrtps::rtps::GUID_t& datawriter_guid,
151-
const std::string& topic_name,
152-
const std::string& type_name,
153-
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
154-
const eprosima::fastdds::dds::WriterQos& writer_qos);
155-
156141
/**
157142
* @brief Removes a DDS datawriter from the graph tree.
158143
* @param datawriter_guid rtps::GUID_t of the datawriter to be removed.
@@ -186,21 +171,6 @@ class GraphManager
186171
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
187172
const eprosima::fastdds::dds::DataReaderQos& reader_qos);
188173

189-
/**
190-
* @brief Adds a DDS datareader to the graph tree.
191-
* @param datareader_guid rtps::GUID_t of the datareader to be added.
192-
* @param topic_name Name of the topic to which the datareader sends information to.
193-
* @param type_name Type name of the sent topic.
194-
* @param participant_guid rtps::GUID_t of the participant which owns this datareader.
195-
* @param writer_qos QOS of the datareader to be included into the graph tree.
196-
*/
197-
void add_datareader(
198-
const eprosima::fastrtps::rtps::GUID_t& datareader_guid,
199-
const std::string& topic_name,
200-
const std::string& type_name,
201-
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
202-
const eprosima::fastdds::dds::ReaderQos& reader_qos);
203-
204174
/**
205175
* @brief Removes a DDS datareader from the graph tree.
206176
* @param datareader_guid rtps::GUID_t of the datareader to be removed.

micro_ros_agent/src/agent/graph_manager/graph_manager.cpp

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -350,24 +350,6 @@ void GraphManager::add_datawriter(
350350
type_name, participant_gid, qos_profile, false);
351351
}
352352

353-
void GraphManager::add_datawriter(
354-
const eprosima::fastrtps::rtps::GUID_t& datawriter_guid,
355-
const std::string& topic_name,
356-
const std::string& type_name,
357-
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
358-
const eprosima::fastdds::dds::WriterQos& writer_qos)
359-
{
360-
const rmw_gid_t datawriter_gid = rmw_fastrtps_shared_cpp::create_rmw_gid(
361-
"rmw_fastrtps_cpp", datawriter_guid);
362-
const rmw_gid_t participant_gid = rmw_fastrtps_shared_cpp::create_rmw_gid(
363-
"rmw_fastrtps_cpp", participant_guid);
364-
rmw_qos_profile_t qos_profile = rmw_qos_profile_unknown;
365-
dds_qos_to_rmw_qos(writer_qos, &qos_profile);
366-
367-
graphCache_.add_entity(datawriter_gid, topic_name,
368-
type_name, participant_gid, qos_profile, false);
369-
}
370-
371353
void GraphManager::remove_datawriter(
372354
const eprosima::fastrtps::rtps::GUID_t& datawriter_guid)
373355
{
@@ -405,24 +387,6 @@ void GraphManager::add_datareader(
405387
type_name, participant_gid, qos_profile, true);
406388
}
407389

408-
void GraphManager::add_datareader(
409-
const eprosima::fastrtps::rtps::GUID_t& datareader_guid,
410-
const std::string& topic_name,
411-
const std::string& type_name,
412-
const eprosima::fastrtps::rtps::GUID_t& participant_guid,
413-
const eprosima::fastdds::dds::ReaderQos& reader_qos)
414-
{
415-
const rmw_gid_t datareader_gid = rmw_fastrtps_shared_cpp::create_rmw_gid(
416-
"rmw_fastrtps_cpp", datareader_guid);
417-
const rmw_gid_t participant_gid = rmw_fastrtps_shared_cpp::create_rmw_gid(
418-
"rmw_fastrtps_cpp", participant_guid);
419-
rmw_qos_profile_t qos_profile = rmw_qos_profile_unknown;
420-
dds_qos_to_rmw_qos(reader_qos, &qos_profile);
421-
422-
graphCache_.add_entity(datareader_gid, topic_name,
423-
type_name, participant_gid, qos_profile, true);
424-
}
425-
426390
void GraphManager::remove_datareader(
427391
const eprosima::fastrtps::rtps::GUID_t& datareader_guid)
428392
{
@@ -549,7 +513,7 @@ void GraphManager::update_node_entities_info()
549513
if (ros_discovery_datareader_->take_next_sample(&entities_info, &sample_info) ==
550514
eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK)
551515
{
552-
if (sample_info.instance_state == eprosima::fastdds::dds::InstanceStateKind::ALIVE)
516+
if (sample_info.instance_state == eprosima::fastdds::dds::InstanceStateKind::ALIVE_INSTANCE_STATE)
553517
{
554518
graphCache_.update_participant_entities(entities_info);
555519
}
@@ -597,6 +561,52 @@ void GraphManager::ParticipantListener::on_participant_discovery(
597561
}
598562
}
599563

564+
static eprosima::fastdds::dds::DataWriterQos writer_qos_conversion(
565+
const eprosima::fastdds::dds::WriterQos& writer_qos)
566+
{
567+
eprosima::fastdds::dds::DataWriterQos datawriter_qos;
568+
datawriter_qos.durability(writer_qos.m_durability);
569+
datawriter_qos.durability_service(writer_qos.m_durabilityService);
570+
datawriter_qos.deadline(writer_qos.m_deadline);
571+
datawriter_qos.latency_budget(writer_qos.m_latencyBudget);
572+
datawriter_qos.liveliness(writer_qos.m_liveliness);
573+
datawriter_qos.reliability(writer_qos.m_reliability);
574+
datawriter_qos.destination_order(writer_qos.m_destinationOrder);
575+
datawriter_qos.lifespan(writer_qos.m_lifespan);
576+
datawriter_qos.user_data(writer_qos.m_userData);
577+
datawriter_qos.ownership(writer_qos.m_ownership);
578+
datawriter_qos.ownership_strength(writer_qos.m_ownershipStrength);
579+
datawriter_qos.publish_mode(writer_qos.m_publishMode);
580+
datawriter_qos.representation(writer_qos.representation);
581+
datawriter_qos.data_sharing(writer_qos.data_sharing);
582+
583+
return datawriter_qos;
584+
}
585+
586+
static eprosima::fastdds::dds::DataReaderQos reader_qos_conversion(
587+
const eprosima::fastdds::dds::ReaderQos& reader_qos)
588+
{
589+
eprosima::fastdds::dds::DataReaderQos datareader_qos;
590+
591+
datareader_qos.durability(reader_qos.m_durability);
592+
datareader_qos.deadline(reader_qos.m_deadline);
593+
datareader_qos.latency_budget(reader_qos.m_latencyBudget);
594+
datareader_qos.liveliness(reader_qos.m_liveliness);
595+
datareader_qos.reliability(reader_qos.m_reliability);
596+
datareader_qos.destination_order(reader_qos.m_destinationOrder);
597+
datareader_qos.user_data(reader_qos.m_userData);
598+
datareader_qos.ownership(reader_qos.m_ownership);
599+
datareader_qos.time_based_filter(reader_qos.m_timeBasedFilter);
600+
datareader_qos.lifespan(reader_qos.m_lifespan);
601+
datareader_qos.durability_service(reader_qos.m_durabilityService);
602+
eprosima::fastdds::dds::TypeConsistencyQos consistency;
603+
consistency.type_consistency = reader_qos.type_consistency;
604+
datareader_qos.type_consistency(consistency);
605+
datareader_qos.data_sharing(reader_qos.data_sharing);
606+
607+
return datareader_qos;
608+
}
609+
600610
template <>
601611
void GraphManager::ParticipantListener::process_discovery_info<eprosima::fastrtps::rtps::ReaderDiscoveryInfo>(
602612
const eprosima::fastrtps::rtps::ReaderDiscoveryInfo& reader_info)
@@ -613,7 +623,7 @@ void GraphManager::ParticipantListener::process_discovery_info<eprosima::fastrtp
613623
const std::string type_name = reader_info.info.typeName().to_string();
614624

615625
graphManager_from_->add_datareader(reader_info.info.guid(), topic_name, type_name,
616-
iHandle2GUID(reader_info.info.RTPSParticipantKey()), reader_info.info.m_qos);
626+
iHandle2GUID(reader_info.info.RTPSParticipantKey()), reader_qos_conversion(reader_info.info.m_qos));
617627
break;
618628
}
619629
default:
@@ -640,7 +650,7 @@ void GraphManager::ParticipantListener::process_discovery_info<eprosima::fastrtp
640650
const std::string type_name = writer_info.info.typeName().to_string();
641651

642652
graphManager_from_->add_datawriter(writer_info.info.guid(), topic_name, type_name,
643-
iHandle2GUID(writer_info.info.RTPSParticipantKey()), writer_info.info.m_qos);
653+
iHandle2GUID(writer_info.info.RTPSParticipantKey()), writer_qos_conversion(writer_info.info.m_qos));
644654
break;
645655
}
646656
default:

0 commit comments

Comments
 (0)