eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
889 stars 363 forks source link

Is there a way to record and replay cyclonedds? #2135

Open gaochengGG opened 1 week ago

gaochengGG commented 1 week ago

I want to record the published data when using cyclonedds, and then store it in some way, so that I can replay the data when needed. Does cyclonedds provide tools to do this? If not, can you give me some pointers? I want to develop this tool. What I think may be stuck in my points. Does cyclonedds provide tools like "topic list" to let me know the node information? What format and how to store the data after I create a subscription to publish the message, and how to read the data for replay?

eboasson commented 6 days ago

There is not currently a recorder, but it can be made fairly easily, especially in Python. Indeed, it would be a nice extension for the python command-line tool (see https://github.com/eclipse-cyclonedds/cyclonedds-python). It can also be done fairly easily in C, all the basic primitives exist.

You might want to look at the discussion in https://github.com/eclipse-cyclonedds/cyclonedds/issues/2099, that contains some suggestions for reading/writing any topic, and getting the CDR in/out without even bothering with the types. The scenario there is different, but those would also be the basic operations for you, I think.

The type of the data can also be obtained, and then you can write the CDR representation and the type definitions. That way you have a self-contained recording. If you want the types, you might also want to have a look at https://github.com/eclipse-cyclonedds/cyclonedds/tree/master/examples/listtopics and https://github.com/eclipse-cyclonedds/cyclonedds/tree/master/examples/dynsub.

gaochengGG commented 5 days ago

There is not currently a recorder, but it can be made fairly easily, especially in Python. Indeed, it would be a nice extension for the python command-line tool (see https://github.com/eclipse-cyclonedds/cyclonedds-python). It can also be done fairly easily in C, all the basic primitives exist.

You might want to look at the discussion in #2099, that contains some suggestions for reading/writing any topic, and getting the CDR in/out without even bothering with the types. The scenario there is different, but those would also be the basic operations for you, I think.

The type of the data can also be obtained, and then you can write the CDR representation and the type definitions. That way you have a self-contained recording. If you want the types, you might also want to have a look at https://github.com/eclipse-cyclonedds/cyclonedds/tree/master/examples/listtopics and https://github.com/eclipse-cyclonedds/cyclonedds/tree/master/examples/dynsub.

still have some questions I hope to get your advice. As for how to store the received data, I investigated cyberrt reord and ros2 bag record. Cyberrt uses a custom data structure to store data, and ros2 uses sqlite3 to store data. What facility do you suggest I use to store cyclonedds data?