Open yuzu-ogura opened 1 day ago
publisher could not publish data, because it has no transport
publisher can also publish data through Shared Memory, because I found files in the /dev/shm
edit base the example of HelloWorldExampleSharedMem: publish.cpp:
HelloWorldExampleSharedMem
bool HelloWorldPublisher::init() { m_Hello = std::make_shared<HelloWorld>(); m_Hello->index(0); m_Hello->message("HelloWorld"); ParticipantAttributes PParam; PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE; PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true; PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true; PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true; PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite; PParam.rtps.setName("Participant_pub"); // SharedMem transport configuration PParam.rtps.useBuiltinTransports = false; auto shm_transport = std::make_shared<SharedMemTransportDescriptor>(); shm_transport->segment_size(2 * 1024 * 1024); //PParam.rtps.userTransports.push_back(shm_transport); // UDP auto udp_transport = std::make_shared<UDPv4TransportDescriptor>(); //udp_transport->interfaceWhiteList.push_back("127.0.0.1"); //PParam.rtps.userTransports.push_back(udp_transport); mp_participant = Domain::createParticipant(PParam); if (mp_participant == nullptr) { return false; } //REGISTER THE TYPE Domain::registerType(mp_participant, &m_type); //CREATE THE PUBLISHER PublisherAttributes Wparam; Wparam.topic.topicKind = NO_KEY; Wparam.topic.topicDataType = "HelloWorld"; Wparam.topic.topicName = "HelloWorldSharedMemTopic"; Wparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS; Wparam.topic.historyQos.depth = 30; Wparam.topic.resourceLimitsQos.max_samples = 50; Wparam.topic.resourceLimitsQos.allocated_samples = 20; Wparam.times.heartbeatPeriod.seconds = 2; Wparam.times.heartbeatPeriod.nanosec = 200 * 1000 * 1000; Wparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; Wparam.qos.m_publishMode.kind = ASYNCHRONOUS_PUBLISH_MODE; mp_publisher = Domain::createPublisher(mp_participant, Wparam, (PublisherListener*)&m_listener); if (mp_publisher == nullptr) { return false; } return true; }
subscribe.cpp:
bool HelloWorldSubscriber::init() { ParticipantAttributes PParam; PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE; PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true; PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true; PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true; PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite; PParam.rtps.setName("Participant_sub"); // SharedMem transport configuration PParam.rtps.useBuiltinTransports = false; auto sm_transport = std::make_shared<SharedMemTransportDescriptor>(); sm_transport->segment_size(2 * 1024 * 1024); //PParam.rtps.userTransports.push_back(sm_transport); // UDP auto udp_transport = std::make_shared<UDPv4TransportDescriptor>(); //udp_transport->interfaceWhiteList.push_back("127.0.0.1"); PParam.rtps.userTransports.push_back(udp_transport); mp_participant = Domain::createParticipant(PParam); if (mp_participant == nullptr) { return false; } //REGISTER THE TYPE Domain::registerType(mp_participant, &m_type); //CREATE THE SUBSCRIBER SubscriberAttributes Rparam; Rparam.topic.topicKind = NO_KEY; Rparam.topic.topicDataType = "HelloWorld"; Rparam.topic.topicName = "HelloWorldSharedMemTopic"; Rparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS; Rparam.topic.historyQos.depth = 30; Rparam.topic.resourceLimitsQos.max_samples = 50; Rparam.topic.resourceLimitsQos.allocated_samples = 20; Rparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; Rparam.qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; mp_subscriber = Domain::createSubscriber(mp_participant, Rparam, (SubscriberListener*)&m_listener); if (mp_subscriber == nullptr) { return false; } return true; }
v2.6.8
Ubuntu Focal 20.04 amd64
Shared Memory Transport (SHM)
No response
Hi @yuzu-ogura,
That example seems to be using the deprecated API. Could you please check if the behavior pesists using the same example but in the DDS subfolder ?
DDS
Is there an already existing issue for this?
Expected behavior
publisher could not publish data, because it has no transport
Current behavior
publisher can also publish data through Shared Memory, because I found files in the /dev/shm
Steps to reproduce
edit base the example of
HelloWorldExampleSharedMem
: publish.cpp:subscribe.cpp:
Fast DDS version/commit
v2.6.8
Platform/Architecture
Ubuntu Focal 20.04 amd64
Transport layer
Shared Memory Transport (SHM)
Additional context
No response
XML configuration file
No response
Relevant log output
No response
Network traffic capture
No response