Method and system for realizing recording and playback based on lightweight DDS (Direct Digital Synthesizer)

By converting IDL files into XML type definition files and configuring them into the Recording Service, the problem of lightweight DDS not supporting TypeInfo is solved, enabling data recording and playback of embedded devices. This is suitable for debugging and analysis of embedded distributed systems and reduces memory usage.

CN120909766APending Publication Date: 2025-11-07AUTOCORE INTELLIGENT TECH (NANJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510891202.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

The existing lightweight DDS does not support sending TypeInfo information, which makes traditional data recording tools unusable, consumes a lot of memory, and causes memory resource shortages in embedded devices.

Method used

The user-defined TypeInfo information IDL file is converted into an XML type definition file, and the XML type definition file, along with the associated topic information and data type definition, is added to the Recording Service configuration file. Data recording and playback are then performed using Record and Replay tools.

Benefits of technology

It implements lightweight DDS data recording and playback functions in embedded devices, solves the problem of tight memory resources, and is suitable for debugging, analysis and simulation of embedded distributed real-time systems, reducing configuration steps and error risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909766A_ABST
    Figure CN120909766A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of embedded systems and real-time communication, in particular to a method for achieving recording and playback based on a lightweight DDS, and the method comprises the steps: converting an IDL file of user-defined TypeInfo information into an XML type definition file; the XML type definition file as well as the topic information and the data type definition which are associated with the XML type definition file are added into a configuration file of a Recencing Service; and carrying out data recording, publishing and playback according to the topic information, the data type definition and the XML type definition file. According to the method, the IDL file of the user-defined TypeInfo information is converted into the XML type definition file, and the information of the XML type definition file is added into the Receiving Service configuration file, so that the problem that the existing lightweight DDS equipment does not support the TypeInfo function is solved, the functions of recording and playback of theme data released by the embedded lightweight DDS are realized, and the user experience is improved. And meanwhile, the problem of memory resource shortage of embedded equipment (especially an MCU) is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of embedded systems and real-time communication technology, in particular to a method and system for realizing recording and playback based on lightweight DDS. BACKGROUND

[0002] Lightweight DDS (Data Distribution Service) is a data distribution service middleware optimized for resource-constrained environments, mainly applied in embedded systems, intelligent vehicles, Internet of Things and other fields.

[0003] Existing lightweight DDS work is mostly based on the XRCE DDS specification formulated by the Object Management Group (OMG). The specification runs the complex DDS protocol stack on the proxy server through the client / proxy mode, and the client only needs to run the lightweight XRCE DDS protocol stack, realizing the lightweight DDS design for resource-constrained hardware platforms.

[0004] However, the existing lightweight DDS does not support sending TypeInfo information, so that the traditional data recording tool cannot be directly used. However, the traditional data recording tool needs TypeInfo to create a topic, but occupies a large amount of memory, thereby causing the memory resources of embedded devices (especially MCUs) to be tight, so that the lightweight DDS cannot support the topic feature.

[0005] Therefore, a method and system for realizing recording and playback based on lightweight DDS are proposed. SUMMARY

[0006] The purpose of the present application is to provide a method and system for realizing recording and playback based on lightweight DDS, which solves the problem that the existing lightweight DDS does not support sending TypeInfo information and the traditional data recording tool uses TypeInfo to create a topic, but occupies a large amount of memory, causing the memory resources of embedded devices to be tight.

[0007] To achieve the above purpose, on the one hand, the present application provides a method for realizing recording and playback based on lightweight DDS, comprising the following steps: S1, converting the IDL file of user-defined TypeInfo information into an XML type definition file; S2, adding the XML type definition file, topic information associated with the XML type definition file and data type definition in the configuration file of the Recording Service; S3, recording, publishing and replaying data according to the topic information, the data type definition and the XML type definition file.

[0008] Preferably, in step S1, the IDL file is converted into the XML type definition file by using a ddsgen command line tool.

[0009] Preferably, in step S3, the data is recorded by using a Record tool, and the Record tool is started by using a command line.

[0010] Preferably, in step S3, the data is replayed by using a Replay tool.

[0011] In another aspect, the present application also provides a system for recording and replaying based on lightweight DDS, which is used for executing the method for recording and replaying based on lightweight DDS.

[0012] Compared with the prior art, the present application has the following beneficial effects: By converting the IDL file for defining TypeInfo information into an XML type definition file and configuring the XML type definition file into a Recording Service, the recording and replaying functions of the topic data published by the embedded lightweight DDS are realized. The problem that the lightweight DDS does not support TypeInfo is solved, and the method is suitable for the debugging, analysis and simulation of various embedded distributed real-time systems. In addition, the method can save steps, reduce errors, overcome the problem of insufficient memory resources of embedded devices (especially MCUs), reduce the occupation of memory resources, and the configuration can be flexibly applied to different scenes. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 FIG. 1 is a flowchart of the method of the present application; Figure 2 FIG. 2 is a schematic diagram of the system module of the present application. DETAILED DESCRIPTION

[0014] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. The embodiments described below are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0015] Please refer to Figure 1 The present embodiment provides a method for recording and replaying based on lightweight DDS, which includes the following steps: Step 1: Convert the user-defined TypeInfo information IDL file to an XML type definition file; Using the ddsgen tool, the IDL file is converted to an XML type definition file. User-defined data types can be converted to XML format, and the recording tool can parse the XML to create user data structures. Based on the parsed data structure, topics are created, and data transmission is performed. The entire process does not require recompilation of the application, only the XML configuration file needs to be modified.

[0016] In DDS (Data Distribution Service), topics are used to define and manage data publishing and subscription. Topics are the bridge between publishers and subscribers, defining the type of data and related quality of service (QoS) policies.

[0017] The following is an example of a user-defined IDL file, HelloWorld.idl: struct HelloWorld { string<128>msg; }; Then execute ddsgen-idl2xml HelloWorld.idl file, and the generated XML file HelloWorld_type.xml is used as the XML type definition file, as shown below: <?xml version="1.0" encoding="UTF-8"?> <types> <struct name="HelloWorld"> <member name="msg" stringMaxLength="128" type="string" / > < / struct> < / types> Step 2: Add the XML type definition file and the topic information associated with the XML type definition file and data type definition in the configuration file of the Recording Service; Add the generated XML type definition file and the topic information associated with the XML type definition file and data type definition information to the configuration file of the Recording Service. This facilitates data recording, playback, intelligent analysis, and flexible application in different scenarios, while reducing memory resource occupation.

[0018] Recording Service is a functional module of DDS (Data Distribution Service) that captures and stores data transmitted through the DDS network. It allows users to record data at runtime and save it to files or databases for subsequent analysis, playback, or processing. To add the generated XML type definition file to the Recording Service's configuration file, run the following command:

[0019] For example, add the generated XML type definition file to the Recording Service's configuration file HelloWorld_record_cfg.xml as follows: <?xml version="1.0" encoding="UTF-8"?> <dds> <recorder_service> <configuration name="example"> <participant> <domain_id>0< / domain_id> < / participant> <data_reader> <topic_name>HelloWorld< / topic_name> <type_name>HelloWorld< / type_name> <type_definition_file>HelloWorld_type.xml< / type_definition_file> < / data_reader> <database> <file_name>sample.dat< / file_name> < / database> < / configuration> < / recorder_service> < / dds> Step 3: Perform data recording, publishing, and playback based on the topic information, data type definition, and XML type definition file. As shown in the following code, the recording tool reads the topic information, data type definition, and stored database file name from the configuration file when loading the XML configuration file. It dynamically creates a subscription endpoint and stores the obtained user data and QoS information in the local database file. Figure 2

[0020] The data recording tool uses the Record tool as an example. Based on the DDS version used, it runs the corresponding Record tool to record the published samples. It stores the information read from the XML configuration file in the database.

[0021] Execute the command: dds_recording -cfile HelloWorld_record_cfg.xml -cname example.

[0022] The Record tool is a powerful open-source project designed to simplify and optimize the data recording process. It provides a simple API that allows users to easily store, retrieve, and manipulate large amounts of data.

[0023] Start the Publisher application: Ensure that the Publisher and Record tool use the same domain ID for communication. The Publisher application is a key component in DDS that is responsible for publishing data to the DDS network.

[0024] ​Start the Publisher application and publish data on domain 0, as follows: $. / HelloWorld_publisher Hello World! (0) Hello World! (1) Matched a subscriber Hello World! (3) Verify recorded data: Use the Replay tool to play back recorded data, and use sqlite3 to check the database file. The Replay tool reads the configuration file and performs data playback based on the settings specified in the configuration file, such as domain, topic, playback frequency, and playback start time. The entire process does not require recompilation of the application, and the Replay tool dynamically obtains data types, QoS information, topic information, and other information, dynamically creates topics and publisher endpoints, and performs data playback. After receiving the data, the receiver application can perform data verification.

[0025] The Replay tool is a software tool used to play back recorded data and is widely used in various fields, including database testing, network request simulation, and audio processing. SQLite3 is a lightweight embedded relational database management system widely used in various applications, especially those that require lightweight, serverless, and zero-configuration databases.

[0026] The configuration file for replaying data, helloworld_replay_cfg.xml, is as follows: <dds> <!-- Define types --> <types> <!-- External XML file containing the HelloWorld type definition --> <include file=". / HelloWorld_type.xml" / > < / types> <!-- Configure Replay Service instance --> <replay_service name="example"> <!-- Store configuration --> <storage> <!-- Use SQLite as storage backend --> <sqlite> <!-- Set the database directory to the current working directory --> <database_dir>.< / database_dir> < / sqlite> < / storage> <!-- Domain participant configuration --> <domain_participant name="DefaultParticipant"> <!-- Set domain ID to 0 --> <domain_id>0< / domain_id> <!-- Register type HelloWorld, referencing HelloWorld type definition --> <register_type name="HelloWorld" type_ref="HelloWorld" / > < / domain_participant> <!-- Session configuration --> <session name="DefaultSession" default_participant_ref="DefaultParticipant"> <!-- Topic group configuration --> <topic_group name="DefaultTopicGroup"> <!-- Allow playback of all topic names --> <allow_topic_name_filter>*< / allow_topic_name_filter> <!-- Deny playback of topic names starting with 'xyz / ' --> <deny_topic_name_filter>xyz / *< / deny_topic_name_filter> <!-- Add playback rate configuration --> <playback_rate> <!-- Set playback rate to 2 times real-time rate --> <rate_multiplier>2.0< / rate_multiplier> < / playback_rate> <!-- Add playback start delay configuration --> <start_delay> <!-- Set delay time before playback starts to 5 seconds --> <sec> 5< / sec> <nanosec> 0< / nanosec> < / start_delay> < / topic_group> < / session> < / replay_service> < / dds> Use the Replay tool to play back data: $ dds_replay -cfile helloworld_replay_cfg.xml -cname example Replay Service starting... Or use sqlite3 to view the database file: $ sqlite3 simple_config.dat sqlite>.tables Example HelloWorld@0 sqlite>select * from "Example HelloWorld@0"; The embodiment also provides a system for realizing recording and playback based on the lightweight DDS, which is used for executing the lightweight DDS recording and playback method. Figure 2 An exemplary embodiment is shown, which comprises the following modules: A control module is used for generating and issuing the XML configuration, starting and stopping the recording and playback tool, and querying and modifying the database file; A data acquisition module is used for parsing the XML configuration and recording the data acquisition; A data storage module is used for storing the information in the data table, and supporting the addition, deletion, query and modification of the database content, wherein the information includes user data, QoS, time stamp and the like; A data playback module is used for parsing the XML configuration, reading and publishing the information, and can configure diversified publishing parameters for the user to analyze the information.

[0027] The working principle of the embodiment is as follows: the IDL file of the user-defined TypeInfo information is converted into an XML type definition file, the XML type definition file and the topic information and data type definition information associated with the XML type definition file are configured into the configuration file of the Recording Service, then the data recording, publishing and playback are performed according to the topic information, data type definition and XML type definition file, the recording and playback functions of the topic data of the embedded lightweight DDS publishing are realized; not only the problem of the lightweight DDS not supporting TypeInfo is solved, but also the debugging, analysis and simulation requirements of various embedded distributed real-time systems are applicable; in addition, the steps can be saved and the errors can be reduced in the configuration process, the problem of the memory resource shortage of the embedded device (especially the MCU) is overcome, the occupation of the memory resource is reduced, and the configuration can be flexibly applied to different scenes.

[0028] The embodiments of the present application have been shown and described, and various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present application, the scope of the present application being defined by the appended claims and their equivalents.

Claims

1. A method for realizing recording and playback based on lightweight DDS, characterized in that, The method comprises the following steps: S1, converting an IDL file of user-defined TypeInfo information into an XML type definition file; S2, adding the XML type definition file and topic information and data type definition associated with the XML type definition file in a configuration file of a Recording Service; S3, recording, publishing and playing back data according to the topic information, data type definition and XML type definition file.

2. The method for realizing recording and playing back based on lightweight DDS according to claim 1, characterized in that, In step S1, the IDL file is converted into the XML type definition file through a ddsgen command line tool.

3. The method for realizing recording and playing back based on lightweight DDS according to claim 1, characterized in that, In step S3, the data is recorded through a Record tool, and the Record tool is started through a command line.

4. The method for realizing recording and playing back based on lightweight DDS according to claim 1, characterized in that, In step S3, the data is played back through a Replay tool.

5. A system for realizing recording and playback based on lightweight DDS, characterized in that, The system is used for executing the method in any one of claims 1-4.