Robot control method and apparatus, electronic device and readable storage medium
By using a pre-defined dictionary to decode robot task files and determine preceding instructions, the problem of poor robot programming extensibility is solved, achieving efficient programming and ease of use for complex operations.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- UBTECH ROBOTICS CORP LTD
- Filing Date
- 2024-12-30
- Publication Date
- 2026-05-21
AI Technical Summary
The poor extensibility of existing robot programming instructions leads to ineffective robot control.
The task file is decoded using a preset dictionary to generate a queue of instructions to be executed. The current instruction is then checked to see if there is a preceding instruction, and the instruction is executed according to the preset dictionary.
It improves the scalability and ease of use of robot control commands, enabling the programming of complex operations.
Smart Images

Figure CN2024143953_21052026_PF_FP_ABST
Abstract
Description
Robot control methods, devices, electronic equipment, and readable storage media
[0001] This application claims priority to Chinese Patent Application No. 202411639257.1, filed on November 15, 2024, entitled "Control Method, Apparatus, Electronic Device and Readable Storage Medium for Robot", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of robotics, and in particular to a robot control method, apparatus, electronic device, and readable storage medium. Background Technology
[0003] In existing technologies, robot programming instructions can be used to perform repetitive and complex operations. Currently, commercially available robotic arms come with robot programming instructions, but their scalability is relatively poor. There are currently no commercially available programming instructions specifically for robots, and existing programming instructions provide relatively poor control over robots. Technical issues
[0004] To address the aforementioned technical problems, embodiments of this application provide a robot control method, apparatus, electronic device, and readable storage medium. Technical solutions
[0005] In a first aspect, embodiments of this application provide a robot control method, the method comprising:
[0006] The task file is decoded according to a preset dictionary to obtain at least one instruction to be executed, and each instruction to be executed is stored in the instruction queue; each instruction to be executed includes a command name, command parameters and execution status.
[0007] Read the head instruction of the instruction queue to be executed as the current instruction;
[0008] Determine whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, then execute the current instruction according to the preset dictionary.
[0009] In one embodiment, the method further includes:
[0010] If the preceding instruction does not exist, the current instruction is executed according to the preset dictionary.
[0011] In one embodiment, the step of decoding the task file according to a preset dictionary includes:
[0012] The instruction code of the task file is parsed according to the dictionary structure of the preset dictionary to obtain the command name and command parameters corresponding to each line of instruction code;
[0013] The corresponding instruction to be executed is generated based on the command name and command parameters corresponding to each line of instruction code.
[0014] In one embodiment, the preset dictionary includes keywords and values, wherein the keywords of the preset dictionary are command names, and the values of the preset dictionary are function pointers corresponding to the command names;
[0015] The step of executing the current instruction according to the preset dictionary includes:
[0016] Search the preset dictionary for the target function pointer that matches the command name of the current instruction;
[0017] The corresponding target function is called according to the target function pointer, and the target function is executed according to the named parameters of the current instruction.
[0018] In one embodiment, the method further includes:
[0019] Set the preceding parameters, which are used to specify the instructions to be executed in the preceding order;
[0020] The step of determining whether the current instruction has a preceding instruction includes:
[0021] Determine whether the current instruction has a preceding instruction based on the preceding parameters;
[0022] If the current instruction conflicts with the instruction in the preceding parameters, then it is determined that the current instruction has a preceding instruction; or,
[0023] If, based on the control order of the task file, it is determined that the instruction in the preceding parameter needs to be executed before the current instruction, then it is determined that the current instruction has a preceding instruction.
[0024] In one embodiment, setting the preceding parameters includes:
[0025] Determine whether the current instruction conflicts with the previous instruction. If the current instruction conflicts with the previous instruction, store the command name of the current instruction in the preceding parameter; or,
[0026] According to the control order of the task file, the command name of at least one instruction to be executed is stored in the preceding parameters.
[0027] In one embodiment, the method further includes:
[0028] If the current instruction does not conflict with the instructions in the preceding parameters, and it is determined according to the control order of the task file that the instructions in the preceding parameters do not need to be executed before the current instruction, then it is determined that the current instruction has no preceding instructions.
[0029] Secondly, embodiments of this application provide a robot control device, the robot control device comprising:
[0030] The decoding module is used to decode the task file according to a preset dictionary to obtain at least one instruction to be executed, and to store each instruction to be executed into an instruction queue; each instruction to be executed includes a command name, command parameters and execution status.
[0031] The reading module is used to read the head instruction of the instruction queue to be executed as the current instruction;
[0032] A processing module is used to determine whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, the current instruction is executed according to the preset dictionary. Thirdly, embodiments of this application provide an electronic device, including a memory and a processor. The memory stores a computer program, which executes the robot control method provided in the first aspect when the processor is running.
[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a processor, executes the robot control method provided in the first aspect. Beneficial effects
[0034] The robot control method provided in this application decodes the task file according to a preset dictionary to obtain at least one instruction to be executed, and stores each instruction to be executed in an instruction queue. Each instruction to be executed includes a command name, command parameters, and execution status. The head instruction of the instruction queue is read as the current instruction. It is determined whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, the current instruction is executed according to the preset dictionary. In this way, decoding robot operation instructions through a preset dictionary is simple, highly scalable, and allows for programming of complex robot operations, reducing the barrier to robot operation and improving the usability of humanoid robots. Attached Figure Description
[0035] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation on the scope of protection of this application. In the various drawings, similar components are numbered similarly.
[0036] Figure 1 shows a flowchart of a robot control method provided in an embodiment of this application;
[0037] Figure 2 shows an example diagram of instructions provided in an embodiment of this application;
[0038] Figure 3 shows another schematic flowchart of the robot control method provided in an embodiment of this application;
[0039] Figure 4 shows another schematic flowchart of the robot control method provided in the embodiments of this application;
[0040] Figure 5 shows another schematic flowchart of the robot control method provided in the embodiments of this application;
[0041] Figure 6 shows a schematic diagram of the control device for a robot provided in an embodiment of this application.
[0042] Icons: 600: Robot control device, 601: Decoding module, 602: Reading module, 603: Processing module. Embodiments of the present invention
[0043] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0044] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0045] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0046] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0047] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0048] Example 1
[0049] This application provides a robot control method that can decode robot control commands to enable the robot to perform complex operations and improve the scalability of robot control commands.
[0050] In this embodiment, the robot can be a humanoid robot or other types of robots, without limitation. The method can provide a set of control commands to control the movement of the robot's controlled object, wherein the controlled object can be a movable part, which may include arm parts, leg parts, waist parts, and head parts, etc., without limitation.
[0051] Referring to Figure 1, the robot control method includes steps S101-S103, and each step is described below.
[0052] Step S101: Decode the task file according to the preset dictionary to obtain at least one instruction to be executed, and store each instruction to be executed in the instruction queue.
[0053] In this embodiment, for the robot's task files, each task file may include multiple control instructions, which are used to control the robot to perform corresponding complex operations. A corresponding preset dictionary can be generated using a dictionary data format from a preset database. The preset dictionary includes keywords, values, and a parameter list. The keywords of the preset dictionary are command names, the values are function pointers corresponding to the command names, and the parameter list consists of command parameters corresponding to the command names. The preset database can be a Python database or other databases; no limitation is made here.
[0054] It is understandable that the meaning of each instruction to be executed can be determined by the robot manufacturer or the robot programmer. Based on the dictionary structure of the Python database, the corresponding information is extracted from the string of the instruction to be executed. For example, for the following instruction: MOV_ARM q=[1,2,3,4,5], decoding the instruction using the dictionary structure of the Python database means extracting the command name MOV_ARM and the command parameters [1,2,3,4,5,6] from the string.
[0055] In this embodiment, the dictionary structure of the Python database is used for instruction decoding, which makes it easier to add new instructions, significantly improves the development speed of robot control operations, and makes the robot programming instructions more extensible.
[0056] In this embodiment, each of the instructions to be executed includes a command name, command parameters, and execution status. Exemplarily, each of the instructions to be executed can be a motion instruction for a movable component, such as an operation instruction for left arm movement, right arm movement, or leg joint movement, etc., without limitation.
[0057] Specifically, arm manipulation commands include the following types: MOV_ARM_J: Controls the joint space movement of the arm. The command parameter is the target joint position. For left arm movement, the command name can be set to LA; for right arm movement, the command name can be set to RA. MOV_DUAL_ARM_J: Simultaneously controls the movement of both arms in joint space. The command parameter includes the desired positions of the left and right arms. MOV_ARM_W: Controls the linear movement of the arm in Cartesian space. The command parameter is the pose vector (position and attitude). MOV_DUAL_ARM_W: Controls the linear movement of the arm in Cartesian space. The command parameter includes the desired pose vectors of the left and right arms. TELE_OP: Teleoperation command. Executing this command enters teleoperation mode, then retrieves joint movement commands from external sources. The command parameter can specify whether teleoperation is performed on the left arm, right arm, or both arms. OPERATE_GRIPPER: Used to control the movements of grippers or dexterous manipulators. START_FORCE_MODE_ARM: The arm end effector enters hybrid control mode. For example, some degrees of freedom are controlled by position, and others by force. The command parameters are the desired degrees of freedom (desired_wrench) and the degree-of-freedom mask (dof_mask). `desired_wrench` is a 6-element vector indicating the desired force or torque for each degree of freedom. `dof_mask` is also a 6-element vector, with each element being an integer value used to determine the control mode for the current degree of freedom; for example, 0 indicates position control, and 1 indicates force tracking. `END_FORCE_MODE_ARM` and `START_FORCE_MODE_ARM` are used together.
[0058] Leg movement commands include the following types: MOV_WAIST: Move the waist position; the command parameters are the desired waist position and posture. WALK_V: Walk at the desired speed; the command parameter is the walking speed, which includes the speed in the x, y, and yaw directions. WALK_Q: Walk to the desired position; the command parameters include the position in the x and y directions and the yaw angle.
[0059] Commands for modifying variables include the following types: CHANGE_ADMITTANCE_MBK: Modifies the mass, damping, and spring parameters in the arm's admittance control mode. SET_PAYLOAD_INFO: Sets the load mass during weighted walking; it can also set the position of the center of mass simultaneously. SET_ARM_TASK_CTRL_FRAME: Sets the arm's task space coordinate system, i.e., the coordinate system in which the task is performed.
[0060] Other flow control instructions include the following: WAIT: Stops the execution queue for a given time. EXE_MULT_LINES: Executes only one instruction at a time by default, until completion. This instruction can execute multiple instructions at once, with the command parameter specifying the number of subsequent instructions to execute simultaneously. For example, performing arm movements while squatting.
[0061] It should be noted that arm operation commands, leg operation commands, variable modification commands, and other process control commands can also include other commands, without limitation. Complex command control of the robot can be achieved by combining arm operation commands, leg operation commands, variable modification commands, and other process control commands. Complex command control can be generated according to actual needs.
[0062] It is understandable that for the instruction to be executed, a line of instruction is a string of characters, such as MOV_ARM q = [1,2,3,4,5]. Decoding the instruction to be executed means extracting the command name MOV_ARM and the command parameters [1,2,3,4,5,6] from the string. The corresponding robot action is to move the arm to the position [1,2,3,4,5,6].
[0063] As an example, Figure 2 shows a command example for heavy object handling using a combination of the aforementioned related instructions. Instruction 1 adjusts the waist position, instruction 2 changes the joint movement speed, instructions 3-6 adjust the position of both arms near the box, instruction 7 performs simultaneous operation of both arms, instructions 8-11 set the control mode of both arms, and instructions 12-15 mainly involve squatting down to pick up the box and moving the waist upward to adjust the posture. In this way, the entire handling process of the robot can be represented with a relatively small number of lines of code.
[0064] Referring to Figure 3, step S101 includes:
[0065] Step S1011: Parse the instruction code of the task file according to the dictionary structure of the preset dictionary to obtain the command name and command parameters corresponding to each line of instruction code;
[0066] Step S1012: Generate the corresponding instruction to be executed based on the command name and command parameters corresponding to each line of instruction code.
[0067] As an example, in each line of instruction code, the first word is defined as the command name, followed by the command parameters. That is, the named parameters are the parameter list corresponding to the command name. The parameter list corresponds to the data structure of the default dictionary in the Python database. The parameter list can be parsed directly using the data format of Python's default dictionary, thereby generating the instruction to be executed for each line of code.
[0068] Step S102: Read the head instruction of the instruction queue to be executed as the current instruction.
[0069] Referring to Figure 4, the decoding thread can operate as a separate thread, while the instruction execution flow serves as the robot control thread. The decoding and robot control threads do not interfere with each other, and related data is stored in a shared queue. The decoding thread includes: reading the task file containing instructions, decoding each line of instruction code, obtaining the decoded instructions to be executed, and storing these instructions in the instruction queue. The robot control thread includes: checking if the instruction queue is empty; if not, reading the header instruction as the current instruction. Each time the robot control thread executes an instruction, it adds it to the current instruction queue and performs a status check.
[0070] Additionally, the shared queue is accessible to both the decoding thread and the robot control thread. Both the current instruction queue and the pending instruction queue are shared queues. The pending instruction queue contains the command name, command parameters, and execution status of instructions that have not yet been executed. The current instruction queue contains the command name, command parameters, and execution status of all instructions currently being executed.
[0071] Step S103: Determine whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, then execute the current instruction according to the preset dictionary.
[0072] In this embodiment, the preceding parameter is used to specify the preceding instruction, which needs to be executed before the current instruction. That is, if preceding is not empty, the current instruction can only be executed after the instructions in preceding have been executed.
[0073] In one embodiment, the method further includes setting a preceding parameter, which specifies the instruction to be executed in the preceding order. For example, if the current instruction is to control a waist operation, and the previous instruction is also a waist operation, then the command name of the waist operation can be placed in the preceding parameter. In this case, the current waist operation can only be entered after the previous instruction (i.e., the previous waist operation) has been completed, thus avoiding operational conflicts of the same movable part.
[0074] In one embodiment, setting the preceding parameters includes:
[0075] Determine whether the current instruction conflicts with the previous instruction. If the current instruction conflicts with the previous instruction, store the command name of the current instruction in the preceding parameter; or,
[0076] According to the control order of the task file, the command name of at least one instruction to be executed is stored in the preceding parameters.
[0077] For example, if the current command controls the left arm, and the previous command also controls the left arm, the command name for the current left arm operation can be placed in the `precedent` parameter. The current command will then wait for the previous command (i.e., the previous arm operation) to complete, thus avoiding operational conflicts involving the same movable part. Furthermore, it can also be used for sequential control. For instance, the command name for the right arm can be placed in the `precedent` parameter, so the current command will only be executed after the right arm has finished moving.
[0078] In this embodiment, the method further includes: if the preceding instruction does not exist, then executing the current instruction according to the preset dictionary. For example, if `precedent` is empty, the current instruction does not have a preceding instruction, and the current instruction can be executed directly in the current control cycle, improving the robot's control efficiency.
[0079] Please refer to Figure 4 again. The robot control thread also includes: if there is a preceding instruction, determining whether the preceding instruction has been completed. If the preceding instruction has been completed, executing the current instruction. If the preceding instruction has not been completed, storing the current instruction in the current instruction queue, waiting for the next control cycle, and executing the current instruction in the next control cycle.
[0080] In this embodiment, a dictionary can be used, where the keys are command names and the values are function pointers. During program initialization, a preset dictionary can be initialized. This preset dictionary maps the supported command names to function names; that is, each command name corresponds to a function pointer, which is used to call the corresponding function. The command parameters are input into the called function to execute the corresponding instructions.
[0081] In one embodiment, the step S103 of determining whether the current instruction has a preceding instruction includes:
[0082] Determine whether the current instruction has a preceding instruction based on the preceding parameters;
[0083] If the current instruction conflicts with the instruction in the preceding parameters, then it is determined that the current instruction has a preceding instruction; or,
[0084] If, based on the control order of the task file, it is determined that the instruction in the preceding parameter needs to be executed before the current instruction, then it is determined that the current instruction has a preceding instruction.
[0085] For example, if the current instruction controls the left foot, and the `precedent` parameter includes a left foot operation, then there is a conflict between the current instruction and the instruction in the `precedent` parameter. Therefore, it is determined that the left foot operation has a preceding instruction, and that the preceding instruction is the previous left foot operation. For instance, if the `precedent` parameter includes the name of the instruction for right arm movement, and the control order in the task file is: right arm movement precedes left arm movement, and the current instruction is left arm movement, since the `precedent` parameter includes the name of the instruction for right arm movement, it is determined that the preceding instruction for left arm movement is right arm movement.
[0086] In one embodiment, the method further includes:
[0087] If the current instruction does not conflict with the instructions in the preceding parameters, and it is determined according to the control order of the task file that the instructions in the preceding parameters do not need to be executed before the current instruction, then it is determined that the current instruction has no preceding instructions.
[0088] Referring to Figure 5, step S103, which involves executing the current instruction according to the preset dictionary, includes:
[0089] Step S1031: Search the preset dictionary for a target function pointer that matches the command name of the current instruction;
[0090] Step S1032: Call the corresponding target function according to the target function pointer, and execute the target function according to the naming parameters of the current instruction.
[0091] It is understandable that the preset dictionary includes keywords, values, and a parameter list. The keywords are command names, and the values are function pointers. The command name for the current instruction can be found in the preset dictionary. Based on the found command name, the corresponding target function pointer can be matched. The target function pointer is used to indicate the storage location of the function corresponding to the found command name. The target function pointer can call the target function from the corresponding storage location, substitute the named parameters of the current instruction into the target function, run the target function, and thus execute the current instruction to control the robot to perform related operations.
[0092] The robot control method provided in this embodiment decodes the task file according to a preset dictionary to obtain at least one instruction to be executed, and stores each instruction to be executed in an instruction queue. Each instruction to be executed includes a command name, command parameters, and execution status. The head instruction of the instruction queue is read as the current instruction. It is determined whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, the current instruction is executed according to the preset dictionary. In this way, decoding robot operation instructions through a preset dictionary is simple, highly scalable, and allows for programming of complex robot operations, reducing the barrier to robot operation and improving the usability of humanoid robots.
[0093] Example 2
[0094] Furthermore, embodiments of this application provide a robot control device.
[0095] As shown in Figure 6, the robot's control device 600 includes:
[0096] The decoding module 601 is used to decode the task file according to a preset dictionary to obtain at least one instruction to be executed, and to store each instruction to be executed into an instruction queue; each instruction to be executed includes a command name, command parameters and execution status.
[0097] The reading module 602 is used to read the head instruction of the instruction queue to be executed as the current instruction;
[0098] The processing module 603 is used to determine whether the current instruction has a preceding instruction. If the preceding instruction exists and the preceding instruction has been executed, the current instruction is executed according to the preset dictionary.
[0099] In one embodiment, the processing module 603 is configured to execute the current instruction according to the preset dictionary if the preceding instruction does not exist.
[0100] In one embodiment, the decoding module 601 is used to parse the instruction code of the task file according to the dictionary structure of the preset dictionary to obtain the command name and command parameters corresponding to each line of instruction code;
[0101] The corresponding instruction to be executed is generated based on the command name and command parameters corresponding to each line of instruction code.
[0102] In one embodiment, the preset dictionary includes keywords and values, wherein the keywords of the preset dictionary are command names, and the values of the preset dictionary are function pointers corresponding to the command names; the processing module 603 is used to search for a target function pointer that matches the command name of the current instruction from the preset dictionary;
[0103] The corresponding target function is called according to the target function pointer, and the target function is executed according to the named parameters of the current instruction.
[0104] In one embodiment, the robot's control device 600 further includes:
[0105] The configuration module is used to set the preceding parameters, which specify the instructions to be executed in the preceding sequence.
[0106] Processing module 603 is used to determine whether the current instruction has a preceding instruction based on the preceding parameters;
[0107] If the current instruction conflicts with the instruction in the preceding parameters, then it is determined that the current instruction has a preceding instruction; or,
[0108] If, based on the control order of the task file, it is determined that the instruction in the preceding parameter needs to be executed before the current instruction, then it is determined that the current instruction has a preceding instruction.
[0109] In one embodiment, a setting module is used to determine whether the current instruction conflicts with the previous instruction. If the current instruction conflicts with the previous instruction, the command name of the current instruction is stored in the preceding parameter; or,
[0110] According to the control order of the task file, the command name of at least one instruction to be executed is stored in the preceding parameters.
[0111] In one embodiment, the processing module 603 is configured to determine that the current instruction has no preceding instruction if the current instruction does not conflict with the instructions in the preceding parameters and the instructions in the preceding parameters do not need to be executed before the current instruction according to the control order of the task file.
[0112] The robot control device 600 provided in this embodiment can implement the robot control method provided in Embodiment 1. To avoid repetition, it will not be described again here.
[0113] The robot control device provided in this embodiment decodes the task file according to a preset dictionary to obtain at least one instruction to be executed, and stores each instruction in an instruction queue. Each instruction includes a command name, command parameters, and execution status. The head instruction of the instruction queue is read as the current instruction. It is determined whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, the current instruction is executed according to the preset dictionary. In this way, decoding robot operation instructions using a preset dictionary is simple, highly scalable, and allows for programming of complex robot operations, lowering the barrier to robot operation and improving the usability of humanoid robots.
[0114] Example 3
[0115] Furthermore, this application provides an electronic device including a memory and a processor. The memory stores a computer program, which executes the robot control method provided in Embodiment 1 when running on the processor.
[0116] The electronic device provided in this embodiment can implement the robot control method provided in Embodiment 1. To avoid repetition, it will not be described again here.
[0117] Example 4
[0118] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the robot control method provided in Embodiment 1.
[0119] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0120] The computer-readable storage medium provided in this embodiment can implement the robot control method provided in Embodiment 1. To avoid repetition, it will not be described again here.
[0121] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0123] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A control method of a robot characterized by, The method includes: The task file is decoded according to a preset dictionary to obtain at least one instruction to be executed, and each instruction to be executed is stored in the instruction queue; each instruction to be executed includes a command name, command parameters and execution status. Read the head instruction of the instruction queue to be executed as the current instruction; Determine whether the current instruction has a preceding instruction. If the preceding instruction exists and has been executed, then execute the current instruction according to the preset dictionary.
2. The method of claim 1, wherein, The method further includes: If the preceding instruction does not exist, the current instruction is executed according to the preset dictionary.
3. The method of claim 1, wherein, The step of decoding the task file according to a preset dictionary includes: The instruction code of the task file is parsed according to the dictionary structure of the preset dictionary to obtain the command name and command parameters corresponding to each line of instruction code; The corresponding instruction to be executed is generated based on the command name and command parameters corresponding to each line of instruction code.
4. The method according to claim 1 or 2, characterized in that, The preset dictionary includes keywords and values. The keywords of the preset dictionary are command names, and the values are function pointers corresponding to the command names. The step of executing the current instruction according to the preset dictionary includes: Search the preset dictionary for the target function pointer that matches the command name of the current instruction; The corresponding target function is called according to the target function pointer, and the target function is executed according to the named parameters of the current instruction.
5. The method of claim 1, wherein, The method further includes: Set the preceding parameters, which are used to specify the instructions to be executed in the preceding order; The step of determining whether the current instruction has a preceding instruction includes: Determine whether the current instruction has a preceding instruction based on the preceding parameters; If the current instruction conflicts with the instruction in the preceding parameters, then it is determined that the current instruction has a preceding instruction; or, If, based on the control order of the task file, it is determined that the instruction in the preceding parameter needs to be executed before the current instruction, then it is determined that the current instruction has a preceding instruction.
6. The method of claim 5, wherein, The setting of preceding parameters includes: Determine whether the current instruction conflicts with the previous instruction. If the current instruction conflicts with the previous instruction, store the command name of the current instruction in the preceding parameter; or, According to the control order of the task file, the command name of at least one instruction to be executed is stored in the preceding parameters.
7. The method of claim 5, wherein, The method further includes: If the current instruction does not conflict with the instructions in the preceding parameters, and it is determined according to the control order of the task file that the instructions in the preceding parameters do not need to be executed before the current instruction, then it is determined that the current instruction has no preceding instructions.
8. A control device of a robot characterized by comprising: The device includes: The decoding module is used to decode the task file according to a preset dictionary to obtain at least one instruction to be executed, and to store each instruction to be executed into an instruction queue; each instruction to be executed includes a command name, command parameters and execution status. The reading module is used to read the head instruction of the instruction queue to be executed as the current instruction; A processing module is configured to determine whether the current instruction has a preceding instruction, and if the preceding instruction exists and is executed, execute the current instruction according to the preset dictionary.
9. A robot, characterized in that The robot comprises a memory and a processor, the memory stores a computer program, and the computer program executes the control method of the robot in any one of claims 1 to 7 when running on the processor.
10. A computer-readable storage medium, characterized in that, The computer program is stored in the memory and executed on the processor to execute the control method of the robot in any one of claims 1 to 7.