Code deployment method and system based on model generation

By acquiring the communication matrix and generating intermediate language description information, the rapid deployment and adaptation of algorithm models in the field of mobile robots is solved, and multi-platform operation is realized, reducing development costs and improving efficiency.

CN120276741APending Publication Date: 2025-07-08BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510462741.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the field of mobile robots, existing technology relies on platforms such as MATLAB/Simulink and Labview to deploy and operate visual algorithm models, resulting in high development costs and large system errors, making it difficult to adapt to the rapid change of technology development, and adaptation of different communication middlewares is difficult.

Method used

Through information interaction based on the robot application module, the communication matrix is obtained, the intermediate language description information is analyzed, the data type mapping relationship and framework code are generated, the algorithm model is connected to the communication middleware, and the interoperability of different communication middleware is realized.

Benefits of technology

The rapid deployment and operation of visual algorithm models in different communication middleware is realized, which reduces development costs, improves developers' efficiency, and eliminates system errors between simulation and actual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276741A_ABST
    Figure CN120276741A_ABST
Patent Text Reader

Abstract

The invention discloses a code deployment method and system based on model generation, and relates to the technical field of mobile robots, and the method comprises the steps: obtaining a communication matrix based on information interaction between robot application modules; analyzing based on the communication matrix to obtain intermediate language description information; generating a data type mapping relation and a frame code based on the intermediate language description information; generating a communication interface code based on the intermediate language description information and the data type mapping relation; obtaining a glue code based on the frame code and the communication interface code; and realizing intercommunication of different communication middleware based on the glue code connection algorithm model and the communication middleware. According to the method, rapid deployment and operation of the visual algorithm model in different communication middleware are realized, so that the efficiency of developers is improved, and the development cost of switching the algorithm model in different communication middleware is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mobile robots, and more particularly to a code deployment method and system based on model generation. Background Art

[0002] Currently, in the field of mobile robots, there are a large number of software applications, which can be divided into three categories: operating system, middleware, and application layer. Specifically, there are application layer programs to solve specific business requirements, middleware software to coordinate different applications and operating system resources, and an operating system to manage device resources. In this huge system composed of these software, a perfect way is needed to realize the connection between each layer of software to achieve the decoupling of functions between different layers of software. Among them, the intercommunication between the application layer and the middleware software is particularly important.

[0003] The existing method of generating algorithm code based on a visualization model often relies on mature commercial tools such as MATLAB / Simulink and Labview to build a visualization algorithm model, and can support methods such as "software-in-the-loop" and "hardware-in-the-loop" to verify the algorithm model.

[0004] However, the existing methods strongly depend on the MATLAB / Simulink and Labview development platforms themselves for deployment and operation, which causes great trouble for rapid deployment and operation on the embedded side. Secondly, the modules provided by these software platforms to adapt to different communication middleware often require significant modification to the algorithm model itself, and cannot achieve the goal of one-time development and multi-platform operation, potentially causing systematic errors in the simulation process and the actual operation process, which are difficult to eliminate. Thirdly, the methods provided by these platforms to adapt to different middleware modules have limited types of compatible communication middleware, and it is difficult to adapt to the characteristics of new communication middleware in a timely manner. This results in a strong dependence on the development platform and is difficult to adapt to the development of the mobile robot field with rapid technological changes.

[0005] Therefore, how to realize the rapid deployment and operation of a visualization algorithm model in different communication middleware, thereby improving the efficiency of developers and greatly reducing the development cost of switching the algorithm model between different communications is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0006] In view of this, the present invention provides a code deployment method and system based on model generation, which realizes the rapid deployment and operation of a visualization algorithm model in different communication middleware, thereby improving the efficiency of developers and greatly reducing the development cost of switching the algorithm model between different communications.

[0007] To achieve the above object, the present invention adopts the following technical solutions:

[0008] A model - based code deployment method, comprising:

[0009] Obtaining a communication matrix based on information interaction between robot application modules;

[0010] Parsing the intermediate language description information based on the communication matrix;

[0011] Generating a data type mapping relationship and framework code based on the intermediate language description information;

[0012] Generating communication interface code based on the intermediate language description information and the data type mapping relationship;

[0013] Obtaining glue code based on the framework code and the communication interface code;

[0014] Connecting an algorithm model and a communication middleware based on the glue code to achieve interoperability between different communication middlewares.

[0015] Preferably, the communication matrix includes:

[0016] Node name, subscriber list, publisher list, actuator ID, data types used by subscribers, and data types used by publishers.

[0017] Preferably, the method for obtaining the intermediate language description information is:

[0018] Parsing the matrix information based on a matrix parsing tool to obtain the intermediate language description information, achieving compatibility with communication matrices in different formats.

[0019] Preferably, the intermediate language description information includes:

[0020] Application identifier, communication protocol type, model node definition, input topic list, and output topic list.

[0021] Preferably, both the input topic list and the output topic list include:

[0022] Topic name, protocol type, model port, and model data type.

[0023] Preferably, the method for generating the data type mapping relationship and the framework code is:

[0024] Parsing the key information based on the intermediate language description information;

[0025] Determining the target communication protocol, extracting node and topic information, and establishing the data type mapping relationship respectively based on the key information;

[0026] Generate the framework code based on the target communication protocol, the node and topic information, and the data type mapping relationship.

[0027] Preferably, the key information includes: communication protocol type and node-topic mapping information;

[0028] Based on the communication protocol type and a predefined type mapping table, establish the conversion relationship between the protocol data type and the model data type as the data type mapping relationship;

[0029] Obtain the node and topic information based on the node-topic mapping information;

[0030] Determine the target communication protocol based on the communication protocol type.

[0031] Preferably, the framework code includes: input interface function and output interface function;

[0032] The input interface function converts the message received by the communication protocol into a data type that can be processed by the algorithm model and passes it to the model;

[0033] The output interface function obtains data from the algorithm model, converts it into the message type of the communication protocol, and then publishes it.

[0034] Preferably, the method for generating the communication interface code is:

[0035] Generate the corresponding IDL description file based on the data type mapping relationship and the communication protocol type in the intermediate language description information;

[0036] Convert the IDL description file into the communication interface code based on the code generation tool for the communication protocol.

[0037] A code deployment system based on model generation, including: a communication matrix acquisition module, a data parsing module, a framework code generation module, an interface code generation module, a glue code generation module, and a data interconnection module;

[0038] The communication matrix acquisition module is used to obtain the communication matrix based on the information interaction between robot application modules;

[0039] The data parsing module is used to parse the intermediate language description information based on the communication matrix;

[0040] The framework code generation module is used to generate the data type mapping relationship and the framework code based on the intermediate language description information;

[0041] The interface code generation module is used to generate the communication interface code based on the intermediate language description information and the data type mapping relationship;

[0042] The glue code generation module is used to obtain glue code based on the framework code and the communication interface code;

[0043] The data intercommunication module is used to connect the algorithm model and the communication middleware based on the glue code to achieve the intercommunication of different communication middleware.

[0044] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a code deployment method and system based on model generation, a method for quickly constructing an adaptation algorithm visualization model based on a "communication matrix" to generate code that can be compiled, deployed, and run. Compared with the traditional method of relying on a model platform to support code generation, through "intermediate description language data", it can quickly adapt to changes to adapt to different communication middleware and new features, etc., to achieve the purpose of supporting the switching of different communication middleware, so that it can realize the rapid deployment and operation of the visualization algorithm model on different communication middleware, achieve the purpose of one development and multi-platform operation, and eliminate the system error caused by the simulation process and the actual operation process. It improves the efficiency of developers and greatly reduces the development cost of switching the algorithm model among different communications. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0046] Figure 1 It is a flowchart of a code deployment method based on model generation provided by the present invention.

[0047] Figure 2 It is a schematic structural diagram of a code deployment system based on model generation provided by the present invention.

[0048] Figure 3 It is a structural block diagram of a computer device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0050] Embodiment 1

[0051] As Figure 1 shown, an embodiment of the present invention discloses a code deployment method based on model generation, including:

[0052] Obtaining a communication matrix based on information interaction between robot application modules;

[0053] Analyzing the communication matrix to obtain intermediate language description information;

[0054] Generating a data type mapping relationship and framework code based on the intermediate language description information;

[0055] Generating communication interface code based on the intermediate language description information and the data type mapping relationship;

[0056] Obtaining glue code based on the framework code and the communication interface code;

[0057] Connecting the algorithm model and the communication middleware based on the glue code to achieve intercommunication of different communication middleware.

[0058] Embodiment 2

[0059] An embodiment of the present invention discloses a code deployment method based on model generation, including:

[0060] Obtaining a communication matrix based on information interaction between robot application modules.

[0061] Preferably, the communication matrix is a table containing the communication attributes of node individuals and the communication topology relationship between nodes, where "node" represents a communication unit in the communication network topology, and usually can include multiple "data writers" and "data receivers".

[0062] Preferably, the node attribute information is stored in the communication matrix, and the specific storage forms include but are not limited to forms that can describe the attribute relationship of "nodes" such as Excel, SQL database, json, etc.

[0063] Preferably, the communication matrix includes:

[0064] Node name, subscriber list, publisher list, executor ID, data type used by the subscriber, and data type used by the publisher.

[0065] Preferably, the node name is a unique identifier, such as node_1, node_2, etc.

[0066] Preferably, the subscriber list is used to describe which messages the node receives; each subscriber includes the received topic name and message type; for example, node_1 subscribes to the topic topic_1, and the message type is stamped4_int32.

[0067] Preferably, the publisher list is used to describe which messages are published by the node; each publisher includes the name of the published topic, the message type, and the publishing frequency; for example, node_1 publishes two topics: topic_2 (message type is stamped_int64, frequency is 64Hz) and topic_3 (message type is stamped9_float32, frequency is 64Hz).

[0068] Preferably, the actuator ID is used to identify the actuator instance in which the node runs and manage the thread resources; taking node_1 as an example, this node subscribes to a topic topic_1 and receives messages of type stamped4_int32; at the same time, it publishes two topics topic_2 and topic_3, sending messages of type stamped_int64 and stamped9_float32 at a frequency of 64Hz respectively; this node is assigned to run in actuator 1. Similarly, node_2 subscribes to two topics topic_6 and topic_7 and receives messages of type stamped_int64 and stamped9_float32 respectively; this node is assigned to run in actuator 2.

[0069] Preferably, the communication matrix completely describes the communication relationships of all nodes in the system, including the generation, transfer, and consumption paths of data, providing the necessary information basis for subsequent generation of framework code.

[0070] Intermediate language description information is parsed based on the communication matrix.

[0071] Preferably, the method for obtaining the intermediate language description information is as follows:

[0072] Based on the matrix parsing tool, the matrix information is parsed to obtain the intermediate language description information, realizing the compatibility with communication matrices in different formats, including but not limited to: Excel, SQL database, json format.

[0073] Preferably, the intermediate language description information includes the topological relationship of "nodes" and the communication message type (IDL);

[0074] Topological relationship of nodes: The communication relationship established by the subscriber list and the publisher list;

[0075] Communication message type (IDL): Refers to the data types used by publishers and subscribers.

[0076] Preferably, the intermediate language description information includes:

[0077] Application program identifier, communication protocol type, model node definition, input topic list, and output topic list.

[0078] Preferably, the application identifier: The application name is specified through the app_name field, such as adus_drive, to identify the application system to which the communication configuration belongs.

[0079] Preferably, the communication protocol type: The communication middleware protocol used is specified through the protocol field, which is dds in this example, indicating that this configuration is applicable to the DDS communication framework.

[0080] Preferably, the model node definition: The specific communication node information is defined in the model section, and each node includes: the node path;

[0081] The node path includes the complete node identifier, such as / auto_drive / demo1, indicating the position of the node in the system.

[0082] Preferably, both the input topic list and the output topic list include:

[0083] The topic name, protocol type, model port, and model data type.

[0084] Preferably, the input topic list: Defines the channels through which the node receives data, and each input topic includes:

[0085] The topic name (name): Such as topic1, to identify the communication topic;

[0086] The protocol type (type_protocol): Such as "nterfaces / msg / msg1, to specify the message type used in the communication middleware;

[0087] The model port (model): Such as port1, corresponding to the input port name in the algorithm model;

[0088] The model data type (type_model): Such as datatype1, to specify the data type used in the algorithm model.

[0089] Preferably, the output topic list: Defines the channels through which the node sends data.

[0090] Preferably, the intermediate language description information fully maps the correspondence between the communication nodes in the communication middleware and the algorithm model, including key information such as node identification, data flow direction, port mapping, and data type conversion. Through this information, the system can automatically generate the framework code for connecting the communication middleware and the algorithm model to achieve seamless data transfer.

[0091] Generate the data type mapping relationship and framework code based on the intermediate language description information.

[0092] Preferably, the method for generating the data type mapping relationship and framework code is:

[0093] Parse the key information from the intermediate language description information;

[0094] Based on the key information, determine the target communication protocol, extract node and topic information, and establish a data type mapping relationship respectively;

[0095] Generate framework code based on the target communication protocol, node and topic information, and data type mapping relationship.

[0096] Preferably, the key information includes: communication protocol type (protocol: dds) and node-topic mapping information (model);

[0097] Based on the communication protocol type and the predefined type mapping table, establish the conversion relationship between the protocol data type and the model data type as the data type mapping relationship;

[0098] Obtain node and topic information based on the node-topic mapping information;

[0099] Determine the target communication protocol based on the communication protocol type.

[0100] Preferably, determine which communication protocol code generator to use according to the protocol field. For example, when protocol: dds, the system will select DDS-related code templates and conversion logics.

[0101] Preferably, extract information such as node name, input topic, output topic, etc. from the model field:

[0102] Node name: such as / auto_drive / demo1;

[0103] Input topic: topic name, protocol data type, model port, and model data type;

[0104] Output topic: topic name, protocol data type, model port, and model data type.

[0105] Preferably, the framework code includes: input interface function and output interface function;

[0106] The input interface function converts the message received by the communication protocol into a data type that can be processed by the algorithm model and passes it to the model;

[0107] The output interface function obtains data from the algorithm model, converts it into the message type of the communication protocol, and then publishes it.

[0108] Preferably, the core role of the intermediate language description information is to provide a unified way to describe the connection relationship between heterogeneous systems. In this process:

[0109] The intermediate language description information defines what data is required by what nodes;

[0110] The system selects the corresponding code generator according to the protocol type;

[0111] The data type mapping table defines how data types are converted between different systems;

[0112] The generated framework code is responsible for implementing the actual data conversion and transfer.

[0113] In this way, algorithm developers can focus on the model logic without having to concern themselves with the underlying communication details, thus achieving the decoupling of the algorithm model and the communication middleware.

[0114] Generate communication interface code based on the intermediate language description information and the data type mapping relationship.

[0115] Preferably, the method for generating the communication interface code is as follows:

[0116] Generate the corresponding IDL description file based on the data type mapping relationship and the communication protocol type in the intermediate language description information;

[0117] Convert the IDL description file into communication interface code using the code generation tool based on the communication protocol.

[0118] Preferably, generate the corresponding IDL description file according to the communication protocol type type_protocol information in the intermediate language description information. For example, for the DDS protocol, an.idl file will be generated; for ROS2, a.msg or.srv file will be generated. These IDL files define the structure of the communication data.

[0119] Preferably, call the code generation tool corresponding to the communication protocol to convert the IDL description file into specific communication interface code; for example, the IDL compiler for DDS will generate C++ data structures and serialization / deserialization code.

[0120] Obtain glue code based on the framework code and the communication interface code.

[0121] Connect the algorithm model and the communication middleware based on the glue code to achieve interoperability between different communication middleware.

[0122] Embodiment 3

[0123] As Figure 2 shown, a code deployment system based on model generation includes: a communication matrix acquisition module, a data parsing module, a framework code generation module, an interface code generation module, a glue code generation module, and a data interoperability module;

[0124] A communication matrix acquisition module, configured to acquire a communication matrix based on information interaction between robot application modules;

[0125] A data parsing module, configured to parse intermediate language description information based on the communication matrix;

[0126] A framework code generation module, configured to generate a data type mapping relationship and framework code based on the intermediate language description information;

[0127] An interface code generation module, configured to generate communication interface code based on the intermediate language description information and the data type mapping relationship;

[0128] A glue code generation module, configured to obtain glue code based on the framework code and the communication interface code;

[0129] A data intercommunication module, configured to connect an algorithm model and a communication middleware based on the glue code to achieve intercommunication of different communication middleware.

[0130] Preferably, in this embodiment, the function implementation methods of each functional module correspond one by one to the above method steps, and will not be elaborated here one by one.

[0131] Embodiment 4

[0132] Based on the same inventive concept, the present invention further provides a computer device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus;

[0133] The memory is used to store a computer program;

[0134] The processor, when executing the program stored in the memory, can implement a code deployment method based on model generation as described in Embodiment 1 or 2.

[0135] As Figure 3 shown, the electronic device may include: a processor (processor) 31, a communication interface (Communications Interface) 32, a memory (memory) 33, and a communication bus 34, wherein the processor 31, the communication interface 32, and the memory 33 complete mutual communication through the communication bus 34. The processor 31 can call the logical instructions in the memory 33 to execute a code deployment method based on model generation as described in Embodiment 1 or 2.

[0136] In addition, when the logical instructions in the above-mentioned memory 33 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present invention.

[0137] The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0138] From the above technical solutions, it can be seen that compared with the prior art, the present invention discloses a code deployment method and system based on model generation, a method for quickly constructing an adaptive algorithm visualization model based on a "communication matrix" to generate code that can be compiled, deployed, and run. Compared with the traditional method of relying on a model platform to support code generation, through "intermediate description language data", it can quickly adapt to changes to adapt to different communication middleware and new features, etc., to achieve the purpose of supporting switching between different communication middleware, so that it can realize the rapid deployment and operation of the visualization algorithm model on different communication middleware, achieve the purpose of one-time development and multi-platform operation, and eliminate the system error caused by the simulation process and the actual operation process. It improves the efficiency of developers and greatly reduces the development cost of switching the algorithm model between different communications.

[0139] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part.

[0140] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A code deployment method based on model generation, characterized in that, It includes: Obtain a communication matrix based on information interaction between robot application modules; Parse the communication matrix to obtain intermediate language description information; Generate a data type mapping relationship and framework code based on the intermediate language description information; Generate communication interface code based on the intermediate language description information and the data type mapping relationship; Obtain glue code based on the framework code and the communication interface code; Connect the algorithm model and the communication middleware based on the glue code to achieve interoperability between different communication middleware.

2. The method for deploying code generated based on a model according to claim 1, characterized in that The communication matrix includes: Node name, subscriber list, publisher list, actuator ID, data types used by subscribers, and data types used by publishers.

3. The code deployment method based on model generation according to claim 1, wherein The method for obtaining the intermediate language description information is: Parse the matrix information based on a matrix parsing tool to obtain the intermediate language description information, realizing compatibility with communication matrices in different formats.

4. A code deployment method based on model generation according to claim 3, characterized in that, The intermediate language description information includes: Application program identifier, communication protocol type, model node definition, input topic list, and output topic list.

5. A code deployment method based on model generation according to claim 4, wherein Both the input topic list and the output topic list include: Topic name, protocol type, model port, and model data type.

6. The method for deploying code generated based on a model according to claim 4, wherein The method for generating the data type mapping relationship and the framework code is: Parse the intermediate language description information to obtain key information; Based on the key information, respectively determine the target communication protocol, extract node and topic information, and establish the data type mapping relationship; Generate the framework code based on the target communication protocol, the node and topic information, and the data type mapping relationship.

7. The method for deploying code generated based on a model according to claim 6, characterized in that, The key information includes: communication protocol type and node-topic mapping information; Based on the communication protocol type and a predefined type mapping table, establish a conversion relationship between protocol data types and model data types as the data type mapping relationship; Obtain the node and topic information based on the node-topic mapping information; Determine the target communication protocol based on the communication protocol type.

8. The method for code deployment based on model generation according to claim 1, wherein The framework code includes: input interface function and output interface function; The input interface function converts the message received by the communication protocol into a data type that can be processed by the algorithm model and passes it to the model; The output interface function obtains data from the algorithm model, converts it into the message type of the communication protocol, and then publishes it.

9. A code deployment method based on model generation according to claim 6, characterized in that The method for generating the communication interface code is: Generate a corresponding IDL description file based on the data type mapping relationship and the communication protocol type in the intermediate language description information; Convert the IDL description file into the communication interface code based on a code generation tool for the communication protocol.

10. A model-based code deployment system, which is applied to a model-based code deployment method according to any one of claims 1-9, characterized in that It includes: Communication matrix acquisition module, data parsing module, framework code generation module, interface code generation module, glue code generation module, and data interoperability module; The communication matrix acquisition module is used to obtain a communication matrix based on information interaction between robot application modules; The data parsing module is used to parse the communication matrix to obtain intermediate language description information; The framework code generation module is used to generate a data type mapping relationship and framework code based on the intermediate language description information; The interface code generation module is used to generate communication interface code based on the intermediate language description information and the data type mapping relationship; The glue code generation module is used to obtain glue code based on the framework code and the communication interface code; The data intercommunication module is used to connect the algorithm model and the communication middleware based on the glue code to realize the intercommunication of different communication middleware.