44 const std::string& topic_name,
49 type_.reset(
new MsgPubSubType());
50 type_.register_type(node_->participant());
54 topic_ = node_->participant()->find_topic(topic_name, eprosima::fastdds::dds::Duration_t(1));
55 if (topic_ ==
nullptr)
57 topic_ = node_->participant()->create_topic(
58 topic_name, type_.get_type_name(),
59 eprosima::fastdds::dds::TOPIC_QOS_DEFAULT);
63 pub_ = node_->participant()->create_publisher(
64 eprosima::fastdds::dds::PUBLISHER_QOS_DEFAULT,
nullptr);
66 eprosima::fastdds::dds::DataWriterQos wqos;
67 wqos.history().kind = eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS;
68 wqos.history().depth = qos_depth;
69 writer_ = pub_->create_datawriter(topic_, wqos);