mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 06:53:35 +08:00
microRTPS: agent: split FMU input from output topics in Pubs/Subs
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
@{
|
||||
from packaging import version
|
||||
import genmsg.msgs
|
||||
import re
|
||||
|
||||
from px_generate_uorb_topic_helper import * # this is in Tools/
|
||||
|
||||
@@ -21,6 +22,17 @@ try:
|
||||
ros2_distro = ros2_distro.decode("utf-8")
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
topic_name = topic
|
||||
|
||||
# For ROS, use the topic pattern convention defined in
|
||||
# http://wiki.ros.org/ROS/Patterns/Conventions
|
||||
if ros2_distro:
|
||||
topic_name_split = re.sub( r"([A-Z])", r" \1", topic).split()
|
||||
topic_name = topic_name_split[0]
|
||||
for w in topic_name_split[1:]:
|
||||
topic_name += "_" + w
|
||||
topic_name = topic_name.lower()
|
||||
}@
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -88,7 +100,8 @@ using SharedMemTransportDescriptor = eprosima::fastdds::rtps::SharedMemTransport
|
||||
}
|
||||
|
||||
bool @(topic)_Subscriber::init(uint8_t topic_ID, std::condition_variable *t_send_queue_cv,
|
||||
std::mutex *t_send_queue_mutex, std::queue<uint8_t> *t_send_queue, const std::string &ns)
|
||||
std::mutex *t_send_queue_mutex, std::queue<uint8_t> *t_send_queue, const std::string &ns,
|
||||
std::string topic_name)
|
||||
{
|
||||
m_listener.topic_ID = topic_ID;
|
||||
m_listener.t_send_queue_cv = t_send_queue_cv;
|
||||
@@ -162,19 +175,15 @@ bool @(topic)_Subscriber::init(uint8_t topic_ID, std::condition_variable *t_send
|
||||
@[ if ros2_distro == "ardent"]@
|
||||
Rparam.qos.m_partition.push_back("rt");
|
||||
std::string topicName = ns;
|
||||
topicName.append("@(topic)_PubSubTopic");
|
||||
Rparam.topic.topicName = topicName;
|
||||
@[ else]@
|
||||
std::string topicName = "rt/";
|
||||
topicName.append(ns);
|
||||
topicName.append("@(topic)_PubSubTopic");
|
||||
Rparam.topic.topicName = topicName;
|
||||
@[ end if]@
|
||||
@[else]@
|
||||
std::string topicName = ns;
|
||||
topicName.append("@(topic)PubSubTopic");
|
||||
Rparam.topic.topicName = topicName;
|
||||
@[end if]@
|
||||
topic_name.empty() ? topicName.append("fmu/@(topic_name)/in") : topicName.append(topic_name);
|
||||
Rparam.topic.topicName = topicName;
|
||||
mp_subscriber = Domain::createSubscriber(mp_participant, Rparam, static_cast<SubscriberListener *>(&m_listener));
|
||||
|
||||
if (mp_subscriber == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user