microRTPS bridge: fix templates for ROS2 usage

This commit is contained in:
TSC21
2019-10-14 14:59:42 +01:00
committed by Nuno Marques
parent 3007b0876c
commit 88a7e3df09
5 changed files with 101 additions and 5 deletions
+22 -2
View File
@@ -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<SubscriberListener*>(&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;