Program processing method, computer equipment and medium
By obtaining and converting the form of the robot program, mapping and synchronous updates between graphical programs and script programs are realized, which solves the limitations of robot program writing and debugging in the existing technology, and improves the program processing effect and user experience.
Patent Information
- Application Number
- CN202411954566.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, there are limitations in writing and debugging of robot operation programs, including steep learning curve of script programming, difficulty in debugging and long time, insufficient flexibility in graphical programming, weak performance limitations and scalability, high cost of offline programming, high learning thresholds, and deviations from simulation and actual situations.
By obtaining the pre-written first morphological robot program, determining its logical structure, and generating the second morphological robot program, the morphological conversion between the script program and the graphical program is realized. This method constructs a mapping relationship between the two programs, and displays two programs at the same time in the programming interface, and updates the two programs simultaneously in response to user update operations.
It realizes dynamic switching between graphical form and script form of robot programs, combines the efficient editing and debugging characteristics of script programs and the intuitive and easy-to-operate characteristics of graphical programs, and improves the processing effect of robot programs.
Smart Images

Figure CN119883233A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of programming technology, and in particular to a program processing method, a computer device and a medium. Background Art
[0002] In robot applications, robots can upgrade and transform traditional work processes. By writing and debugging robot work programs, robots can be controlled to efficiently perform expected actions or processes to improve production efficiency.
[0003] At present, robot operation program writing is mainly achieved through script programming, graphical programming or offline programming, but script programming has a steep learning curve, debugging is difficult and time-consuming; graphical programming lacks flexibility, has performance limitations and weak scalability; offline programming has high costs, high learning barriers and deviations between simulation and actual conditions.
[0004] Therefore, there are certain limitations in the writing and debugging of robot operation programs in the prior art. Summary of the invention
[0005] The purpose of this application is to provide a program processing method, computer equipment and medium to address the practical needs of the prior art in view of the deficiencies in the above-mentioned prior art, so as to solve the practical problems that the writing and debugging of robot operation programs in the prior art have certain limitations.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides a program processing method, the method comprising: obtaining a pre-written first-form robot program, the first-form robot program being a graphical program or a script program, the first-form robot program comprising: a plurality of program block identifiers and program block contents corresponding to each program block identifier;
[0008] According to the first form robot program, determining the logical structure of the first form robot program, and generating a second form robot program according to the logical structure of the first form robot program, wherein the second form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier;
[0009] Constructing a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and displaying the first form robot program and the second form robot program in different areas of a programming interface;
[0010] In response to the update operation on the first form robot program, the first form robot program and the second form robot program are updated, and the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is updated.
[0011] As an optional implementation, determining the logical structure of the first form robot program according to the first form robot program includes:
[0012] Determine the form of the first form robot program, the form being a graphical form or a script form;
[0013] According to the form of the first-form robot program, the first-form robot program is parsed to obtain the logical structure of the first-form robot program.
[0014] As an optional implementation, the first form robot program is a graphical program, the program block identifier of the first form robot program is an instruction block identifier, and the program block content of the first form robot program is a graphical instruction block; the second form robot program is a script program, the program block identifier of the second form robot program is a command line identifier, and the program block content of the second form robot program is a script command line;
[0015] The step of generating a second form robot program according to the logical structure of the first form robot program comprises:
[0016] According to the logical structure of the first form of robot program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines, and a corresponding command line identifier is assigned to each script command line, and the command line identifier is used as the command line identifier corresponding to the instruction block identifier;
[0017] According to the logical structure of the graphical program, the script command lines corresponding to the command line identifiers are spliced into the second form robot program.
[0018] As an optional implementation, the first form robot program is a script program, the program block identifier of the first form robot program is a command line identifier, and the program block content of the first form robot program is a script command line; the second form robot program is a graphical program, the program block identifier of the second form robot program is an instruction block identifier, and the program block content of the second form robot program is a graphical instruction block;
[0019] The step of generating a second form robot program according to the logical structure of the first form robot program comprises:
[0020] According to the logical structure of the first form of robot program, the script command lines corresponding to the command line identifiers in the script program are translated into graphic instruction blocks, and corresponding instruction block identifiers are assigned to the graphic instruction blocks, and the instruction block identifiers are used as the instruction block identifiers corresponding to the command line identifiers;
[0021] According to the logical structure of the script program, the graphic instruction blocks corresponding to the instruction block identifiers are spliced into the second form robot program.
[0022] As an optional implementation, displaying the first form robot program and the second form robot program in different areas of the programming interface includes:
[0023] Displaying the script programs in the first form robot program and the second form robot program in the first area of the programming interface, and displaying the graphical programs in the first form robot program and the second form robot program in the second area of the programming interface;
[0024] Running the script program displayed in the first area in real time, and highlighting the target script command line corresponding to the target command line identifier currently running in the first area according to each command line identifier in the script program;
[0025] According to the mapping relationship, the target graphic instruction block corresponding to the target script command line is highlighted in the second area.
[0026] As an optional implementation manner, the updating of the first form robot program and the second form robot program, and updating the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, includes:
[0027] updating the first-form robot program to obtain an updated first-form robot program;
[0028] Determine the logical structure of the updated first-form robot program, and update the second-form robot program according to the logical structure of the updated first-form robot program to obtain an updated second-form robot program;
[0029] A mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program is constructed.
[0030] As an optional implementation, updating the second form robot program according to the updated logical structure of the first form robot program includes:
[0031] Determine, according to the logical structure of the updated first-form robot program, a first program block identifier that has been changed in the updated first-form robot program and a changed program block content corresponding to the first program block identifier;
[0032] Determine, according to the changed program block identifier and mapping relationship in the updated first-form robot program, a second program block identifier that needs to be updated in the second-form robot program and a changed program block content corresponding to the second program block identifier;
[0033] The second form robot program is updated according to the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier.
[0034] As an optional implementation, the method further includes:
[0035] Running the script program displayed in the first area in real time, and recording an error reporting command line identifier when the script program reports an error;
[0036] According to the error reporting command line identifier and the mapping relationship, determining the error reporting instruction block identifier corresponding to the error reporting command line identifier and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier;
[0037] An error warning is generated and outputted according to the error reporting command line identifier, the error reporting command line corresponding to the error reporting command line identifier, the error reporting instruction block identifier, and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier.
[0038] In a second aspect, an embodiment of the present application provides a program processing device, the device comprising:
[0039] An acquisition module is used to acquire a pre-written first-form robot program, wherein the first-form robot program is a graphical program or a script program, and the first-form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier;
[0040] a determination module, configured to determine the logical structure of the first form robot program according to the first form robot program, and generate a second form robot program according to the logical structure of the first form robot program, wherein the second form robot program includes: a plurality of program block identifiers and program block contents corresponding to the program block identifiers;
[0041] A display module, used to construct a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and display the first form robot program and the second form robot program in different areas of the programming interface;
[0042] An update module is used to update the first form robot program and the second form robot program in response to an update operation on the first form robot program, and to update a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0043] As an optional implementation manner, the determining module is specifically used for:
[0044] Determine the form of the first form robot program, the form being a graphical form or a script form;
[0045] According to the form of the first-form robot program, the first-form robot program is parsed to obtain the logical structure of the first-form robot program.
[0046] As an optional implementation manner, the determining module is specifically used for:
[0047] According to the logical structure of the first form of robot program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines, and a corresponding command line identifier is assigned to each script command line, and the command line identifier is used as the command line identifier corresponding to the instruction block identifier;
[0048] According to the logical structure of the graphical program, the script command lines corresponding to the command line identifiers are spliced into the second form robot program.
[0049] As an optional implementation manner, the determining module is specifically used for:
[0050] According to the logical structure of the first form of robot program, the script command lines corresponding to the command line identifiers in the script program are translated into graphic instruction blocks, and corresponding instruction block identifiers are assigned to the graphic instruction blocks, and the instruction block identifiers are used as the instruction block identifiers corresponding to the command line identifiers;
[0051] According to the logical structure of the script program, the graphic instruction blocks corresponding to the instruction block identifiers are spliced into the second form robot program.
[0052] As an optional implementation, the display module is specifically used for:
[0053] Displaying the script programs in the first form robot program and the second form robot program in the first area of the programming interface, and displaying the graphical programs in the first form robot program and the second form robot program in the second area of the programming interface;
[0054] Running the script program displayed in the first area in real time, and highlighting the target script command line corresponding to the target command line identifier currently running in the first area according to each command line identifier in the script program;
[0055] According to the mapping relationship, the target graphic instruction block corresponding to the target script command line is highlighted in the second area.
[0056] As an optional implementation, the update module is specifically used for:
[0057] updating the first-form robot program to obtain an updated first-form robot program;
[0058] Determine the logical structure of the updated first-form robot program, and update the second-form robot program according to the logical structure of the updated first-form robot program to obtain an updated second-form robot program;
[0059] A mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program is constructed.
[0060] As an optional implementation, the update module is specifically used for:
[0061] Determine, according to the logical structure of the updated first-form robot program, a first program block identifier that has been changed in the updated first-form robot program and a changed program block content corresponding to the first program block identifier;
[0062] Determine, according to the changed program block identifier and mapping relationship in the updated first-form robot program, a second program block identifier that needs to be updated in the second-form robot program and a changed program block content corresponding to the second program block identifier;
[0063] The second form robot program is updated according to the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier.
[0064] As an optional implementation, the device further includes: an error reporting module, wherein the error reporting module is specifically configured to:
[0065] Running the script program displayed in the first area in real time, and recording an error reporting command line identifier when the script program reports an error;
[0066] According to the error reporting command line identifier and the mapping relationship, determining the error reporting instruction block identifier corresponding to the error reporting command line identifier and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier;
[0067] An error warning is generated and outputted according to the error reporting command line identifier, the error reporting command line corresponding to the error reporting command line identifier, the error reporting instruction block identifier, and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier.
[0068] In a third aspect, an embodiment of the present application provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the program processing method described in the first aspect above.
[0069] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the program processing method described in the first aspect are executed.
[0070] The beneficial effects of this application are:
[0071] The present application provides a program processing method, a computer device and a medium, which determines the logical structure of a first-form robot program based on a first-form robot program pre-written by a user, and according to the logical structure of the first-form robot program, translates the program block content corresponding to each program block identifier in the first-form robot program into the program block content corresponding to each program block identifier in the second-form robot program, generates a second-form robot program corresponding to the first-form robot program, and makes the second-form robot program include multiple program block identifiers and program block content corresponding to each program block identifier, so as to realize the form conversion between the script program and the graphical program. In the translation process, the corresponding relationship between each program block identifier in the first-form robot program and each program block identifier in the second-form robot program is determined, and the mapping relationship between each program block identifier in the first-form robot program and each program block identifier in the second-form robot program is constructed, and the first-form robot program and the second-form robot program are respectively displayed in different areas of the programming interface, and the script program and the graphical program are simultaneously displayed in the same programming interface. In response to the user's update operation on the first form robot program, the first form robot program is updated, and after the first form robot program is updated, the second form robot program is updated accordingly, and the mapping relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program is updated. The robot program is dynamically switched between the graphical form and the script form, combining the efficient editing and debugging characteristics of the script program with the intuitive and easy-to-operate characteristics of the graphical program, thereby improving the processing effect of the robot program. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0073] Figure 1 A flowchart of a program processing method provided in an embodiment of the present application;
[0074] Figure 2 A schematic diagram of a programming interface provided in an embodiment of the present application;
[0075] Figure 3 A schematic diagram of a flow chart of determining the logical structure of a first-form robot program in a program processing method provided in an embodiment of the present application;
[0076] Figure 4 A schematic diagram of a flow chart of generating a second-form robot program according to a program processing method provided in an embodiment of the present application;
[0077] Figure 5 Another schematic diagram of a flow chart of generating a second-form robot program according to a program processing method provided in an embodiment of the present application;
[0078] Figure 6 A schematic diagram of a programming interface showing a first form robot program and a second form robot program according to a program processing method provided in an embodiment of the present application;
[0079] Figure 7 A flowchart of updating a robot program and a mapping relationship of a program processing method provided in an embodiment of the present application;
[0080] Figure 8 A schematic diagram of an interface for updating a robot program and a mapping relationship provided in an embodiment of the present application;
[0081] Fig. 9 A schematic diagram of a flow chart of updating a second-form robot program according to a program processing method provided in an embodiment of the present application;
[0082] Fig.10 Another flowchart of the program processing method provided in the embodiment of the present application;
[0083] Fig.11 A module structure diagram of a program processing device provided in an embodiment of the present application;
[0084] Fig.12 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0085] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0086] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0087] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0088] At present, robot operation program writing is mainly achieved through script programming, graphical programming or offline programming. However, script programming has the disadvantages of steep learning curve, difficult debugging and long time consumption. Graphical programming has the disadvantages of insufficient flexibility, many performance limitations and weak scalability. Offline programming has the disadvantages of high cost and learning threshold and large deviation between simulation and actual situation.
[0089] Based on the above problems, the embodiment of the present application provides a program processing method, which realizes the dynamic switching of the robot program between the graphical form and the script form by constructing the mapping relationship between each graphic instruction block identifier in the graphical program and each script command line identifier in the script program, and displays the script program and the graphical program in the two sides of the programming interface at the same time, and when the robot program on one side changes, the robot program on the other side is updated synchronously. It combines the advantages of high flexibility and strong reusability of script programming and the advantages of strong intuitiveness and high visualization of graphical programming, which not only retains the characteristics of efficient editing and debugging of script programs, but also retains the characteristics of intuitiveness and easy operation of graphical programs, thereby improving the processing effect of robot programs.
[0090] Figure 1 This is a flow chart of a program processing method provided in an embodiment of the present application. The execution subject of the method can be any computer device with computing processing capabilities. Figure 1 As shown, the method includes:
[0091] S101, obtaining a pre-written first-form robot program, where the first-form robot program is a graphical program or a script program, and the first-form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier.
[0092] Optionally, in response to the user's import operation on the first-form robot program, the first-form robot program pre-written by the user in an integrated development environment (IDE) based on the control requirements of the robot is obtained. Figure 2 A schematic diagram of a programming interface provided in an embodiment of the present application, such as Figure 2 As shown, the computer device provides a programming interface, and the user can also pre-write the first form robot program in the programming interface based on the control requirements of the robot. The computer device obtains the first form robot program pre-written by the user by responding to the user's save operation in the programming interface. The first form robot program is any one of a graphical program or a script program.
[0093] If the user performs script programming operations in the IDE or programming interface, the first form robot program is a script program; if the user performs graphical programming operations in the IDE or programming interface, the first form robot program is a graphical program. The first form robot program includes multiple program block identifiers and program block contents uniquely corresponding to each program block identifier.
[0094] S102. Determine the logical structure of the first form robot program according to the first form robot program, and generate a second form robot program according to the logical structure of the first form robot program, wherein the second form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier.
[0095] Optionally, the first form robot program is subjected to form recognition and analysis to determine the logical structure of the first form robot program, wherein the logical structure of the first form robot program may include a loop, selection, jump or nested structure. According to the logical structure of the first form robot program, the first form robot program is subjected to form transformation to generate a second form robot program. In other words, a graphical program may be transformed into a script program, or a script program may be transformed into a graphical program.
[0096] Specifically, the program block contents corresponding to each program block identifier in the first form robot program are translated one by one into the program block contents corresponding to each program block identifier in the second form robot program, so as to generate a second form robot program corresponding to the first form robot program, so that the second form robot program includes multiple program block identifiers and program block contents uniquely corresponding to each program block identifier. The logical structure of the second form robot program generated after the form conversion is the same as the logical structure of the first form robot program.
[0097] S103: construct a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and display the first form robot program and the second form robot program in different areas of the programming interface.
[0098] Optionally, in the process of translating the program block content corresponding to each program block identifier in the first form robot program into the program block content corresponding to each program block identifier in the second form robot program one by one, each program block identifier in the first form robot program is matched with each program block identifier in the second form robot program one by one to determine the corresponding relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0099] Based on the correspondence between each program block identifier in the first form robot program and each program block identifier in the second form robot program, each program block identifier in the first form robot program is mapped to each program block identifier in the second form robot program, and a mapping table is generated, that is, a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is constructed. Exemplarily, a hash function can be used to perform hash mapping to construct a hash mapping table, thereby improving the efficiency of constructing the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0100] After converting the first form robot program to the second form robot program, refer to Figure 2 The computer device displays the first form robot program and the second form robot program on Figure 2Different areas of the programming interface shown in the figure display script programs and graphical programs at the same time in the same programming interface, and the computer device can respond to the user's selection operation on the specified program block content in the first form robot program, highlight the specified program block content, and find the specified program block identifier in the second form robot program corresponding to the specified program block identifier of the specified program block content in the first form robot program according to the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and highlight the specified program block content corresponding to the specified program block identifier in the second form robot program according to the specified program block identifier in the second form robot program.
[0101] Alternatively, the computer device may respond to a user's selection operation on a specified program block content in a second form robot program by highlighting the specified program block content, and based on a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, find the specified program block identifier in the first form robot program that corresponds to the specified program block identifier of the specified program block content in the second form robot program, and based on the specified program block identifier in the first form robot program, highlight the specified program block content corresponding to the specified program block identifier in the first form robot program.
[0102] S104. In response to the update operation on the first form robot program, update the first form robot program and the second form robot program, and update the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0103] Optionally, based on the actual control requirements of the robot, when it is necessary to debug the first form robot program or expand the program function, the user can update the first form robot program in the IDE or programming interface. The computer device updates the first form robot program in response to the user's update operation on the first form robot program, and updates the second form robot program accordingly according to the update type of the first form robot program after the first form robot program is updated. Among them, the update type of the first form robot program can include one or more types of addition, deletion, and modification. In the process of updating the first form robot program, the second form robot program in the editing interface can be hidden, and the second form robot program is not displayed, so that the user pays more attention to the editing or debugging of the current first form robot program.
[0104] In the process of updating the second form robot program, the program block identifiers in the updated first form robot program are re-matched with the program block identifiers in the updated second form robot program one by one, the mapping relationship between the program block identifiers in the updated first form robot program and the program block identifiers in the updated second form robot program is updated, and the updated first form robot program and the updated second form robot program are respectively displayed in different areas of the programming interface, and the updated script program and the updated graphical program are simultaneously displayed on the same programming interface.
[0105] In this embodiment, the logical structure of the first form robot program is determined based on the first form robot program pre-written by the user, and according to the logical structure of the first form robot program, the program block content corresponding to each program block identifier in the first form robot program is translated into the program block content corresponding to each program block identifier in the second form robot program, and the second form robot program corresponding to the first form robot program is generated, so that the second form robot program includes multiple program block identifiers and program block content corresponding to each program block identifier, and the form conversion between the script program and the graphical program is realized. In the translation process, the corresponding relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is determined, and the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is constructed, and the first form robot program and the second form robot program are respectively displayed in different areas of the programming interface, and the script program and the graphical program are simultaneously displayed in the same programming interface. In response to the user's update operation on the first form robot program, the first form robot program is updated, and after the first form robot program is updated, the second form robot program is updated accordingly, and the mapping relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program is updated. The robot program is dynamically switched between the graphical form and the script form, combining the efficient editing and debugging characteristics of the script program with the intuitive and easy-to-operate characteristics of the graphical program, thereby improving the processing effect of the robot program.
[0106] The following describes in detail a process of determining the logical structure of the first-form robot program based on the first-form robot program.
[0107] Figure 3 A flowchart of determining the logical structure of a first-form robot program according to a program processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the step of determining the logical structure of the first form robot program according to the first form robot program in the above step S102 includes:
[0108] S301. Determine the form of a first-form robot program, which may be a graphical form or a script form.
[0109] Optionally, a first-form robot program pre-written by a user is subjected to form recognition to determine whether the form of the first-form robot program is a graphical form or a script form, and further determine whether the first-form robot program is a graphical program or a script program.
[0110] Specifically, if the first-form robot program is identified as a graphical form, the first-form robot program is determined to be a graphical program; if the first-form robot program is identified as a script form, the first-form robot program is determined to be a script program.
[0111] S302. According to the form of the first-form robot program, the first-form robot program is parsed to obtain the logical structure of the first-form robot program.
[0112] Optionally, if the first form robot program is in a graphical form and is a graphical program, the graphical program is graphically parsed to obtain a logical structure of the graphical program, wherein the logical structure of the graphical program may include loop, selection, jump or nested structure.
[0113] If the first form robot program is in the form of a script, the first form robot program is a script program, then the script program is parsed to obtain the logical structure of the script program, wherein the logical structure of the script program may also include loop, selection, jump or nested structure.
[0114] In this embodiment, by performing form recognition on the first form robot program, it is determined that the form of the first form robot program is a graphical form or a script form, and then the first form robot program is determined to be a graphical program or a script program. If it is determined that the form of the first form robot program is a graphical form and the first form robot program is a graphical program, the graphical program is graphically parsed to obtain the logical structure of the graphical program. If it is determined that the form of the first form robot program is a script form and the first form robot program is a script program, the script program is script parsed to obtain the logical structure of the script program. The logical structure of the first form robot program is accurately determined.
[0115] The following describes in detail the process of generating the second form robot program based on the logical structure of the first form robot program.
[0116] As an optional implementation, the first form robot program is a graphical program, the program block identifier of the first form robot program is an instruction block identifier, and the program block content of the first form robot program is a graphic instruction block; the second form robot program is a script program, the program block identifier of the second form robot program is a command line identifier, and the program block content of the second form robot program is a script command line.
[0117] Optionally, the first form robot program is a graphical program, and the graphical program includes multiple instruction block identifiers and graphic instruction blocks uniquely corresponding to each instruction block identifier, that is, the program block identifier of the first form robot program is the instruction block identifier of the graphical program, and the program block content of the first form robot program is the graphic instruction block of the graphical program. Exemplarily, the instruction block identifier of the graphical program can be instruction block A, instruction block B, instruction block C, etc.
[0118] The graphical program is converted into a second form robot program, i.e., a script program, wherein the script program includes multiple command line identifiers and a script command line uniquely corresponding to each command line identifier, i.e., the program block identifier of the second form robot program is the command line identifier of the script program, and the program block content of the second form robot program is the script command line of the script program. For example, the command line identifier of the script program can be command line 1, command line 2, command line 3, etc.
[0119] Figure 4 A schematic diagram of a flow chart of generating a second-form robot program according to a program processing method provided in an embodiment of the present application, such as Figure 4 As shown, the step of generating the second form robot program according to the logical structure of the first form robot program in the above step S102 includes:
[0120] S401. According to the logical structure of the first form robot program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines, and a corresponding command line identifier is assigned to each script command line, and the command line identifier is used as the command line identifier corresponding to the instruction block identifier.
[0121] Optionally, the first form robot program is a graphical program, and according to the logical structure of the graphical program loop, selection, jump or nesting, the type and topological relationship of each graphical instruction block are analyzed. Exemplarily, the type of the graphical instruction block may include assignment, comparison or judgment, and according to the type and topological relationship of each graphical instruction block, the graphical instruction blocks corresponding to each instruction block identifier in the graphical program are translated into each script command line one by one. Among them, the graphical instruction block corresponding to an instruction block identifier can be translated into multiple script command lines, for example, the graphical instruction block corresponding to instruction block A can be translated into 2 command lines, and the graphical instruction block corresponding to instruction block B can be translated into 3 command lines.
[0122] Unique corresponding command line identifiers are assigned to each translated script command line in the order of the script command lines, such as command line 1, command line 2, command line 3, command line 4, and command line 5. The command line identifier is used as the command line identifier corresponding to the instruction block identifier, so that each instruction block identifier corresponds to each command line identifier, for example, command line 1 and command line 2 are used as the command line identifiers corresponding to instruction block A, and command line 3, command line 4, and command line 5 are used as the command line identifiers corresponding to instruction block B, so that instruction block A corresponds to command line 1 and command line 2, and instruction block B corresponds to command line 3, command line 4, and command line 5.
[0123] S402. According to the logical structure of the graphical program, the script command lines corresponding to the command line identifiers are spliced into a second-form robot program.
[0124] Optionally, according to the logical structure of the graphical program loop, selection, jump or nesting, the script command lines corresponding to each command line identifier are script spliced, and the script command lines corresponding to each command line identifier are spliced into a script program, that is, the script command lines corresponding to each command line identifier are spliced into a second-form robot program, thereby realizing the morphological transformation from the first-form robot program to the second-form robot program, that is, realizing the morphological transformation from the graphical program to the script program.
[0125] In this embodiment, if the first form robot program is a graphical program, then according to the logical structure of the graphical program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines one by one, and unique command line identifiers are assigned to the translated script command lines in the order of the script command lines. The command line identifier is used as the command line identifier corresponding to the instruction block identifier, so that each instruction block identifier corresponds to each command line identifier. According to the logical structure of the graphical program, the script command lines corresponding to each command line identifier are spliced, and the script command lines corresponding to each command line identifier are spliced into a script program, so as to realize the form conversion from the first form graphical program to the second form script program.
[0126] As an optional implementation, the first form robot program is a script program, the program block identifier of the first form robot program is a command line identifier, and the program block content of the first form robot program is a script command line; the second form robot program is a graphical program, the program block identifier of the second form robot program is an instruction block identifier, and the program block content of the second form robot program is a graphical instruction block.
[0127] Optionally, the first form robot program is a script program, which includes multiple command line identifiers and script command lines that uniquely correspond to each command line identifier, that is, the program block identifier of the first form robot program is the command line identifier of the script program, and the program block content of the first form robot program is the script command line of the script program. The script program is converted into a second form robot program, that is, a graphical program, which includes multiple instruction block identifiers and graphic instruction blocks that uniquely correspond to each instruction block identifier, that is, the program block identifier of the second form robot program is the instruction block identifier of the graphical program, and the program block content of the second form robot program is the graphic instruction block of the graphical program.
[0128] Figure 5 Another flowchart of the program processing method provided in the embodiment of the present application for generating a second-form robot program is shown in FIG. Figure 5 As shown, the step of generating the second form robot program according to the logical structure of the first form robot program in the above step S102 includes:
[0129] S501. According to the logical structure of the first form robot program, the script command lines corresponding to the command line identifiers in the script program are translated into graphic instruction blocks, and corresponding instruction block identifiers are assigned to each graphic instruction block, and the instruction block identifier is used as the instruction block identifier corresponding to the command line identifier.
[0130] Optionally, the first form of robot program is a script program, and according to the logical structure of the script program loop, selection, jump or nesting, the type and topological relationship of each script command line are analyzed. Exemplarily, the type of the script command line may include assignment, comparison or judgment, and according to the type and topological relationship of each script command line, the script command lines corresponding to each command line identifier in the script program are translated into each graphic instruction block one by one. Among them, multiple script command lines corresponding to multiple command line identifiers can be translated into a graphic instruction block, for example, the script command line corresponding to command line 1 and the script command line corresponding to command line 2 can be translated into a graphic instruction block, and the script command line corresponding to command line 3, the script command line corresponding to command line 4 and the script command line corresponding to command line 5 can be translated into a graphic instruction block.
[0131] Unique corresponding instruction block identifiers are sequentially assigned to each translated graphic instruction block in the order of the graphic instruction blocks, such as instruction block A and instruction block B. The instruction block identifier is used as the instruction block identifier corresponding to the command line identifier, so that each command line identifier corresponds to each instruction block identifier. For example, instruction block A is used as the instruction block identifier corresponding to command line 1 and command line 2, and instruction block B is used as the instruction block identifier corresponding to command line 3, command line 4, and command line 5, so that command line 1 and command line 2 correspond to instruction block A, and command line 3, command line 4, and command line 5 correspond to instruction block B.
[0132] S502. According to the logical structure of the script program, the graphic instruction blocks corresponding to the instruction block identifiers are spliced into a second form robot program.
[0133] Optionally, according to the logical structure of the script program loop, selection, jump or nesting, the graphic instruction blocks corresponding to each instruction block identifier are graphically spliced, and the graphic instruction blocks corresponding to each instruction block identifier are spliced into a graphical program, that is, the graphic instruction blocks corresponding to each instruction block identifier are spliced into a second-form robot program, thereby realizing the morphological transformation from the first-form robot program to the second-form robot program, that is, realizing the morphological transformation from the script program to the graphical program.
[0134] In this embodiment, if the first form robot program is a script program, then according to the logical structure of the script program, the script command lines corresponding to the command line identifiers in the script are translated into graphic instruction blocks one by one, and unique corresponding instruction block identifiers are assigned to each translated graphic instruction block in the order of the graphic instruction blocks. The instruction block identifier is used as the instruction block identifier corresponding to the command line identifier, so that each command line identifier corresponds to each instruction block identifier. According to the logical structure of the script program, the graphic instruction blocks corresponding to each instruction block identifier are graphically spliced, and the graphic instruction blocks corresponding to each instruction block identifier are spliced into a graphical program, so as to realize the form conversion from the first form script program to the second form graphical program.
[0135] The following describes in detail the process of displaying the first form robot program and the second form robot program in different areas of the programming interface.
[0136] Figure 6 A flowchart showing a first-form robot program and a second-form robot program of a program processing method provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the step of displaying the first form robot program and the second form robot program in different areas of the programming interface in the above step S103 includes:
[0137] S601. Display the script programs in the first form robot program and the second form robot program in the first area of the programming interface, and display the graphical programs in the first form robot program and the second form robot program in the second area of the programming interface.
[0138] Optionally, the first form robot program and the second form robot program include a script program and a graphical program, for example, the first form robot program is a script program and the second form robot program is a graphical program, or the first form robot program is a graphical program and the second form robot program is a script program. The programming interface provided by the computer device may include a first area and a second area, and the script program in the first form robot program and the second form robot program is displayed in the first area of the programming interface, and the graphical program in the first form robot program and the second form robot program is displayed in the second area of the programming interface.
[0139] For example, continue to refer to Figure 2 The first area may be the left area of the programming interface, and the second area may be the right area of the programming interface. The script program is displayed in the left area of the programming interface, and the graphical program is displayed in the right area of the programming interface, so that the script program and the graphical program are displayed on the left and right sides of the programming interface at the same time.
[0140] S602: Run the script program displayed in the first area in real time, and highlight the target script command line corresponding to the target command line identifier currently running in the first area according to each command line identifier in the script program.
[0141] Optionally, the computer device responds to the user's trigger operation on the script running control, runs the script program displayed in the first area of the programming interface in real time, and updates the target command line identifier currently running in the script program in real time. According to the target command line identifier currently running in the script program, the target script command line corresponding to the target command line identifier currently running is determined, and the target script command line corresponding to the target command line identifier currently running is highlighted in the first area of the programming interface.
[0142] For example, continue to refer to Figure 2 , the command line of the currently running target script is highlighted in the left area of the programming interface as "sleep(1)".
[0143] S603. According to the mapping relationship, highlight the target graphic instruction block corresponding to the target script command line in the second area.
[0144] Optionally, the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is the mapping relationship between each instruction block identifier in the graphical program and each command line identifier in the script program. According to the mapping relationship between each instruction block identifier in the graphical program and each command line identifier in the script program, the target instruction block identifier in the graphical program corresponding to the target instruction line identifier in the script program is searched, and according to the target instruction block identifier, the target graphic instruction block corresponding to the target instruction block identifier in the graphical program is highlighted in the second area of the programming interface. The target script command line is highlighted in the first area, and the target graphic instruction block corresponding to the target script command line is highlighted in the second area.
[0145] For example, continue to refer to Figure 2 , the target graphic instruction block "Wait 1 second" corresponding to the currently running target script command line "sleep(1)" is highlighted in the right area of the programming interface.
[0146] In this embodiment, the programming interface includes a first area and a second area, and the script program in the first form robot program and the second form robot program is displayed in the first area of the programming interface, and the graphical program in the first form robot program and the second form robot program is displayed in the second area of the programming interface, so that the script program and the graphical program are displayed simultaneously in two different areas of the programming interface. The script program displayed in the first area of the programming interface is run in real time, and the target command line identifier currently running in the script program is updated in real time. According to the target command line identifier currently running in the script program, the target script command line corresponding to the target command line identifier currently running is determined, and the target script command corresponding to the target command line identifier currently running is highlighted in the first area of the programming interface. According to the mapping relationship between each instruction block identifier in the graphical program and each command line identifier in the script program, the target instruction block identifier in the graphical program corresponding to the target instruction line identifier in the script program is searched, and according to the target instruction block identifier, the target graphic instruction block corresponding to the target instruction block identifier in the graphical program is highlighted in the second area of the programming interface. The highlighting display of the target script command line in the first area and the highlighting display of the target graphic instruction block corresponding to the target script command line in the second area are realized.
[0147] The following describes in detail the process of updating the first form robot program and the second form robot program, and updating the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0148] Figure 7 A flowchart of the updating robot program and the mapping relationship of the program processing method provided in the embodiment of the present application is shown as follows: Figure 7As shown, the step of updating the first form robot program and the second form robot program in the above step S104, and updating the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, includes:
[0149] S701. Update the first form robot program to obtain an updated first form robot program.
[0150] Optionally, the computer device updates the first form robot program in response to the user's update operation on the first form robot program to obtain an updated first form robot program. Wherein, updating the first form robot program may include adding program block content, deleting program block content, or modifying program block content in the first form robot program.
[0151] S702: Determine the logical structure of the updated first-form robot program, and update the second-form robot program according to the updated logical structure of the first-form robot program to obtain an updated second-form robot program.
[0152] Optionally, according to the updated first form robot program, the updated first form robot program is re-parsed to determine the logical structure of the updated first form robot program. It is worth noting that the step of determining the logical structure of the updated first form robot program is similar to the step of determining the logical structure of the first form robot program in the aforementioned embodiment, and will not be repeated here.
[0153] According to the update type of the first form robot program and the logical structure of the updated first form robot program, the second form robot program is updated to obtain the updated second form robot program. For example, if a nested structure is added to the first form robot program, a corresponding nested structure is added to the second form robot program to obtain the updated second form robot program.
[0154] For example, Figure 8 The interface diagram of the update robot program and mapping relationship provided in the embodiment of the present application is as follows: Figure 8 As shown, if the first form robot program is a script program and the second form robot is a graphical program, then after editing the script program, the graphical program is updated accordingly. If the first form robot program is a graphical program and the second form robot is a script program, then after editing the graphical program, the script program is updated accordingly.
[0155] S703: Construct a mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program.
[0156] Optionally, in the process of updating the second form robot program, each program block identifier in the updated first form robot program is re-matched with each program block identifier in the updated second form robot program one by one, and the corresponding relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program is determined. Based on the corresponding relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program, each program block identifier in the updated first form robot program is re-mapped to each program block identifier in the updated second form robot program, and the mapping table is updated, that is, the mapping relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program is updated.
[0157] In this embodiment, the first form robot program is updated to obtain the updated first form robot program. According to the updated first form robot program, the updated first form robot program is re-parsed to determine the logical structure of the updated first form robot program. According to the update type of the first form robot program and the logical structure of the updated first form robot program, the second form robot program is updated to obtain the updated second form robot program. In the process of updating the second form robot program, each program block identifier in the updated first form robot program is re-matched with each program block identifier in the updated second form robot program one by one to determine the corresponding relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program. Based on the corresponding relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program, each program block identifier in the updated first form robot program is re-mapped to each program block identifier in the updated second form robot program, and the mapping table is updated to construct the mapping relationship between each program block identifier in the updated first form robot program and each program block identifier in the updated second form robot program. The accuracy of the mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program is ensured.
[0158] The following describes in detail the process of updating the second form robot program based on the updated logical structure of the first form robot program.
[0159] Fig. 9 A schematic diagram of a flow chart of updating a second-mode robot program according to a program processing method provided in an embodiment of the present application, such as Fig. 9 As shown, the step of updating the second form robot program according to the updated logical structure of the first form robot program in the above step S702 includes:
[0160] S901. Determine, according to the logical structure of the updated first-form robot program, a first program block identifier that has changed in the updated first-form robot program and a changed program block content corresponding to the first program block identifier.
[0161] Optionally, in the process of updating the first form robot program, the program block identifier of the changed program block content is recorded in real time as the first program block identifier that has changed in the first form robot program after the update. Exemplarily, if the user adds, deletes or modifies at least one program block content in the process of editing the first form robot program, the program block identifier of the at least one program block content that has been added, deleted or modified is used as the changed first program block identifier.
[0162] Based on the logical structure of the updated first-form robot program obtained by parsing, the changed program block content corresponding to the changed first program block identifier in the updated first-form robot program is identified. The changed program block content corresponding to the changed first program block identifier may be a program block content newly added, deleted, or modified by the user during the editing of the first-form robot program.
[0163] S902. Determine the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier according to the program block identifier and the mapping relationship that have changed in the updated first form robot program.
[0164] Optionally, if the changed program block content corresponding to the first program block identifier that has changed in the first form robot program after the update is a newly added program block content, then according to the logical structure of the first form robot program after the update, the changed program block contents corresponding to each first program block identifier that has changed in the first form robot program after the update are first translated one by one into each changed program block content in the second form robot program, and then the unique corresponding second program block identifier that needs to be updated is assigned in turn to each changed program block content in the translated second form robot program.
[0165] If the changed program block content corresponding to the first program block identifier that has changed in the first form robot program after the update is the deleted or modified program block content, then based on the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, the program block identifier in the second form robot program corresponding to the deleted or modified program block identifier in the first form robot program is searched as the second program block identifier that needs to be updated in the second form robot program, and the program block content corresponding to the program block identifier in the second form robot program is used as the changed program block content corresponding to the second program block identifier that needs to be updated in the second form robot program.
[0166] S903: Update the second form robot program according to the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier.
[0167] Optionally, if the changed program block content corresponding to the first program block identifier that has changed in the first form robot program after the update is a newly added program block content, then based on the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier, the changed program block content corresponding to the second program block identifier is added to the second form robot program.
[0168] If the changed program block content corresponding to the first program block identifier that has changed in the first form robot program after the update is the deleted or modified program block content, then based on the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier, the changed program block content corresponding to the second program block identifier is deleted or modified in the second form robot program to obtain the updated second form robot program.
[0169] In this embodiment, the program block identifier of the program block content that has changed during the process of updating the first form robot program is recorded in real time as the first program block identifier that has changed in the first form robot program after the update. Based on the logical structure of the first form robot program after the update, the changed program block content corresponding to the first program block identifier that has changed in the first form robot program after the update is identified. If the program block content is newly added in the first form robot program after the update, then according to the logical structure of the first form robot program after the update, the changed program block content corresponding to each first program block identifier that has changed in the first form robot program after the update is translated into each changed program block content in the second form robot program, and the unique corresponding second program block identifier that needs to be updated is sequentially assigned to each changed program block content in the translated second form robot program. If the program block content is deleted or modified in the first form robot program after the update, then according to the mapping relationship, the program block identifier in the second form robot program corresponding to the program block identifier deleted or modified in the first form robot program is searched as the second program block identifier that needs to be updated in the second form robot program, and the program block content corresponding to the program block identifier in the second form robot program is used as the changed program block content corresponding to the second program block identifier that needs to be updated in the second form robot program. If the program block content is added, deleted or modified in the first form robot program after the update, then according to the second program block identifier that needs to be updated in the second form robot program and the modified program block content corresponding to the second program block identifier, the modified program block content corresponding to the second program block identifier is added, deleted or modified in the second form robot program. The logical consistency of the first form robot program after the update and the second form robot program after the update is ensured.
[0170] Fig.10 Another flowchart of the program processing method provided in the embodiment of the present application is as follows: Fig.10 As shown, the method also includes:
[0171] S1001. Run the script program displayed in the first area in real time, and record the error command line identifier when the script program reports an error.
[0172] Optionally, during the real-time running of the script program displayed in the first area of the programming interface, real-time error monitoring of the script program is performed, and if a script program error is monitored, an error command line identifier when the script program reports an error is recorded.
[0173] S1002: Determine, according to the error reporting command line identifier and the mapping relationship, the error reporting instruction block identifier corresponding to the error reporting command line identifier and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier.
[0174] Optionally, according to the error reporting command line identifier, the error reporting script command line corresponding to the error reporting command line identifier in the script program is determined. According to the mapping relationship between each instruction block identifier in the graphical program and each command line identifier in the script program, the error reporting instruction block identifier in the graphical program corresponding to the error reporting instruction line identifier in the script program is searched, and according to the error reporting instruction block identifier, the error reporting graphic instruction block corresponding to the error reporting instruction block identifier in the graphical program is determined.
[0175] S1003: Generate and output an error warning according to the error command line identifier, the error command line corresponding to the error command line identifier, the error instruction block identifier, and the error graphic instruction block corresponding to the error instruction block identifier.
[0176] Optionally, an alarm warning is generated based on the error command line identifier in the script program and the error command line corresponding to the error command line identifier, as well as the error instruction block identifier in the graphical program and the error graphic instruction block corresponding to the error instruction block identifier, and an alarm warning is output to prompt the user that the error command line corresponding to the error command line identifier in the script program has an error in running, and corresponds to the error graphic instruction block corresponding to the error instruction block identifier in the graphical program.
[0177] In this embodiment, during the process of running the script program displayed in the first area of the programming interface in real time, the real-time error reporting monitoring of the script program is performed, the error reporting command line identifier when the script program reports an error is recorded, and the error reporting script command line corresponding to the error reporting command line identifier in the script program is determined according to the error reporting command line identifier. According to the mapping relationship between each instruction block identifier in the graphical program and each command line identifier in the script program, the error reporting instruction block identifier in the graphical program corresponding to the error reporting instruction line identifier in the script program is searched, and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier in the graphical program is determined according to the error reporting instruction block identifier. According to the error reporting command line identifier in the script program and the error reporting command line corresponding to the error reporting command line identifier, and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier in the graphical program, an alarm warning is generated and output to prompt the user that the error reporting command line corresponding to the error reporting command line identifier in the script program is running incorrectly, and corresponds to the error reporting graphic instruction block corresponding to the error reporting instruction block identifier in the graphical program. By performing real-time error reporting monitoring on the script program and outputting an alarm warning, the efficiency of abnormal operation processing of the script program can be improved.
[0178] Based on the same inventive concept, a program processing device corresponding to the program processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned program processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0179] Fig.11 The module structure diagram of the program processing device provided in the embodiment of the present application is as follows: Fig.11 As shown, the device comprises:
[0180] The acquisition module 1101 is used to acquire a pre-written first-form robot program, where the first-form robot program is a graphical program or a script program, and the first-form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier.
[0181] The determination module 1102 is used to determine the logical structure of the first form robot program according to the first form robot program, and generate a second form robot program according to the logical structure of the first form robot program. The second form robot program includes: multiple program block identifiers and program block contents corresponding to each program block identifier.
[0182] The display module 1103 is used to construct a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and display the first form robot program and the second form robot program in different areas of the programming interface.
[0183] The updating module 1104 is used to update the first form robot program and the second form robot program in response to the updating operation on the first form robot program, and update the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program.
[0184] As an optional implementation, the determination module 1102 is specifically configured to:
[0185] The form of the first-form robot program is determined, and the form is a graphical form or a script form.
[0186] According to the form of the first form robot program, the first form robot program is parsed to obtain the logical structure of the first form robot program.
[0187] As an optional implementation, the determination module 1102 is specifically configured to:
[0188] According to the logical structure of the first form robot program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines, and a corresponding command line identifier is assigned to each script command line, and the command line identifier is used as the command line identifier corresponding to the instruction block identifier.
[0189] According to the logical structure of the graphical program, the script command lines corresponding to the command line identifiers are spliced into a second-form robot program.
[0190] As an optional implementation, the determination module 1102 is specifically configured to:
[0191] According to the logical structure of the first form robot program, the script command lines corresponding to the command line identifiers in the script program are translated into graphic instruction blocks, and a corresponding instruction block identifier is assigned to each graphic instruction block, and the instruction block identifier is used as the instruction block identifier corresponding to the command line identifier.
[0192] According to the logical structure of the script program, the graphic instruction blocks corresponding to the instruction block identifiers are spliced into a second form robot program.
[0193] As an optional implementation manner, the display module 1103 is specifically used for:
[0194] The script programs in the first form robot program and the second form robot program are displayed in the first area of the programming interface, and the graphical programs in the first form robot program and the second form robot program are displayed in the second area of the programming interface.
[0195] The script program displayed in the first area is run in real time, and according to each command line identifier in the script program, the target script command line corresponding to the target command line identifier currently being run is highlighted in the first area.
[0196] According to the mapping relationship, the target graphic instruction block corresponding to the target script command line is highlighted in the second area.
[0197] As an optional implementation, the updating module 1104 is specifically used for:
[0198] The first-form robot program is updated to obtain an updated first-form robot program.
[0199] The logical structure of the updated first-form robot program is determined, and the second-form robot program is updated according to the logical structure of the updated first-form robot program to obtain an updated second-form robot program.
[0200] A mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program is constructed.
[0201] As an optional implementation, the updating module 1104 is specifically used for:
[0202] According to the logical structure of the updated first-form robot program, a first program block identifier that has changed in the updated first-form robot program and a changed program block content corresponding to the first program block identifier are determined.
[0203] According to the changed program block identifiers and mapping relationships in the updated first form robot program, the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier are determined.
[0204] The second form robot program is updated according to the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier.
[0205] As an optional implementation, the device further includes: an error reporting module 1105, and the error reporting module 1105 is specifically used to:
[0206] The script program displayed in the first area is run in real time, and the error command line identifier when the script program reports an error is recorded.
[0207] According to the error reporting command line identifier and the mapping relationship, the error reporting instruction block identifier corresponding to the error reporting command line identifier and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier are determined.
[0208] An error warning is generated and outputted according to the error command line identifier, the error command line corresponding to the error command line identifier, the error instruction block identifier, and the error graphic instruction block corresponding to the error instruction block identifier.
[0209] The present application also provides a computer device, such as Fig.12 1 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application, including: a processor 121, a memory 122 and a bus 123. The memory 122 stores machine-readable instructions executable by the processor 121 (for example, Fig.11 In the device, the execution instructions corresponding to the acquisition module 1101, the determination module 1102, the display module 1103, the update module 1104 and the error reporting module 1105 are obtained, etc. When the computer device is running, the processor 121 communicates with the memory 122 through the bus 123. When the machine-readable instructions are executed by the processor 121, the steps of the program processing method in the above embodiment are executed.
[0210] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the program processing method in the above embodiment are executed.
[0211] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0212] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0213] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A program processing method, characterized in that: The method comprises: Obtaining a pre-written first-form robot program, wherein the first-form robot program is a graphical program or a script program, and the first-form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier; According to the first form robot program, determining the logical structure of the first form robot program, and generating a second form robot program according to the logical structure of the first form robot program, wherein the second form robot program includes: a plurality of program block identifiers and program block contents corresponding to each program block identifier; Constructing a mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, and displaying the first form robot program and the second form robot program in different areas of a programming interface; In response to the update operation on the first form robot program, the first form robot program and the second form robot program are updated, and the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program is updated.
2. The method according to claim 1, characterized in that: Determining the logical structure of the first form robot program according to the first form robot program includes: Determine the form of the first form robot program, the form being a graphical form or a script form; According to the form of the first-form robot program, the first-form robot program is parsed to obtain the logical structure of the first-form robot program.
3. The method according to claim 1, characterized in that The first form robot program is a graphical program, the program block identifier of the first form robot program is an instruction block identifier, and the program block content of the first form robot program is a graphical instruction block; the second form robot program is a script program, the program block identifier of the second form robot program is a command line identifier, and the program block content of the second form robot program is a script command line; The step of generating a second form robot program according to the logical structure of the first form robot program comprises: According to the logical structure of the first form of robot program, the graphic instruction blocks corresponding to the instruction block identifiers in the graphical program are translated into script command lines, and a corresponding command line identifier is assigned to each script command line, and the command line identifier is used as the command line identifier corresponding to the instruction block identifier; According to the logical structure of the graphical program, the script command lines corresponding to the command line identifiers are spliced into the second form robot program.
4. The method according to claim 1, characterized in that The first form robot program is a script program, the program block identifier of the first form robot program is a command line identifier, and the program block content of the first form robot program is a script command line; the second form robot program is a graphical program, the program block identifier of the second form robot program is an instruction block identifier, and the program block content of the second form robot program is a graphical instruction block; The step of generating a second form robot program according to the logical structure of the first form robot program comprises: According to the logical structure of the first form of robot program, the script command lines corresponding to the command line identifiers in the script program are translated into graphic instruction blocks, and corresponding instruction block identifiers are assigned to the graphic instruction blocks, and the instruction block identifiers are used as the instruction block identifiers corresponding to the command line identifiers; According to the logical structure of the script program, the graphic instruction blocks corresponding to the instruction block identifiers are spliced into the second form robot program.
5. The method according to claim 1, characterized in that The step of displaying the first form robot program and the second form robot program in different areas of the programming interface includes: Displaying the script programs in the first form robot program and the second form robot program in the first area of the programming interface, and displaying the graphical programs in the first form robot program and the second form robot program in the second area of the programming interface; Running the script program displayed in the first area in real time, and highlighting the target script command line corresponding to the target command line identifier currently running in the first area according to each command line identifier in the script program; According to the mapping relationship, the target graphic instruction block corresponding to the target script command line is highlighted in the second area.
6. The method according to claim 1, characterized in that The updating of the first form robot program and the second form robot program, and updating the mapping relationship between each program block identifier in the first form robot program and each program block identifier in the second form robot program, includes: updating the first-form robot program to obtain an updated first-form robot program; Determine the logical structure of the updated first-form robot program, and update the second-form robot program according to the logical structure of the updated first-form robot program to obtain an updated second-form robot program; A mapping relationship between each program block identifier in the updated first-form robot program and each program block identifier in the updated second-form robot program is constructed.
7. The method according to claim 6, characterized in that The updating of the second form robot program according to the updated logical structure of the first form robot program comprises: Determine, according to the logical structure of the updated first-form robot program, a first program block identifier that has been changed in the updated first-form robot program and a changed program block content corresponding to the first program block identifier; Determine, according to the changed program block identifier and mapping relationship in the updated first-form robot program, a second program block identifier that needs to be updated in the second-form robot program and a changed program block content corresponding to the second program block identifier; The second form robot program is updated according to the second program block identifier that needs to be updated in the second form robot program and the changed program block content corresponding to the second program block identifier.
8. The method according to claim 5, characterized in that The method further comprises: Running the script program displayed in the first area in real time, and recording an error reporting command line identifier when the script program reports an error; According to the error reporting command line identifier and the mapping relationship, determining the error reporting instruction block identifier corresponding to the error reporting command line identifier and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier; An error warning is generated and outputted according to the error reporting command line identifier, the error reporting command line corresponding to the error reporting command line identifier, the error reporting instruction block identifier, and the error reporting graphic instruction block corresponding to the error reporting instruction block identifier.
9. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the program processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the program processing method according to any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
Building block generation method and device, equipment and storage medium
CN112965709A
Editing system of script program for automated testing
CN113126983A
Code conversion method and semantic association relationship obtaining method and device
CN117008887A
Synchronization of a graphical program and a robot program
EP1855194A1
Program processing method and apparatus, program running method and apparatus, terminal, smart card and storage medium
WO2023208012A1