mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 06:13:35 +08:00
microRTPS: templates: fix support for ROS2 Dashing
This commit is contained in:
@@ -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")
|
||||
}@
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -75,7 +76,7 @@ bool @(topic)_Subscriber::init()
|
||||
// Create RTPSParticipant
|
||||
ParticipantAttributes PParam;
|
||||
PParam.rtps.builtin.domainId = 0; // MUST BE THE SAME AS IN THE PUBLISHER
|
||||
@[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;
|
||||
@@ -93,15 +94,26 @@ bool @(topic)_Subscriber::init()
|
||||
Rparam.topic.topicKind = NO_KEY;
|
||||
Rparam.topic.topicDataType = myType.getName(); //Must be registered before the creation of the subscriber
|
||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
||||
Rparam.topic.topicName = "@(topic)_PubSubTopic";
|
||||
@[else]@
|
||||
Rparam.topic.topicName = "@(topic)PubSubTopic";
|
||||
@[end if]@
|
||||
@[if ros2_distro]@
|
||||
@[ if ros2_distro == "ardent"]@
|
||||
@[ if ros2_distro]@
|
||||
@[ if ros2_distro == "ardent"]@
|
||||
Rparam.qos.m_partition.push_back("rt");
|
||||
Rparam.topic.topicName = "@(topic)_PubSubTopic";
|
||||
@[ else]@
|
||||
Rparam.topic.topicName = "rt/@(topic)_PubSubTopic";
|
||||
@[ end if]@
|
||||
@[ else]@
|
||||
Rparam.topic.topicName = "rt/" + Rparam.topic.topicName;
|
||||
Rparam.topic.topicName = "@(topic)_PubSubTopic";
|
||||
@[ end if]@
|
||||
@[else]@
|
||||
@[ if ros2_distro]@
|
||||
@[ if ros2_distro == "ardent"]@
|
||||
Rparam.qos.m_partition.push_back("rt");
|
||||
Rparam.topic.topicName = "@(topic)PubSubTopic";
|
||||
@[ else]@
|
||||
Rparam.topic.topicName = "rt/@(topic)PubSubTopic";
|
||||
@[ end if]@
|
||||
@[ else]@
|
||||
Rparam.topic.topicName = "@(topic)PubSubTopic";
|
||||
@[ end if]@
|
||||
@[end if]@
|
||||
mp_subscriber = Domain::createSubscriber(mp_participant, Rparam, static_cast<SubscriberListener*>(&m_listener));
|
||||
|
||||
Reference in New Issue
Block a user