Building block generation method, device, equipment and storage medium
By generating custom building blocks, the problem of limited robot operation caused by fixed building blocks in existing technologies is solved, enabling robots to perform more complex operations.
Patent Information
- Application Number
- CN202110368379.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-06
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-04-06
AI Technical Summary
Existing visual programming tools provide fixed building blocks, which means users can only combine existing blocks, making it impossible to control the robot to perform more operations.
By acquiring the robot's motion files, generating motion code files, and displaying custom blocks based on preset block display parameters, the types and functions of blocks are expanded.
It increases the complexity and diversity of operations that robots can perform, providing them with unlimited scalability and making it easier to complete more complex tasks.
Smart Images

Figure CN112965709B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robotics, and more specifically, to a method, device, equipment and storage medium for generating building blocks. Background Art
[0002] With the advent of the era of artificial intelligence, information-based education has become a new trend in education. At the same time, building block programming has emerged. Building block programming adopts a gamified teaching method, replacing professional code writing with the splicing of simple building blocks, and occupies an important position in the field of children's programming education.
[0003] In the prior art, a user installs an electronic programming software on an electronic device. The electronic programming software provides a visual programming tool, such as Blockly. The visual programming tool provides multiple building blocks. The user only needs to drag the building blocks to combine the blocks to implement building block programming, and then use the generated control code to control the robot to perform corresponding operations.
[0004] However, the building blocks provided by current visual programming tools are fixed, and users can only combine existing building blocks to program, resulting in the inability to control the robot to perform more operations. Summary of the invention
[0005] The purpose of the present application is to provide a method, device, equipment and storage medium for generating building blocks in view of the deficiencies in the above-mentioned prior art, so as to solve the problem in the prior art that users can only combine two existing building blocks for programming, resulting in the inability to control the robot to perform more operations.
[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 method for generating a building block, the method comprising:
[0008] Acquire at least one action file of the robot, each action file including action parameters of the robot performing a corresponding action;
[0009] According to each action file, generating an action code file of the corresponding action;
[0010] The building blocks corresponding to the corresponding actions are generated according to the preset building block display configuration parameters and the action code file.
[0011] In an optional implementation, before obtaining at least one action file of the robot, the method further includes:
[0012] Configuring action parameters of at least one action of the robot in an action editing interface;
[0013] The at least one action file is generated according to the action parameters of the at least one action.
[0014] In an optional implementation manner, after generating the at least one action file according to the action parameters of the at least one action, the method further includes:
[0015] Saving the at least one action file to a preset path;
[0016] Accordingly, the step of obtaining at least one action file of the robot includes:
[0017] The at least one action file is acquired by scanning the files in the preset path.
[0018] In an optional implementation manner, generating the action code file of the corresponding action according to each action file includes:
[0019] The action parameters in each action file are written into a preset code line in a preset code file to generate the action code file.
[0020] In an optional implementation, before generating the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file, the method further includes:
[0021] According to the input configuration operation, configuring the building block definition file of the corresponding action, wherein the building block definition file includes display configuration parameters of the building block corresponding to the corresponding action;
[0022] The generating of the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file includes:
[0023] A building block corresponding to the corresponding action is generated according to the building block definition file and the action code file.
[0024] In an optional implementation, after generating the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file, the method further includes:
[0025] The building blocks corresponding to the corresponding actions are displayed in the visual programming interface.
[0026] In an optional implementation, before displaying the building blocks corresponding to the corresponding actions in the visual programming interface, the method further includes:
[0027] Generating identification information of each action file according to the corresponding action;
[0028] The displaying of the building blocks corresponding to the corresponding actions in the visual programming interface includes:
[0029] The building blocks corresponding to the corresponding actions and the identification information are displayed in the visual programming interface.
[0030] In a second aspect, another embodiment of the present application provides a device for generating a building block, the device comprising:
[0031] An acquisition module, used to acquire at least one action file of the robot, each action file including action parameters for the robot to perform a corresponding action;
[0032] A generating module, used for generating an action code file of the corresponding action according to each action file;
[0033] The generating module is further used to generate the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file.
[0034] In an optional embodiment, it also includes:
[0035] A configuration module, used to configure action parameters of at least one action of the robot in an action editing interface;
[0036] The generating module is further used to generate the at least one action file according to the action parameters of the at least one action.
[0037] In an optional embodiment, it also includes:
[0038] A saving module, used for saving the at least one action file to a preset path;
[0039] Get the module, specifically for:
[0040] The at least one action file is acquired by scanning the files in the preset path.
[0041] In an optional implementation, the generating module is specifically configured to:
[0042] The action parameters in each action file are written into a preset code line in a preset code file to generate the action code file.
[0043] In an optional implementation manner, the configuration module is further configured to:
[0044] According to the input configuration operation, configuring the building block definition file of the corresponding action, wherein the building block definition file includes display configuration parameters of the building block corresponding to the corresponding action;
[0045] Generate modules, specifically for:
[0046] A building block corresponding to the corresponding action is generated according to the building block definition file and the action code file.
[0047] In an optional embodiment, it also includes:
[0048] The display module is used to display the building blocks corresponding to the corresponding actions in the visual programming interface.
[0049] In an optional implementation, the generating module is further used for:
[0050] Generating identification information of each action file according to the corresponding action;
[0051] Display module, specifically used for:
[0052] The building blocks corresponding to the corresponding actions and the identification information are displayed in the visual programming interface.
[0053] In the third aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores a computer program executable by the processor, and when the electronic device is running, the processor communicates with the memory through the bus, and the processor executes the computer program to execute any one of the methods described in the first aspect above.
[0054] In a fourth aspect, another 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 method described in any one of the above-mentioned first aspects is executed.
[0055] The present application provides a method, device, equipment and storage medium for generating building blocks, wherein the method includes: obtaining at least one action file of a robot, each action file including action parameters for the robot to perform a corresponding action, generating an action code file for the corresponding action according to each action file, and generating a building block corresponding to the corresponding action according to preset building block display configuration parameters and action code files. The present application generates new building blocks through the action files of the robot, thereby expanding more building blocks on the basis of existing building blocks, making it easier for the robot to complete more complex operations, and increasing unlimited scalability for the robot. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] 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.
[0057] Figure 1 A schematic diagram of a scenario of a method for generating building blocks provided in an embodiment of the present application is shown;
[0058] Figure 2 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 1 ;
[0059] Figure 3 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 2 ;
[0060] Figure 4 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 3 ;
[0061] Figure 5 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 4 ;
[0062] Figure 6 A schematic diagram of the structure of a device for generating building blocks provided in an embodiment of the present application is shown;
[0063] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0064] 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.
[0065] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all 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.
[0066] 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.
[0067] In view of the problem that the building blocks provided by current visual programming tools are fixed and users can only combine existing building blocks to program, resulting in the inability to control the robot to perform more operations, this application provides a building block generation method based on the existing building blocks, generates new building blocks through the robot's action files, thereby expanding more building blocks, making it easier for the robot to complete more complex operations, and increasing unlimited scalability for the robot.
[0068] The method for generating building blocks provided by the present application is described in detail below in conjunction with several specific embodiments.
[0069] Figure 1 A schematic diagram of a scenario of a method for generating building blocks provided in an embodiment of the present application is shown, Figure 1 As shown, it includes: an electronic device 10 and a robot 20 that are communicatively connected, wherein the electronic device 10 can be, for example, a smart phone, a tablet computer, a laptop computer, etc., and this embodiment does not specifically limit this.
[0070] The electronic device 10 is installed with electronic programming software, which provides a visual programming tool (such as Blockly). The interface of the visual programming tool provides multiple building blocks, each of which has a certain logical function, such as controlling the robot to squat, controlling the robot to reach out, controlling the robot to walk, etc. In general, the user only needs to drag the required building blocks to combine the building blocks to implement building block programming, and then control the robot to perform corresponding operations according to the generated control code. For example, the corresponding operation can be to control the robot to squat and reach out to pick up a small ball on the ground.
[0071] However, since the building blocks provided for the visual programming tool are fixed, users can only combine existing building blocks to program, resulting in limited operations that the robot can perform. In order to enable the robot to perform more complex operations, in the present application, the electronic programming software provides an action editing interface. Users can edit the parameters of the servos of various parts of the robot in the action editing interface according to actual action requirements, such as the servo angle, and then generate an action code file for each action based on the edited servo parameters. After that, the building blocks corresponding to each action are generated according to the preset building block display configuration parameters and the action code file. In other words, the building blocks for custom actions can be generated through the underlying code files and the configuration parameters of the display layer.
[0072] In this way, not only the original building blocks can be displayed on the interface of the visual programming tool, but also the newly generated building blocks can be displayed on the interface of the visual programming tool. In this way, when the user performs building block programming, there are more building blocks to choose from, and the building blocks have more logical functions, so the robot can be controlled to perform more and more complex operations.
[0073] Figure 2 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 1 The execution subject of this embodiment may be a device for generating building blocks, and the device for generating building blocks may be integrated into an electronic device. Figure 2 As shown, the method may include:
[0074] S101. Obtain at least one action file of a robot.
[0075] S102: Generate an action code file of a corresponding action according to each action file.
[0076] Each action file includes action parameters for the robot to perform corresponding actions. One action file corresponds to one corresponding action. The corresponding action can be a custom action. The action parameters may include servo parameters set at various parts of the robot, such as servo angle and servo rotation duration.
[0077] For example, the robot is equipped with 18 servos, which control the rotation of different parts respectively. Therefore, according to the needs, the robot can be controlled to complete a custom action by setting the servo angles and servo rotation durations of the robot's 18 servos.
[0078] Among them, the electronic device is installed with electronic programming software, and the user can edit at least one action file of the robot through the electronic programming software. Correspondingly, the electronic device obtains at least one action file of the robot, and then generates an action code file of the corresponding action based on each action file, wherein the action code file of the corresponding action is a code file for controlling the robot to perform the corresponding action.
[0079] It can be understood that there is a preset conversion relationship between the action file and the action code file of the corresponding action. After the action file is obtained, the action file can be converted into the action code file of the corresponding action according to the preset conversion relationship.
[0080] In an optional implementation, step S102 may include:
[0081] The action parameters in each action file are written into the preset code lines in the preset code file to generate the action code file.
[0082] Among them, the preset code file can be a code file that does not contain action parameters, the preset code lines in the preset code file can be non-delay code lines, and each action file includes action parameters. Therefore, by writing the action parameters in each action file into the preset code lines in the preset code file, an action code file can be generated, and the action code file includes preset code lines and delay code lines.
[0083] For example, the action parameters include the servo angles and servo rotation durations of 18 servos, wherein the servo rotation durations of the 18 servos are all 10 seconds, that is, the servo angles of the 18 servos are set every second. If the preset code file includes 20 code lines, wherein the delay code is located in the even-numbered code lines, then the servo angles and servo rotation durations (1 second) of the 18 servos at the 1st second can be written into the 1st line of code, and the 2nd line of code is the delay code, and the servo angles and servo rotation durations (1 second) of the 18 servos at the 2nd second can be written into the 3rd line of code, and the 4th line of code is the delay code, and so on. The servo angles and servo rotation durations (1 second) of the 18 servos at the 10th second can be written into the 19th line of code, and the 20th line of code is the delay code.
[0084] S103: Generate building blocks corresponding to corresponding actions according to preset building block display configuration parameters and action code files.
[0085] The preset building block display configuration parameters may include color parameters, shape parameters, size parameters, etc. of the building block.
[0086] The preset building block display configuration parameters are used to indicate the display layer performance of the building block corresponding to the corresponding action, and the action code file is used to indicate the underlying operating logic of the building block corresponding to the corresponding action, wherein the underlying operating logic of the building block is the logic for controlling the robot to perform the corresponding action. Therefore, the building block corresponding to the corresponding action can be generated according to the preset building block display configuration parameters and the action code file.
[0087] The method for generating building blocks of this embodiment obtains at least one action file of the robot, each action file includes action parameters for the robot to perform a corresponding action, generates an action code file for the corresponding action according to each action file, and generates a building block corresponding to the corresponding action according to preset building block display configuration parameters and action code files. New building blocks are generated through the action files of the robot, so that more building blocks can be expanded on the basis of existing building blocks, so that the robot can complete more complex operations, thereby increasing unlimited scalability for the robot.
[0088] Figure 3 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 2 ,like Figure 3 As shown, before step S101, the following steps may also be included:
[0089] S201. Configure action parameters of at least one action of the robot in an action editing interface.
[0090] S202: Generate at least one action file according to an action parameter of at least one action.
[0091] Among them, the electronic device provides an action editing interface, through which the user can configure the action parameters of at least one action of the robot. Each action can be a custom action, and the action parameters of each action may include servo parameters set at various parts of the robot, such as servo angle and servo rotation duration.
[0092] For example, if an action lasts for 10 seconds, then the servo rotation angles of the robot's 18 servos per second and the servo rotation duration are configured in the action editing interface. In the first second, the servo angles of the 18 servos are all configured to 10 degrees, and the servo rotation duration is 1 second. In the second second, the servo angles of the 18 servos are all configured to 20 degrees, and the servo rotation duration is 1 second. And so on. The action parameters of each action of the robot can be configured in the action editing interface.
[0093] The action editing interface may also be provided with a save control. In response to a click operation on the save control, at least one action file may be generated according to the action parameters of at least one action, wherein one action corresponds to one action file, and each action file includes the action parameters of the corresponding action.
[0094] In an optional implementation, after step S202, the method further includes:
[0095] Save at least one action file to a preset path.
[0096] Accordingly, obtaining at least one action file of the robot includes:
[0097] At least one action file is obtained by scanning files in a preset path.
[0098] Among them, the electronic programming software provides an action editing interface and a visual programming interface. After saving at least one action file to a preset path in the action editing interface, when switching to the visual programming interface, the files under the preset path are scanned to obtain at least one action file, and then an action code file of the corresponding action can be generated according to each action file. After that, the configuration parameters and the action code file are displayed according to the preset building blocks, and the building blocks corresponding to the corresponding actions are generated.
[0099] In an optional implementation, after generating a building block corresponding to a corresponding action according to preset building block display configuration parameters and action code files, the method further includes:
[0100] The building blocks corresponding to the corresponding actions are displayed in the visual programming interface.
[0101] After the building blocks corresponding to the corresponding actions are generated, the building blocks corresponding to the corresponding actions are displayed in the visual editing interface. That is to say, new building blocks are added through the robot action file, and the generated building blocks are dynamically added to the environment of the visual editing tool. The building blocks corresponding to the action files edited by the user can be automatically displayed in the visual programming interface. In this way, more building blocks can be expanded based on the original building blocks provided by the visual programming interface.
[0102] It can be understood that more building blocks are expanded on the basis of the original building blocks provided by the visual programming interface, so that the user can perform combination operations from the building blocks displayed in the visual programming interface, and then generate control codes based on the building block combinations according to preset code generation rules, and then send the control codes to the robot to control the robot to perform more and more complex operations.
[0103] The method for generating building blocks of this embodiment configures the action parameters of at least one action of the robot in the action editing interface, and generates at least one action file according to the action parameters of at least one action. By editing the robot action file to add new building blocks, the robot can complete more complex operations, thereby increasing the unlimited scalability of the robot.
[0104] Figure 4 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 3 ,like Figure 4 As shown, before step S103, the following steps may also be included:
[0105] S301. According to the input configuration operation, a building block definition file of a corresponding action is configured.
[0106] Accordingly, step S103 may include:
[0107] S302: Generate building blocks corresponding to corresponding actions according to the building block definition file and the action code file.
[0108] The user can input a configuration operation, and accordingly, the electronic device can configure a building block definition file of the corresponding action according to the input configuration operation, and the building block definition file includes display configuration parameters of the building block corresponding to the corresponding action, that is, the user can flexibly configure the display configuration parameters of the building block corresponding to the corresponding action according to actual needs, and save the display configuration parameters to obtain the building block definition file. Among them, the display configuration parameters may include: color parameters, shape parameters, size parameters, etc. of the building block.
[0109] For example, for different action types, the display configuration parameters of the corresponding building blocks may be different, that is, the display of the building blocks is also different. For example, if the action type of the corresponding action is action type 1, the color of the corresponding building block is red, and if the action type of the corresponding action is action type 2, the color of the corresponding building block is green. Then, when selecting building blocks for combination later, it is convenient for users to know the action types corresponding to different building blocks, and the user experience is higher.
[0110] Building blocks corresponding to corresponding actions are generated according to the configured building block definition files and action code files. In this way, the display of building blocks can be flexibly configured. When the building blocks corresponding to corresponding actions are generated, the building blocks corresponding to corresponding actions can also be displayed in the visual programming interface. The building blocks corresponding to corresponding actions displayed in the flexibly configured visual editing interface are easy to distinguish from the original building blocks in the visual editing interface, thereby improving the user experience.
[0111] The method for generating building blocks of this embodiment configures the building block definition file of the corresponding action according to the input configuration operation, and generates the building block corresponding to the corresponding action according to the building block definition file and the action code file. In this way, the display of the building blocks can be flexibly configured, which is convenient for distinguishing the building blocks.
[0112] Figure 5 The schematic diagram shows the process of the method for generating building blocks provided in the embodiment of the present application. Figure 4 ,like Figure 5 As shown, before displaying the building blocks corresponding to the corresponding actions in the visual programming interface, it also includes:
[0113] S401. Generate identification information of each action file according to the corresponding action.
[0114] Correspondingly, the building blocks corresponding to the corresponding actions are displayed in the visual programming interface, including:
[0115] S402: Displaying building blocks and identification information corresponding to corresponding actions in a visual programming interface.
[0116] The identification information of each action file may be used to indicate the logical function of the corresponding action corresponding to the action file, and the logical function may be, for example, squatting, reaching out, and the like.
[0117] When displaying the building blocks corresponding to the corresponding actions in the visual programming interface, the building blocks corresponding to the corresponding actions and the identification information can also be displayed together, wherein the identification information can be displayed in the visual programming interface within a preset range of the building blocks corresponding to the corresponding actions, or can be displayed in a blank space on the building blocks corresponding to the corresponding actions, so that it is convenient for users to know the identification information corresponding to different building blocks.
[0118] The identification information of each action file may be a Universally Unique Identifier (UUID).
[0119] The method for generating building blocks of this embodiment generates identification information of each action file according to the corresponding action, and displays the building blocks and identification information corresponding to the corresponding action in the visual programming interface. By displaying the identification information of the building blocks, it is convenient to select the combination building blocks based on the identification information of the building blocks, which improves efficiency and provides a high user experience.
[0120] Based on the same inventive concept, an embodiment of the present application also provides a device for generating building blocks corresponding to the method for generating building blocks. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the method for generating building blocks 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.
[0121] Figure 6 FIG. 1 is a schematic diagram showing the structure of a device for generating building blocks provided in an embodiment of the present application. The device for generating building blocks can be integrated in an electronic device. Figure 6 As shown, the building block generating device 50 includes:
[0122] An acquisition module 501 is used to acquire at least one action file of the robot, each action file including action parameters for the robot to perform a corresponding action;
[0123] A generating module 502, for generating an action code file of a corresponding action according to each action file;
[0124] The generation module 502 is further used to generate a building block corresponding to a corresponding action according to preset building block display configuration parameters and action code files.
[0125] In an optional embodiment, it also includes:
[0126] A configuration module 503, used to configure the action parameters of at least one action of the robot in the action editing interface;
[0127] The generating module 502 is further configured to generate at least one action file according to the action parameters of at least one action.
[0128] In an optional embodiment, it also includes:
[0129] A saving module 504, used to save at least one action file to a preset path;
[0130] The acquisition module 501 is specifically used for:
[0131] At least one action file is obtained by scanning files in a preset path.
[0132] In an optional implementation, the generating module 502 is specifically configured to:
[0133] The action parameters in each action file are written into the preset code lines in the preset code file to generate the action code file.
[0134] In an optional implementation, the configuration module 503 is further configured to:
[0135] According to the input configuration operation, a building block definition file of a corresponding action is configured, wherein the building block definition file includes display configuration parameters of the building block corresponding to the corresponding action;
[0136] The generating module 502 is specifically used for:
[0137] Generate building blocks corresponding to corresponding actions according to building block definition files and action code files.
[0138] In an optional embodiment, it also includes:
[0139] The display module 505 is used to display the building blocks corresponding to the corresponding actions in the visual programming interface.
[0140] In an optional implementation, the generating module 502 is further configured to:
[0141] Generate identification information of each action file according to the corresponding action;
[0142] The display module 505 is specifically used for:
[0143] The building blocks and identification information corresponding to the corresponding actions are displayed in the visual programming interface.
[0144] The implementation process and principle of the device for generating building blocks provided in this embodiment are similar to those of the method for generating building blocks provided in the above method embodiment, and will not be described in detail here.
[0145] Figure 7 The structure diagram of the electronic device provided by the embodiment of the present application is shown, and the electronic device may be, for example, a smart phone, a tablet computer, a laptop computer, etc. Figure 7 As shown, the electronic device 60 includes: a processor 601, a memory 602 and a bus 603. The memory 602 stores a computer program executable by the processor 601. When the electronic device 60 is running, the processor 601 communicates with the memory 602 through the bus 603, and the processor 601 executes the computer program to perform the above method embodiment.
[0146] The 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 above method embodiment is executed.
[0147] 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.
[0148] 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 invention is essentially or part of the technical solution that contributes to the prior art or 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 for 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 invention. 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.
[0149] 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 method for generating a building block, characterized in that: include: Acquire at least one action file of the robot, each action file including action parameters of the robot performing a corresponding action; According to each action file, generating an action code file of the corresponding action; Generate a building block corresponding to the corresponding action according to preset building block display configuration parameters and the action code file; After generating the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file, the method further includes: Displaying the building blocks corresponding to the corresponding actions in a visual programming interface, so as to perform a combination operation on the building blocks of the corresponding actions, obtain a combination of building blocks and generate a control code to control the robot to perform the corresponding operation; Before displaying the building blocks corresponding to the corresponding actions in the visual programming interface, the method further includes: According to the corresponding action, generating identification information of each action file, wherein the identification information of each action file is used to indicate the logical function of the corresponding action corresponding to each action file; The displaying of the building blocks corresponding to the corresponding actions in the visual programming interface includes: The building blocks corresponding to the corresponding actions and the identification information are displayed in the visual programming interface.
2. The method according to claim 1, characterized in that: Before obtaining at least one action file of the robot, the method further includes: Configuring action parameters of at least one action of the robot in an action editing interface; The at least one action file is generated according to the action parameters of the at least one action.
3. The method according to claim 2, characterized in that After generating the at least one action file according to the action parameters of the at least one action, the method further comprises: Saving the at least one action file to a preset path; Accordingly, the step of obtaining at least one action file of the robot includes: The at least one action file is acquired by scanning the files in the preset path.
4. The method according to claim 1, characterized in that: The step of generating the action code file of the corresponding action according to each action file comprises: The action parameters in each action file are written into a preset code line in a preset code file to generate the action code file.
5. The method according to claim 1, characterized in that Before generating the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file, the method further includes: According to the input configuration operation, configuring the building block definition file of the corresponding action, wherein the building block definition file includes display configuration parameters of the building block corresponding to the corresponding action; The generating of the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file includes: A building block corresponding to the corresponding action is generated according to the building block definition file and the action code file.
6. A device for generating building blocks, characterized in that: include: An acquisition module, used to acquire at least one action file of the robot, each action file including action parameters for the robot to perform a corresponding action; A generating module, used for generating an action code file of the corresponding action according to each action file; The generating module is further used to generate the building blocks corresponding to the corresponding actions according to the preset building block display configuration parameters and the action code file; A display module is used to display the building blocks corresponding to the corresponding actions in a visual programming interface, so as to perform a combination operation on the building blocks of the corresponding actions, obtain a combination of building blocks and generate a control code to control the robot to perform the corresponding operation; The generating module is further used to generate identification information of each action file according to the corresponding action, wherein the identification information of each action file is used to indicate the logical function of the corresponding action corresponding to each action file; The display module is specifically used to display the building blocks corresponding to the corresponding actions and the identification information in the visual programming interface.
7. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores a computer program executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the computer program to perform the method described in any one of claims 1 to 5.
8. 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 method according to any one of claims 1 to 5 is executed.
