diff --git a/msg/templates/urtps/Publisher.cpp.em b/msg/templates/urtps/Publisher.cpp.em index df87d9cbb9..2d0ed1f51c 100644 --- a/msg/templates/urtps/Publisher.cpp.em +++ b/msg/templates/urtps/Publisher.cpp.em @@ -102,8 +102,12 @@ bool @(topic)_Publisher::init() @[else]@ Wparam.topic.topicName = "@(topic)PubSubTopic"; @[end if]@ -@[if ros2_distro and ros2_distro != "ardent"]@ +@[if ros2_distro]@ +@[ if ros2_distro == "ardent"]@ + Wparam.qos.m_partition.push_back("rt"); +@[ else]@ Wparam.topic.topicName = "rt/" + Wparam.topic.topicName; +@[ end if]@ @[end if]@ mp_publisher = Domain::createPublisher(mp_participant, Wparam, static_cast(&m_listener)); if(mp_publisher == nullptr) @@ -139,9 +143,17 @@ void @(topic)_Publisher::run() // Publication code @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_ st; +@[ else]@ @(topic)_ st; +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic) st; +@[ else]@ @(topic) st; +@[ end if]@ @[end if]@ /* Initialize your structure here */ @@ -168,9 +180,17 @@ void @(topic)_Publisher::run() } @[if 1.5 <= fastrtpsgen_version <= 1.7]@ -void @(topic)_Publisher::publish(@(topic)_* st) +@[ if ros2_distro]@ + void @(topic)_Publisher::publish(@(package)::msg::dds_::@(topic)_* st) +@[ else]@ + void @(topic)_Publisher::publish(@(topic)_* st) +@[ end if]@ @[else]@ -void @(topic)_Publisher::publish(@(topic)* st) +@[ if ros2_distro]@ + void @(topic)_Publisher::publish(@(package)::msg::@(topic)* st) +@[ else]@ + void @(topic)_Publisher::publish(@(topic)* st) +@[ end if]@ @[end if]@ { mp_publisher->write(st); diff --git a/msg/templates/urtps/Publisher.h.em b/msg/templates/urtps/Publisher.h.em index e32a86aa33..da74a5c0b4 100644 --- a/msg/templates/urtps/Publisher.h.em +++ b/msg/templates/urtps/Publisher.h.em @@ -81,9 +81,17 @@ public: bool init(); void run(); @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + void publish(@(package)::msg::dds_::@(topic)_* st); +@[ else]@ void publish(@(topic)_* st); +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + void publish(@(package)::msg::@(topic)* st); +@[ else]@ void publish(@(topic)* st); +@[ end if]@ @[end if]@ private: Participant *mp_participant; @@ -98,9 +106,17 @@ private: int n_matched; } m_listener; @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_PubSubType myType; +@[ else]@ @(topic)_PubSubType myType; +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic)PubSubType myType; +@[ else]@ @(topic)PubSubType myType; +@[ end if]@ @[end if]@ }; diff --git a/msg/templates/urtps/RtpsTopics.cpp.em b/msg/templates/urtps/RtpsTopics.cpp.em index 18f0f94bd4..2b5e1e97cf 100644 --- a/msg/templates/urtps/RtpsTopics.cpp.em +++ b/msg/templates/urtps/RtpsTopics.cpp.em @@ -93,9 +93,17 @@ void RtpsTopics::publish(uint8_t topic_ID, char data_buffer[], size_t len) case @(rtps_message_id(ids, topic)): // @(topic) { @[ if 1.5 <= fastrtpsgen_version[0] <= 1.7]@ +@[ if ros2_distro[0]]@ + @(package[0])::msg::dds_::@(topic)_ st; +@[ else]@ @(topic)_ st; +@[ end if]@ @[ else]@ +@[ if ros2_distro[0]]@ + @(package[0])::msg::@(topic) st; +@[ else]@ @(topic) st; +@[ end if]@ @[ end if]@ eprosima::fastcdr::FastBuffer cdrbuffer(data_buffer, len); eprosima::fastcdr::Cdr cdr_des(cdrbuffer); @@ -150,9 +158,17 @@ bool RtpsTopics::getMsg(const uint8_t topic_ID, eprosima::fastcdr::Cdr &scdr) if (_@(topic)_sub.hasMsg()) { @[ if 1.5 <= fastrtpsgen_version[0] <= 1.7]@ +@[ if ros2_distro[0]]@ + @(package[0])::msg::dds_::@(topic)_ msg = _@(topic)_sub.getMsg(); +@[ else]@ @(topic)_ msg = _@(topic)_sub.getMsg(); +@[ end if]@ @[ else]@ +@[ if ros2_distro[0]]@ + @(package[0])::msg::@(topic) msg = _@(topic)_sub.getMsg(); +@[ else]@ @(topic) msg = _@(topic)_sub.getMsg(); +@[ end if]@ @[ end if]@ msg.serialize(scdr); ret = true; diff --git a/msg/templates/urtps/Subscriber.cpp.em b/msg/templates/urtps/Subscriber.cpp.em index a30ffe7df3..c245782502 100644 --- a/msg/templates/urtps/Subscriber.cpp.em +++ b/msg/templates/urtps/Subscriber.cpp.em @@ -97,8 +97,12 @@ bool @(topic)_Subscriber::init() @[else]@ Rparam.topic.topicName = "@(topic)PubSubTopic"; @[end if]@ -@[if ros2_distro and ros2_distro != "ardent"]@ - Rparam.topic.topicName = "rt/" + Wparam.topic.topicName; +@[if ros2_distro]@ +@[ if ros2_distro == "ardent"]@ + Rparam.qos.m_partition.push_back("rt"); +@[ else]@ + Rparam.topic.topicName = "rt/" + Rparam.topic.topicName; +@[ end if]@ @[end if]@ mp_subscriber = Domain::createSubscriber(mp_participant, Rparam, static_cast(&m_listener)); if(mp_subscriber == nullptr) @@ -126,9 +130,17 @@ void @(topic)_Subscriber::SubListener::onNewDataMessage(Subscriber* sub) { // Take data @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_ st; +@[ else]@ @(topic)_ st; +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic) st; +@[ else]@ @(topic) st; +@[ end if]@ @[end if]@ if(sub->takeNextData(&st, &m_info)) @@ -157,9 +169,17 @@ bool @(topic)_Subscriber::hasMsg() } @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ +@(package)::msg::dds_::@(topic)_ @(topic)_Subscriber::getMsg() +@[ else]@ @(topic)_ @(topic)_Subscriber::getMsg() +@[ end if]@ @[else]@ +@[ if ros2_distro]@ +@(package)::msg::@(topic) @(topic)_Subscriber::getMsg() +@[ else]@ @(topic) @(topic)_Subscriber::getMsg() +@[ end if]@ @[end if]@ { m_listener.has_msg = false; diff --git a/msg/templates/urtps/Subscriber.h.em b/msg/templates/urtps/Subscriber.h.em index a9a9de8248..e3e27b4df2 100644 --- a/msg/templates/urtps/Subscriber.h.em +++ b/msg/templates/urtps/Subscriber.h.em @@ -82,9 +82,17 @@ public: void run(); bool hasMsg(); @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_ getMsg(); +@[ else]@ @(topic)_ getMsg(); +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic) getMsg(); +@[ else]@ @(topic) getMsg(); +@[ end if]@ @[end if]@ private: Participant *mp_participant; @@ -101,17 +109,33 @@ private: int n_matched; int n_msg; @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_ msg; +@[ else]@ @(topic)_ msg; +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic) msg; +@[ else]@ @(topic) msg; +@[ end if]@ @[end if]@ bool has_msg = false; } m_listener; @[if 1.5 <= fastrtpsgen_version <= 1.7]@ +@[ if ros2_distro]@ + @(package)::msg::dds_::@(topic)_PubSubType myType; +@[ else]@ @(topic)_PubSubType myType; +@[ end if]@ @[else]@ +@[ if ros2_distro]@ + @(package)::msg::@(topic)PubSubType myType; +@[ else]@ @(topic)PubSubType myType; +@[ end if]@ @[end if]@ };