Издатель и подписчик FastDDS не совпадают в демонстрационном коде ⇐ C++
Издатель и подписчик FastDDS не совпадают в демонстрационном коде
I am trying to set up the Hello World example from the FastDDS tutorial here: https://fast-dds.docs.eprosima.com/en/l ... e_app.html
When I run the publisher and subscriber (separate terminals), they can't find each other. I never get the "Publisher matched" and "Subscriber matched" lines.
What can I look for here? Is there a way to see all the topics that are being published/subscribed to? Is there some configuration to be done to run them on localhost?
All that I can think to do is double check the topic names and add a cout line to print if the publisher wasn't matched. I haven't changed the code from the tutorial page other than adding a print statement so I'm not sure how to proceed.
Here in the Publisher code:
/** * @file HelloWorldPublisher.cpp * */ #include "HelloWorldPubSubTypes.h" #include #include #include #include #include #include #include #include using namespace eprosima::fastdds::dds; class HelloWorldPublisher { private: HelloWorld hello_; DomainParticipant* participant_; Publisher* publisher_; Topic* topic_; DataWriter* writer_; TypeSupport type_; class PubListener : public DataWriterListener { public: PubListener() : matched_(0) { } ~PubListener() override { } void on_publication_matched( DataWriter*, const PublicationMatchedStatus& info) override { if (info.current_count_change == 1) { matched_ = info.total_count; std::cout create_publisher(PUBLISHER_QOS_DEFAULT, nullptr); if (publisher_ == nullptr) { return false; } // Create the DataWriter writer_ = publisher_->create_datawriter(topic_, DATAWRITER_QOS_DEFAULT, &listener_); if (writer_ == nullptr) { return false; } return true; } //!Send a publication bool publish() { if (listener_.matched_ > 0) { hello_.index(hello_.index() + 1); writer_->write(&hello_); return true; } return false; } //!Run the Publisher void run( uint32_t samples) { uint32_t samples_sent = 0; while (samples_sent < samples) { if (publish()) { samples_sent++; std::cout
Источник: https://stackoverflow.com/questions/780 ... -demo-code
I am trying to set up the Hello World example from the FastDDS tutorial here: https://fast-dds.docs.eprosima.com/en/l ... e_app.html
When I run the publisher and subscriber (separate terminals), they can't find each other. I never get the "Publisher matched" and "Subscriber matched" lines.
What can I look for here? Is there a way to see all the topics that are being published/subscribed to? Is there some configuration to be done to run them on localhost?
All that I can think to do is double check the topic names and add a cout line to print if the publisher wasn't matched. I haven't changed the code from the tutorial page other than adding a print statement so I'm not sure how to proceed.
Here in the Publisher code:
/** * @file HelloWorldPublisher.cpp * */ #include "HelloWorldPubSubTypes.h" #include #include #include #include #include #include #include #include using namespace eprosima::fastdds::dds; class HelloWorldPublisher { private: HelloWorld hello_; DomainParticipant* participant_; Publisher* publisher_; Topic* topic_; DataWriter* writer_; TypeSupport type_; class PubListener : public DataWriterListener { public: PubListener() : matched_(0) { } ~PubListener() override { } void on_publication_matched( DataWriter*, const PublicationMatchedStatus& info) override { if (info.current_count_change == 1) { matched_ = info.total_count; std::cout create_publisher(PUBLISHER_QOS_DEFAULT, nullptr); if (publisher_ == nullptr) { return false; } // Create the DataWriter writer_ = publisher_->create_datawriter(topic_, DATAWRITER_QOS_DEFAULT, &listener_); if (writer_ == nullptr) { return false; } return true; } //!Send a publication bool publish() { if (listener_.matched_ > 0) { hello_.index(hello_.index() + 1); writer_->write(&hello_); return true; } return false; } //!Run the Publisher void run( uint32_t samples) { uint32_t samples_sent = 0; while (samples_sent < samples) { if (publish()) { samples_sent++; std::cout
Источник: https://stackoverflow.com/questions/780 ... -demo-code
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как я могу использовать это в демонстрационном базовом слое вен для сквозной задержки
Anonymous » » в форуме C++ - 0 Ответы
- 29 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Не могу отобразить вид сетки внутри списка в моем демонстрационном приложении Flutter
Anonymous » » в форуме Android - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-