A method, system and medium for converting a ROS data packet to an IROS data packet

By parsing and instantiating ROS data packets to generate IROS data packets, the problem of ROS data packets not being directly usable in the IROS environment is solved, thus improving development and testing efficiency.

CN115145865BActive Publication Date: 2026-03-24SHANDONG NEW GENERATION INFORMATION IND TECH RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-28
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Data packets saved in the ROS environment cannot be used directly in the IROS environment, which requires developers and testers to re-record topics, which is time-consuming and laborious, and makes it difficult to reuse ROS data packets.

Method used

By parsing the ROS data packet, instantiating the ROS object, constructing the IROS object model based on the preset data type lookup table, copying the ROS object data into the IROS object, and generating the IROS data packet.

Benefits of technology

It achieves seamless conversion of ROS data packets to IROS data packets, improving the work efficiency of IROS developers and testers and avoiding the work of re-acquiring packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145865B_ABST
    Figure CN115145865B_ABST
Patent Text Reader

Abstract

The application discloses a method, system and medium for converting a ROS data packet into an IROS data packet, to solve the technical problem of how to convert a ROS data packet into an IROS data packet. The method comprises the following steps: analyzing a ROS data packet to be converted, and instantiating a ROS message to be converted in the ROS data packet to be converted to determine a corresponding ROS object; constructing an IROS object model corresponding to the ROS object according to a preset data type reference table, and copying object data of the ROS object into the IROS object model to obtain a corresponding IROS object; and obtaining an IROS data packet corresponding to the ROS data packet to be converted based on the IROS object. The application realizes the conversion of the ROS data packet into the IROS data packet through the above method.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of robots, and in particular to a method and system for converting a ROS data packet into an IROS data packet and a medium. BACKGROUND

[0002] ROS (Robot Operating System) is a robot operating system, and IROS (Intelligent RobotOS) is an intelligent robot operating system. In ROS, in order to facilitate debugging and reproduction of simulation environments, etc., a rosbag tool is used to record messages in the ROS environment and save them to a file. In this way, only the data packet file needs to be copied and the messages need to be played to the ROS, and the simulation of a real environment can be realized, which solves the simulation and testing under the condition of no real sensor.

[0003] In the process of migrating a ROS project to IROS, since the data formats and serialization methods of ROS and IROS are not completely the same, the data packet saved in the ROS environment cannot be directly used in the IROS environment, which makes developers and testers need to record topics again in the IROS environment, which is time-consuming and laborious. The previous ROS data packet cannot be reused, and the data packet under certain working conditions is also difficult to be recorded again. Therefore, how to convert a ROS data packet into an IROS data packet becomes a technical problem to be solved. SUMMARY

[0004] The embodiments of the present application provide a method and system for converting a ROS data packet into an IROS data packet and a medium, to solve the technical problem of how to convert a ROS data packet into an IROS data packet.

[0005] In a first aspect, the embodiments of the present application provide a method for converting a ROS data packet into an IROS data packet, characterized in that the method comprises: parsing a to-be-converted ROS data packet, and instantiating a to-be-converted ROS message in the to-be-converted ROS data packet to determine a corresponding ROS object; constructing an IROS object model corresponding to the ROS object according to a preset data type correspondence table, and copying object data of the ROS object into the IROS object model to obtain a corresponding IROS object; and obtaining an IROS data packet corresponding to the to-be-converted ROS data packet based on the IROS object.

[0006] In an implementation manner of the present application, the parsing of the to-be-converted ROS data packet specifically comprises: based on a preset deserialization program, deserializing the to-be-converted ROS data packet to determine a to-be-converted ROS message in the to-be-converted ROS data packet; and parsing the to-be-converted ROS message to determine a data structure of the to-be-converted ROS message.

[0007] In an implementation manner of the present application, the to-be-converted ROS message in the to-be-converted ROS data packet is instantiated to determine the corresponding ROS object, specifically comprising: reading the to-be-converted ROS message based on the data structure of the to-be-converted ROS message to determine the message type of the to-be-converted message; determining the corresponding message mapping table according to the message type of the to-be-converted message, and mapping the data contained in the to-be-converted message into the message mapping table; and instantiating the to-be-converted message based on the data in the message mapping table to determine the corresponding ROS object.

[0008] In an implementation manner of the present application, the IROS data packet corresponding to the to-be-converted ROS data packet is obtained based on the IROS object, specifically comprising: de-serializing the IROS object based on the preset serialization program to generate IROS data; saving the IROS data into the preset IROS object file, and packing the IROS object file to obtain the IROS data packet corresponding to the to-be-converted ROS data packet.

[0009] In an implementation manner of the present application, the data structure of the to-be-converted ROS message comprises: message name, message type, MD5 value and message definition.

[0010] In a second aspect, the embodiments of the present application further provide a system for converting a ROS data packet into an IROS data packet, characterized in that the system comprises: a ROS object determining module, an IROS object obtaining module and an IROS data packet obtaining module; the ROS object determining module is configured to parse a to-be-converted ROS data packet, and instantiate a to-be-converted ROS message in the to-be-converted ROS data packet to determine a corresponding ROS object; the IROS object obtaining module is configured to construct an IROS object model corresponding to the ROS object according to a preset data type reference table, and copy object data of the ROS object into the IROS object model to obtain a corresponding IROS object; and the IROS data packet obtaining module is configured to obtain an IROS data packet corresponding to the to-be-converted ROS data packet based on the IROS object.

[0011] In an implementation manner of the present application, the ROS object determining module is configured to de-serialize the to-be-converted ROS data packet based on a preset de-serialization program to determine a to-be-converted ROS message in the to-be-converted ROS data packet; and parse the to-be-converted ROS message to determine the data structure of the to-be-converted ROS message.

[0012] In an implementation form of the present application, the ROS object determining module is further configured to read the to-be-converted ROS message based on the data structure of the to-be-converted ROS message to determine the message type of the to-be-converted message; determine the corresponding message mapping table according to the message type of the to-be-converted message, and map the data contained in the to-be-converted message into the message mapping table; and instantiate the to-be-converted message based on the data in the message mapping table to determine the corresponding ROS object.

[0013] In an implementation form of the present application, the IROS data packet obtaining module is configured to deserialize the IROS object based on a preset serialization program to generate IROS data; save the IROS data into a preset IROS object file, and pack the IROS object file to obtain the IROS data packet corresponding to the to-be-converted ROS data packet.

[0014] In a third aspect, the embodiments of the present application further provide a non-volatile computer storage medium for converting a ROS data packet into an IROS data packet, which stores computer executable instructions, and the computer executable instructions are configured to: parse a to-be-converted ROS data packet, and instantiate a to-be-converted ROS message in the to-be-converted ROS data packet to determine a corresponding ROS object; construct an IROS object model corresponding to the ROS object according to a preset data type correspondence table, and copy object data of the ROS object into the IROS object model to obtain a corresponding IROS object; and obtain an IROS data packet corresponding to the to-be-converted ROS data packet based on the IROS object.

[0015] The method, system and medium for converting a ROS data packet into an IROS data packet provided by the embodiments of the present application can conveniently convert a ROS data packet into an IROS data packet, save the work of re-recording a packet under an IROS environment, and effectively improve the work efficiency of IROS developers and testers. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the present application, constitute a part of the present application and illustrate the illustrative embodiments of the present application and their description serve to explain the present application, and do not constitute improper limitations on the present application. In the drawings:

[0017] Figure 1 A flowchart of a method for converting a ROS data packet into an IROS data packet is provided for the embodiments of the present application;

[0018] Figure 2 A system internal structure schematic diagram for converting a ROS data packet into an IROS data packet is provided for the embodiments of the present application. DETAILED DESCRIPTION

[0019] In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below in combination with specific embodiments of the present application and corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without any creative work fall within the scope of protection of the present application.

[0020] The embodiments of the present application provide a method, system and medium for converting a ROS data packet into an IROS data packet, to solve the technical problem of how to convert a ROS data packet into an IROS data packet.

[0021] The technical solutions of the embodiments of the present application will be described in detail below with reference to the drawings.

[0022] Figure 1 A flowchart of a method for converting a ROS data packet into an IROS data packet is provided in the embodiments of the present application. As shown in the figure, Figure 1 The method for converting a ROS data packet into an IROS data packet provided in the embodiments of the present application specifically includes the following steps:

[0023] Step 101, parse the ROS data packet to be converted and instantiate the ROS message to be converted in the ROS data packet to be converted to determine the corresponding ROS object.

[0024] In an embodiment of the present application, in order to convert a ROS data packet into an IROS data packet, the ROS data packet to be converted is first parsed.

[0025] Specifically, since the data in the data packet is in the form of a binary sequence, the first step of the mechanical parsing of the ROS data packet to be converted is to deserialize the ROS data packet to be converted based on a preset deserialization program to determine the ROS message to be converted in the ROS data packet to be converted. After determining the ROS message to be converted, the ROS message to be converted is parsed to determine the data structure of the ROS message to be converted.

[0026] It can be understood that each data packet contains a plurality of ROS messages to be converted. It should be noted that the data structure of the ROS message to be converted includes the message name, message type, MD5 value and message definition.

[0027] In an embodiment of the present application, after determining the data structure of the ROS message to be converted, the ROS message to be converted is read based on the data structure of the ROS message to be converted to determine the message type of the message to be converted; according to the message type of the message to be converted, a corresponding message mapping table is determined, and the data contained in the message to be converted is mapped into the message mapping table; and based on the data in the message mapping table, the message to be converted is instantiated to determine the corresponding ROS object.

[0028] In step 102, an IROS object model corresponding to the ROS object is constructed according to the preset data type correspondence table, and object data of the ROS object is copied into the IROS object model to obtain a corresponding IROS object.

[0029] In an embodiment of the present application, after determining the ROS object, the data types in the ROS object are determined in the IROS object format based on the preset data type correspondence table, and an IROS object model corresponding to the ROS object is constructed based on the corresponding format.

[0030] Further, object data corresponding to each data type in the ROS object is copied into the IROS object model to obtain a corresponding IROS object.

[0031] In step 103, an IROS data packet corresponding to the ROS data packet to be converted is obtained based on the IROS object.

[0032] In an embodiment of the present application, after obtaining the corresponding IROS object, an IROS data packet corresponding to the ROS data packet to be converted is obtained based on the IROS object.

[0033] Specifically, the IROS object is deserialized based on a preset serialization program to generate IROS data, the IROS data is saved into a preset IROS object file, and the IROS object file is packaged to obtain an IROS data packet corresponding to the ROS data packet to be converted.

[0034] Based on the same inventive concept, the embodiments of the present application also provide a system for converting a ROS data packet into an IROS data packet, the internal structure of which is shown in Figure 2 .

[0035] Figure 2 The system for converting a ROS data packet into an IROS data packet provided in the embodiments of the present application has the internal structure shown in Figure 2 . The system 200 includes a ROS object determination module 201, an IROS object obtaining module 202, and an IROS data packet obtaining module 203.

[0036] In an embodiment of the present application, the ROS object determining module 201 is configured to parse the ROS data packet to be converted, and to instantiate the ROS message to be converted in the ROS data packet to be converted, so as to determine the corresponding ROS object; the IROS object obtaining module 202 is configured to construct the IROS object model corresponding to the ROS object according to a preset data type correspondence table, and to copy the object data of the ROS object into the IROS object model, so as to obtain the corresponding IROS object; and the IROS data packet obtaining module 203 is configured to obtain the IROS data packet corresponding to the ROS data packet to be converted based on the IROS object.

[0037] In an embodiment of the present application, the ROS object determining module 201 is configured to deserialize the ROS data packet to be converted based on a preset deserialization program, so as to determine the ROS message to be converted in the ROS data packet to be converted; and to parse the ROS message to be converted, so as to determine the data structure of the ROS message to be converted.

[0038] In an embodiment of the present application, the ROS object determining module 201 is further configured to read the ROS message to be converted based on the data structure of the ROS message to be converted, so as to determine the message type of the ROS message to be converted; to determine the corresponding message mapping table according to the message type of the ROS message to be converted, and to map the data contained in the ROS message to be converted into the message mapping table; and to instantiate the ROS message to be converted based on the data in the message mapping table, so as to determine the corresponding ROS object.

[0039] In an embodiment of the present application, the IROS data packet obtaining module 203 is configured to deserialize the IROS object based on a preset serialization program, so as to generate IROS data; to save the IROS data into a preset IROS object file, and to pack the IROS object file, so as to obtain the IROS data packet corresponding to the ROS data packet to be converted.

[0040] Some embodiments of the present application provide a non-volatile computer storage medium for converting a ROS data packet into an IROS data packet, the non-volatile computer storage medium storing computer executable instructions, the computer executable instructions being configured to: Figure 1

[0041] parse the ROS data packet to be converted, and to instantiate the ROS message to be converted in the ROS data packet to be converted, so as to determine the corresponding ROS object;

[0042] construct the IROS object model corresponding to the ROS object according to a preset data type correspondence table, and to copy the object data of the ROS object into the IROS object model, so as to obtain the corresponding IROS object;

[0043] ​Based on the IROS object, an IROS data packet corresponding to the ROS data packet to be converted is obtained.

[0044] Each of the embodiments in the present application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments mainly explains the difference from other embodiments. In particular, for the Internet of Things device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0045] The system and medium provided by the embodiments of the present application are one-to-one corresponding to the method, and therefore, the system and medium also have similar beneficial technical effects to the method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the system and medium will not be described here.

[0046] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0047] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the function specified in the flow or the block.

[0048] These computer program instructions can also be stored in a computer-readable memory that can guide the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus, which implements the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the function specified in the flow or the block.

[0049] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 Figure 1

[0050] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0051] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the processor can execute instructions. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other memory technologies, CD-ROM, digital versatile disc (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information for access by a computing device. In no case does the medium include a transitory signal.

[0052] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically programmable read only memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information accessible by a computing device. According to the definition herein, computer readable media does not include transitory media such as modulated data signals and carrier waves.

[0053] It should also be noted that the terms "comprising," "including," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.

[0054] ​​The above merely provides an example of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the scope of claims of the present application.

Claims

1. A method for converting ROS data packets to IROS data packets, characterized in that, The method includes: Parse the ROS data packet to be converted and instantiate the ROS message to be converted in the ROS data packet to determine the corresponding ROS object; Based on a preset data type lookup table, construct the IROS object model corresponding to the ROS object, and copy the object data of the ROS object into the IROS object model to obtain the corresponding IROS object. Based on the IROS object, obtain the IROS data packet corresponding to the ROS data packet to be converted; Based on the IROS object, the IROS data packet corresponding to the ROS data packet to be converted is obtained, specifically including: Based on a preset serialization procedure, the IROS object is deserialized to generate IROS data; The IROS data is saved to a preset IROS object file, and the IROS object file is packaged to obtain the IROS data packet corresponding to the ROS data packet to be converted.

2. The method for converting ROS data packets to IROS data packets according to claim 1, characterized in that, Parsing the ROS data packets to be converted specifically includes: Based on a preset deserialization procedure, the ROS data packet to be converted is deserialized to determine the ROS message to be converted in the ROS data packet to be converted; The ROS message to be converted is parsed to determine its data structure.

3. The method for converting ROS data packets to IROS data packets according to claim 2, characterized in that, Instantiating the ROS message to be converted in the ROS data packet to determine the corresponding ROS object, specifically including: Based on the data structure of the ROS message to be converted, the ROS message to be converted is read to determine the message type of the ROS message to be converted. Based on the message type of the ROS message to be converted, determine the corresponding message mapping table, and map the data contained in the ROS message to be converted into the message mapping table; Based on the data in the message mapping table, the ROS message to be converted is instantiated to determine the corresponding ROS object.

4. The method for converting ROS data packets to IROS data packets according to claim 3, characterized in that, The data structure of the ROS message to be converted includes: message name, message type, MD5 value, and message definition.

5. A system for converting ROS data packets to IROS data packets, characterized in that, The system includes: a ROS object determination module, an IROS object acquisition module, and an IROS data packet acquisition module; The ROS object determination module is used to parse the ROS data packet to be converted and instantiate the ROS message to be converted in the ROS data packet to determine the corresponding ROS object. The IROS object acquisition module is used to construct an IROS object model corresponding to the ROS object according to a preset data type lookup table, and copy the object data of the ROS object into the IROS object model to obtain the corresponding IROS object. The IROS data packet acquisition module is used to obtain the IROS data packet corresponding to the ROS data packet to be converted based on the IROS object. The IROS data packet acquisition module is used to deserialize the IROS object based on a preset serialization program to generate IROS data. The IROS data is saved to a preset IROS object file, and the IROS object file is packaged to obtain the IROS data packet corresponding to the ROS data packet to be converted.

6. A system for converting ROS data packets to IROS data packets according to claim 5, characterized in that, The ROS object determination module is used to deserialize the ROS data packet to be converted based on a preset deserialization program in order to determine the ROS message to be converted in the ROS data packet to be converted. The ROS message to be converted is parsed to determine its data structure.

7. A system for converting ROS data packets to IROS data packets according to claim 6, characterized in that, The ROS object determination module is further configured to read the ROS message to be converted based on the data structure of the ROS message to be converted, so as to determine the message type of the ROS message to be converted; Based on the message type of the ROS message to be converted, determine the corresponding message mapping table, and map the data contained in the ROS message to be converted into the message mapping table; Based on the data in the message mapping table, the ROS message to be converted is instantiated to determine the corresponding ROS object.

8. A non-volatile computer storage medium for converting ROS data packets to IROS data packets, storing computer-executable instructions, characterized in that, The computer-executable instructions are set as follows: Parse the ROS data packet to be converted and instantiate the ROS message to be converted in the ROS data packet to determine the corresponding ROS object; Based on a preset data type lookup table, construct the IROS object model corresponding to the ROS object, and copy the object data of the ROS object into the IROS object model to obtain the corresponding IROS object. Based on the IROS object, obtain the IROS data packet corresponding to the ROS data packet to be converted; Based on the IROS object, the IROS data packet corresponding to the ROS data packet to be converted is obtained, specifically including: Based on a preset serialization procedure, the IROS object is deserialized to generate IROS data; The IROS data is saved to a preset IROS object file, and the IROS object file is packaged to obtain the IROS data packet corresponding to the ROS data packet to be converted.

Citation Information

Patent Citations

  • Method and device of character stream format conversion

    CN107256206A

  • Data format conversion method and device

    CN110941655A