eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.69k stars 396 forks source link

how to support string using zero-copy transport #2288

Closed Autostone-c closed 6 months ago

Autostone-c commented 6 months ago

When I use cyclonedds, I send a string using the publisher_member_function of ROS2 and subscribe to rt/topic using pure dds. If SharedMemory is not enabled, I can communicate and receive string data normally. If SharedMemory is enabled, communication is normal, but I receive an empty string

my String.idl `module stdmsgs { module msg { module dds { struct String_ { string data; };

}; }; }; // module msg::std_msgs`

and my dds sub code: `#include "dds/dds.h"

include "String.h"

include "dds/ddsrt/time.h"

include "stdio.h"

include "stdlib.h"

define MAX_SAMPLES 1

int main() { dds_entity_t participant; dds_entity_t topic; dds_entity_t reader; dds_return_t rc; dds_qos_t *qos;

std_msgs_msg_dds_String msg; void samples[MAX_SAMPLES]; dds_sample_info_t infos[MAX_SAMPLES]; uint32_t status = 0;

/ Create a Participant. / participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL); if (participant < 0) DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant)); / Create a Topic. / topic = dds_create_topic ( participant, &std_msgs_msg_ddsStringdesc, "rt/topic", NULL, NULL); if (topic < 0) DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));

/ Create a Reader. / qos = dds_create_qos (); dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10)); reader = dds_create_reader (participant, topic, NULL, NULL); if (reader < 0) DDS_FATAL("dds_create_reader: %s\n", dds_strretcode(-reader));

dds_delete_qos(qos);

printf ("\n=== [Subscriber] Waiting for a sample ...\n"); fflush (stdout);

samples[0] = std_msgs_msg_dds__String___alloc(); / Create a message to write. /

while(1) { /* Do the actual read.

elBoberido commented 6 months ago

@Autostone-c unfortunately we cannot help you with Cyclone DDS issues. Best would be to ask on their repo.

Closing the issue since it is related to the integration of iceoryx into another framework and not iceoryx itself.