microRTPS: templates: fix support for ROS2 Dashing

This commit is contained in:
TSC21
2019-10-14 23:17:27 +01:00
committed by Nuno Marques
parent f91770f9cd
commit 97e1edc835
5 changed files with 55 additions and 26 deletions
+20 -8
View File
@@ -16,6 +16,7 @@ import gencpp
from px_generate_uorb_topic_helper import * # this is in Tools/
topic = alias if alias else spec.short_name
ros2_distro = ros2_distro.decode("utf-8")
}@
/****************************************************************************
*
@@ -80,7 +81,7 @@ bool @(topic)_Publisher::init()
// Create RTPSParticipant
ParticipantAttributes PParam;
PParam.rtps.builtin.domainId = 0;
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
@[if 1.5 <= fastrtpsgen_version <= 1.7 or ros2_distro == "ardent" or ros2_distro == "bouncy" or ros2_distro == "crystal" or ros2_distro == "dashing"]@
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
@[else]@
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
@@ -98,15 +99,26 @@ bool @(topic)_Publisher::init()
Wparam.topic.topicKind = NO_KEY;
Wparam.topic.topicDataType = myType.getName(); //This type MUST be registered
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
Wparam.topic.topicName = "@(topic)_PubSubTopic";
@[else]@
Wparam.topic.topicName = "@(topic)PubSubTopic";
@[end if]@
@[if ros2_distro]@
@[ if ros2_distro == "ardent"]@
@[ if ros2_distro]@
@[ if ros2_distro == "ardent"]@
Wparam.qos.m_partition.push_back("rt");
Wparam.topic.topicName = "@(topic)_PubSubTopic";
@[ else]@
Wparam.topic.topicName = "rt/@(topic)_PubSubTopic";
@[ end if]@
@[ else]@
Wparam.topic.topicName = "rt/" + Wparam.topic.topicName;
Wparam.topic.topicName = "@(topic)_PubSubTopic";
@[ end if]@
@[else]@
@[ if ros2_distro]@
@[ if ros2_distro == "ardent"]@
Wparam.qos.m_partition.push_back("rt");
Wparam.topic.topicName = "@(topic)PubSubTopic";
@[ else]@
Wparam.topic.topicName = "rt/@(topic)PubSubTopic";
@[ end if]@
@[ else]@
Wparam.topic.topicName = "@(topic)PubSubTopic";
@[ end if]@
@[end if]@
mp_publisher = Domain::createPublisher(mp_participant, Wparam, static_cast<PublisherListener*>(&m_listener));