Robot control method and device, robot, storage medium and program product
By using the command buffer for temporary storage and forward processing in the robot combined with TCP commands in API and JSON data format, the problem of low efficiency of traditional remote communication control is solved and efficient remote communication control is achieved.
Patent Information
- Application Number
- CN202310466301.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-04-26
AI Technical Summary
Traditional remote communication control technology has low control efficiency and the Modbus protocol has slow communication speed when exchanging large amounts of data, resulting in a complex remote communication control process, difficult debugging, and a long development cycle.
The method of temporarily storing client commands in the command buffer and performing forward processing is adopted, combined with API and TCP commands in JSON data format to achieve efficient communication between the robot and the client.
It improves the efficiency of robot remote communication control, simplifies the control process, reduces the need for data combination, and improves the accuracy and efficiency of control.
Smart Images

Figure CN116442230B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robot control technology, and in particular to a robot control method and device, a robot, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of robot control technology, robot remote communication control technology has also been widely used. Traditional remote communication control technology has the disadvantage of low control efficiency. Summary of the Invention
[0003] Based on this, it is necessary to provide a robot control method and device, a robot, a computer-readable storage medium and a computer program product that can improve the efficiency of robot remote communication control in order to address the above technical problems.
[0004] In a first aspect, the present application provides a robot control method. The robot control method includes:
[0005] receiving a first target instruction sent by a client;
[0006] If the number of instructions stored in the instruction buffer does not reach a preset first threshold, receiving an instruction push request from the client in a preset communication mode;
[0007] In response to the push instruction request, the first target instruction is pushed into the instruction buffer in sequence, and the first target instruction in the instruction buffer is forward processed in sequence;
[0008] If the number of the first target instructions after the forward processing reaches a preset second threshold, receiving a motion start request submitted by the client in a communication manner;
[0009] In response to the motion start request, the target motion is executed sequentially according to the first target instruction after the look-ahead processing.
[0010] In one embodiment, the communication method includes calling an API and / or sending TCP instructions in JSON data format.
[0011] In one embodiment, the robot control method further includes:
[0012] Receive a query instruction sent by a client, where the query instruction is used to query whether the number of instructions stored in the instruction buffer reaches a first threshold;
[0013] In response to the query instruction, sending the query result;
[0014] If the number of instructions stored in the instruction buffer does not reach a preset first threshold, receiving a push instruction request from the client in a preset communication mode, including:
[0015] If the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, a push instruction request proposed by the client in a communication manner is received.
[0016] In one embodiment, sequentially pushing the first target instruction into the instruction buffer includes:
[0017] sequentially pushing some of the first target instructions into the instruction buffer;
[0018] After sequentially pushing some of the first target instructions into the instruction buffer, the method further includes:
[0019] Receive the query instruction sent by the client again, and send the query result in response to the query instruction. If the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, then push some of the first target instructions into the instruction buffer in sequence until a query result indicating that the number of instructions stored in the instruction buffer reaches the first threshold is sent in response to the query instruction or all the first target instructions have been pushed into the instruction buffer.
[0020] In one embodiment, the query instruction includes a query password; in response to the query instruction, the query result is sent, including:
[0021] Verify the query password according to the preset command password;
[0022] If the query password is successfully verified, the query result is sent in response to the query instruction.
[0023] In one embodiment, the robot control method further includes:
[0024] receiving a second target instruction sent by the client;
[0025] If the number of instructions stored in the instruction buffer does not reach the first threshold, the second target instructions are pushed into the instruction buffer in sequence, and the second target instructions in the instruction buffer are forward-processed in sequence. If the number of second target instructions after the forward-processing reaches the second threshold, the target movement is executed in sequence according to the second target instructions after the forward-processing until the execution of the target movement is completed.
[0026] In a second aspect, the present application further provides a robot control device. The robot control device includes:
[0027] An instruction receiving module, configured to receive a first target instruction sent by a client;
[0028] a first request receiving module configured to receive a push instruction request from a client in a preset communication mode if the number of instructions stored in the instruction buffer does not reach a preset first threshold;
[0029] an instruction push module, configured to push the first target instruction into the instruction buffer in response to an instruction push request, and perform forward processing on the first target instruction in the instruction buffer in turn;
[0030] A second request receiving module is configured to receive a motion start request from the client in a communication manner if the number of the first target instructions after the forward processing reaches a preset second threshold;
[0031] The motion execution module is used to respond to the motion start request and execute the target motion in sequence according to the first target instruction after the forward processing.
[0032] In a third aspect, the present application also provides a robot comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0033] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0034] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements the steps of the above method when executed by a processor.
[0035] In the above-described robot control method and apparatus, robot, computer-readable storage medium, and computer program product, the robot receives a first target instruction sent by a client. If the number of instructions stored in the robot's instruction buffer does not reach a preset first threshold, the robot receives a command push request from the client via a preset communication method. Subsequently, in response to the client's real-time command push request, the robot sequentially pushes the first target instructions into the instruction buffer, temporarily and orderly stores the first target instructions in the instruction buffer, and sequentially performs forward processing on the first target instructions in the instruction buffer. Furthermore, if the number of first target instructions after forward processing reaches a preset second threshold, the robot receives a motion start request from the client via communication method. Subsequently, in response to the client's real-time motion start request, the robot sequentially executes the target motion according to the first target instructions after forward processing. The remote communication control process using the above-described robot control method does not require a complex instruction system, nor does the robot and the client need to combine instruction data. Based on the temporary and orderly storage of the client's first target instruction and the client's real-time request in the instruction buffer, the robot can respond to the client's request in real time and efficiently control and execute the target motion according to the client's first target instruction, thereby improving control efficiency and simplifying the remote communication control process. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 FIG1 is a flow chart of a robot control method according to an embodiment;
[0037] Figure 2 This is a second flow chart of a robot control method according to an embodiment;
[0038] Figure 3 This is a third flow chart of a robot control method according to an embodiment;
[0039] Figure 4 A schematic diagram of a process for sending query results in response to a query instruction in one embodiment;
[0040] Figure 5 FIG4 is a fourth flow chart of a robot control method according to an embodiment;
[0041] Figure 6 FIG5 is a fifth flow chart of a robot control method according to an embodiment;
[0042] Figure 7 is a structural block diagram of a robot control device in one embodiment;
[0043] Figure 8 1 is a diagram of the internal structure of a robot in one embodiment.
[0044] Description of Figure Numbers:
[0045] Robot control device: 10; receiving module: 11; first request receiving module: 12; instruction pressing module: 13; second request receiving module: 14; motion execution module: 15. DETAILED DESCRIPTION
[0046] To facilitate understanding of the embodiments of the present application, a more comprehensive description of the embodiments of the present application will be provided below with reference to the accompanying drawings. The accompanying drawings provide preferred embodiments of the embodiments of the present application. However, the embodiments of the present application can be implemented in many different forms and are not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive disclosure of the embodiments of the present application.
[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art in the art of the present application. The terms used herein in the description of the embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the embodiments of the present application.
[0048] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various target instructions, but these target instructions are not limited by these terms. For example, without departing from the scope of this application, the first target instruction may be referred to as the second target instruction, and similarly, the second target instruction may be referred to as the first target instruction. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features.
[0049] As used herein, the singular forms "a," "an," and "the" may also include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "includes" specifies the presence of the stated features, integers, steps, operations, parts, or combinations thereof, but does not preclude the presence or addition of one or more other features, integers, steps, operations, parts, or combinations thereof. Furthermore, the term "and / or" as used in this specification includes any and all combinations of the relevant listed items.
[0050] With the development of science and technology, industrial robots have been widely used and have gradually become a core productivity tool. In the promotion and application of industrial robots, industrial robots often become a unit module of a workstation. In addition to independently running and completing specified actions according to the user's teaching program, they generally need to be able to receive instructions from the main control device, operate according to the main control device's schedule, and exchange data and interact with other peripheral devices. This constitutes an intelligent processing and production unit, also known as a robotic workstation. Multiple robotic workstations can also be quickly interconnected through communication, forming a networked, automated, and intelligent smart manufacturing production line.
[0051] Currently, the most widely used remote communication control method for industrial robots generally utilizes the Modbus protocol, a serial communication protocol with a master-slave architecture. The Modbus protocol was developed by Modicon (now Schneider Electric) in 1979 for communication with programmable logic controllers (PLCs). The Modbus protocol has become the de facto industry standard for communication protocols and is now a common connection method between industrial electronic equipment. Modbus protocols include versions for serial ports, Ethernet, and other Internet protocols. The Modbus protocol boasts a simple structure, streamlined operation, and ease of use. However, the Modbus protocol transmits commands and data based on register addresses, which can lead to slow communication speeds when large amounts of data need to be exchanged. In intelligent manufacturing production lines, industrial robots require remote communication with master control devices or external equipment, requiring a wide variety of commands and large amounts of data. In such an application scenario, the use of the Modbus protocol requires the definition of a complex instruction system, and complex data needs to be divided into multiple registers for storage and transmission. The data receiver also needs to reassemble and process the data, resulting in low remote communication control efficiency, a complex remote communication control process, difficult debugging, and a long development cycle.
[0052] To improve the efficiency of remote communication control of industrial robots, the present invention provides a robot control method. The robot controller acts as a communication control server, while the communication counterparts, such as a master control device and external devices, act as communication control clients. The robot controller receives commands from the client, such as query commands, modification commands, and dynamic commands, and controls the robot to execute the corresponding commands.
[0053] Specifically, if Figure 1 As shown, the robot control method provided in the embodiment of the present application is applied to a robot controller, that is, applied to a robot, and includes the following steps 110 to 150.
[0054] Step 110: Receive a first target command sent by the client. The first target command is a dynamic command that causes the robot to execute a target motion. The robot, acting as the communication server, receives the connection command from the client and configures parameters on the robot's configuration page to establish a connection between the robot and the client. Only after the connection is established can the robot receive the first target command from the client. In this embodiment, after receiving the first target command, the robot's decoding module can further process the first target command to obtain a decoded first target command.
[0055] Step 120: If the number of instructions stored in the instruction buffer does not reach a preset first threshold, a push instruction request is received from the client via a preset communication method. The instruction buffer is an area in the robot used to temporarily and orderly store instructions, and the push instruction request refers to a request to push the first target instruction into the instruction buffer. Specifically, if the number of instructions in the instruction buffer does not reach the first threshold, it indicates that there is still available storage space in the instruction buffer, and further instructions are allowed to be stored. At this time, the client submits a push instruction request in real time via a specific communication method, and the robot receives the push instruction request accordingly. It should be understood that when the robot decodes the first target instruction, the first target instruction pushed into the instruction buffer should be the decoded first target instruction.
[0056] Step 130, in response to the push command request, pushes the first target command into the command buffer in sequence, and performs forward processing on the first target commands in the command buffer in sequence. Forward processing refers to analyzing and processing the target motion trajectory before controlling the robot to execute the target motion, in order to plan the speed along the target motion path and achieve a smooth speed transition while maximizing the speed. Performing forward processing on the first target command helps ensure accurate execution of the target motion while reducing impact and wear on the robot and its components. Specifically, in response to the client's push command request, the robot pushes the first target command into the command buffer in real time and in sequence for temporary storage, preparing to execute the target action according to the first target command. Therefore, in this embodiment, the robot only needs to store the first target command in real time according to the client's request, without pre-storing a complex command system. Simultaneously, the robot performs forward processing on the pushed first target commands in sequence. It is understandable that the first target commands sent by the client are a plurality of consecutive commands, with a sequence between the plurality of first target commands, and the sequence between the first target commands sent by the client corresponds to the robot's target motion path. Therefore, in this embodiment, the robot only needs to push the first target instruction in sequence and perform forward processing on the first target instruction pushed into the instruction buffer in sequence to obtain the robot's target motion path, and can effectively plan the speed on the target motion path, avoiding the need to combine data for the first target instruction, making the control process simpler and the control efficiency higher.
[0057] Step 140: If the number of first target instructions after forward processing reaches a preset second threshold, a motion start request submitted by the client via a communication method is received. A motion start request refers to a request to initiate a target motion according to the first target instruction. Specifically, ensuring that the number of first target instructions after forward processing reaches the second threshold facilitates more accurate acquisition of the target motion path, more accurate speed planning, and thus more accurate and efficient execution of the target motion. If the number of first target instructions after forward processing reaches the second threshold, the client submits a motion start request in real time via a specific communication method, and the robot accordingly receives the motion start request.
[0058] Step 150: In response to the motion start request, the robot sequentially executes the target motion according to the first target instructions after forward processing. Specifically, the first target instructions in the instruction buffer do not directly generate the target motion. In response to the client's motion start request, the robot pushes the first target instructions in the instruction buffer after forward processing to the motion control module in real time and sequentially, thereby efficiently controlling and executing the target motion according to the first target instructions.
[0059] Furthermore, the client can send a request to the robot to query whether the target motion has been completed. After the robot receives the corresponding query request, when the control execution of the target motion is completed, it sends the result of the completion of the target motion to the client in response to this query request to inform the client that the target motion has been controlled and executed.
[0060] In this embodiment, the remote communication control process does not require a complex instruction system, and the robot and the client do not need to combine the instruction data. Based on the temporary and orderly storage of the client's first target instruction and the client's real-time request in the instruction buffer, the robot can respond to the client's request in real time and efficiently control the execution of target movement in sequence according to the client's first target instruction, which is conducive to improving control efficiency and making the remote communication control process simpler.
[0061] In one embodiment, the communication method includes calling an API and / or sending TCP instructions in JSON data format. An API refers to an application programming interface (API), which is a set of definitions, procedures, and protocols that enable communication between computer software and other software. Specifically, in this embodiment, a client can establish communication with the robot by calling the robot's API, efficiently and quickly invoking the functions corresponding to the API in the robot. JavaScript Object Notation (JSON) is a lightweight data exchange format. The JSON data format features a concise and clear hierarchical structure, making it easy for humans to read and write, as well as for machines to parse and generate, effectively improving network transmission efficiency. Objects and arrays are basic types in JSON. Content enclosed in curly braces "{}" is called an object, and subobjects within an object are separated by commas, for example, {subobject 1, subobject 2, subobject 3, ...}. Object types can be strings, numbers, Boolean types, key-value pairs, etc. Content enclosed in square brackets "[]" is called an array, and objects within an array are separated by commas, "." The Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based communication protocol that provides reliable communication services. The client and robot use the JSON data format as the basis for TCP communication, which ensures reliable communication services while improving remote communication control efficiency.
[0062] Specifically, the client communicates remotely with the robot by calling an API and / or sending TCP commands in JSON data format to achieve remote control of the robot's target motion. For example, the client can request the robot to push a command by calling the robot's API corresponding to the push command function or sending a TCP command corresponding to the push command function to the robot in the form of a string. The client can also request the robot to start a motion by calling the robot's API corresponding to the start motion function or sending a TCP command corresponding to the start motion function to the robot in the form of a string. If the number of commands stored in the command buffer reaches a first threshold, the client can request the robot to end the push command by calling the robot's API corresponding to the end push command function or sending a TCP command corresponding to the end push command function to the robot in the form of a string. If the client wishes to obtain the number of commands in the command buffer, it can request the robot to obtain the number of commands by calling the robot's API corresponding to the get command number function or sending a TCP command corresponding to the get command number function to the robot in the form of a string. In other words, the client can achieve remote communication control through the above two methods based on its own request and the robot's functions. This embodiment does not exhaustively list all communication content.
[0063] Furthermore, in addition to implementing remote communication control of the robot's target motion by calling an API and / or sending TCP commands in JSON data format, the client also implements remote communication control of the robot's basic functions by sending TCP commands in JSON data format, such as querying, enabling and disabling servos, launching designated teaching program files, querying and modifying parameters and variables, and so on. For example, the client sends a first target command to the robot in the form of a string, so that the robot receives the first target command. Correspondingly, the robot also responds to the corresponding commands sent by the client based on the physical layer and protocol layer of standard TCP network communication, using the JSON data format as the basic format of the communication application layer protocol. For example, in response to a request from the client to obtain the number of commands, the robot sends the number of commands stored in the command buffer to the client in the form of a string. It can be understood that during the entire process of remotely controlling the robot's target motion, there is also a process in which the client remotely controls the robot to perform basic functions, and a process in which the robot responds to commands sent by the client according to the agreed application layer protocol format.
[0064] The robot's communication application layer protocol, which uses JSON data as its primary format, supports keywords such as token (indicating a send / verify password), date (indicating a timestamp), from (indicating the sender's name), to (indicating the recipient's name), get (indicating data query), and put (indicating data modification). Specifically, when a client sends commands such as get, put, or post, it must send a valid token. The robot must verify the token before executing the client's get, put, or post commands. The date format is ISO date, with the minimum unit being milliseconds. For example, when the robot is the sender, the sender name is the robot controller name, which is specified in the system parameters, and the recipient name is the client name, which is specified in the communication parameters. When the robot is the sender, the message sent must include the corresponding date, from, and to information; when the client is the sender, the message sent may optionally include the corresponding date, from, and to information. The client uses the get command to query the main parameters and variables in the robot system. When querying the main parameters and variables, the "key" format is: group(groupIndex).paramName(paramSubId), where groupIndex and paramSubId can be omitted. In addition, to improve the efficiency of client data transmission and robot data parsing, the "key" can be used: SameAsLastTime to automatically obtain the most recent get settings, that is, to obtain the main parameters or variables of the most recent query and the corresponding query results. The client uses the put command to modify the main parameters and variables in the robot. When modifying the main parameters and variables, the "key" format is: group(groupIndex).paramName(paramSubId), where groupIndex and paramSubId can also be omitted.
[0065] In this embodiment, the client can efficiently and quickly invoke the robot's API-specific functions by calling the API and / or sending TCP commands in JSON data format. This improves remote communication control efficiency while ensuring reliable communication services, thereby enabling remote communication control of the robot's target motion. Furthermore, the client can also implement remote communication control of the robot's basic functions by sending TCP commands in JSON data format.
[0066] like Figure 2As shown, in one embodiment, the robot control method includes the following steps 210 to 270. Among them, steps 210 and steps 250 to 270 correspond to steps 110 and steps 130 to 150 in the aforementioned embodiment, respectively. Steps 210 and steps 250 to 270 of this embodiment can be referred to the discussion of the aforementioned embodiment, and will not be repeated here.
[0067] Step 210: Receive a first target instruction sent by the client. Specifically, the client can send the first target instruction to the robot in the form of a character string, and the robot receives the first target instruction accordingly.
[0068] Step 220 receives a query command sent by the client. The query command is used to query whether the number of commands stored in the command buffer has reached a first threshold. Specifically, the client can send the query command in JSON data format to the robot to query whether the number of commands stored in the robot's command buffer has reached the first threshold, thereby determining whether the first target command can be pushed into the command buffer.
[0069] Step 230: Send a query result in response to the query instruction, wherein the query result includes whether the number of instructions stored in the instruction buffer does not reach the first threshold and whether the number of instructions stored in the instruction buffer reaches the first threshold.
[0070] In step 240, if the query result indicates that the number of instructions stored in the instruction buffer has not reached the first threshold, a push instruction request from the client is received via communication. Specifically, if the query result indicates that the number of instructions in the instruction buffer has not reached the first threshold, it indicates that there is available storage space in the instruction buffer. The client can issue a push instruction request to the robot by calling the robot's API corresponding to the push instruction function or sending a TCP command corresponding to the push instruction function to the robot in the form of a string. The robot then receives the push instruction request.
[0071] Step 250 , in response to the push instruction request, push the first target instruction into the instruction buffer in sequence, and perform forward processing on the first target instruction in the instruction buffer in sequence.
[0072] Step 260: If the number of first target instructions after the forward processing reaches the preset second threshold, the client receives a request to start the movement made by the communication method. Specifically, the client can send an instruction in JSON data format to the robot for querying whether the number of first target instructions after the forward processing reaches the second threshold, so as to determine whether the target movement can be started. Accordingly, the robot receives the instruction from the client and, in response to the above instruction, sends a result in JSON data format to the client indicating that the number of first target instructions after the forward processing does not reach the second threshold, or that the number of first target instructions after the forward processing reaches the second threshold. If the result is that the number of first target instructions after the forward processing reaches the preset second threshold, the client can make a request to start the movement to the robot by calling the robot's API corresponding to the function of starting the movement, or sending a TCP instruction corresponding to the function of starting the movement to the robot in the form of a character string, and the robot receives the request to start the movement accordingly.
[0073] Step 270 , in response to the motion start request, executing the target motion in sequence according to the first target instruction after the forward processing.
[0074] In this embodiment, the client can realize remote communication control of the robot's basic functions such as query by sending query instructions and other instructions corresponding to the robot's basic functions to the robot, and realize remote communication control of the robot's target movement.
[0075] like Figure 3 As shown, in one embodiment, in the above step 250, the first target instruction is sequentially pushed into the instruction buffer, including the step of sequentially pushing part of the first target instruction into the instruction buffer. Based on this, the robot control method includes the following steps 310 to 390. Among them, steps 310 to 340 and steps 380 to 390 correspond to steps 210 to 240 and steps 260 to 270 in the aforementioned embodiment, respectively. Steps 310 to 340 and steps 380 to 390 of this embodiment can refer to the discussion of the aforementioned embodiment, and will not be repeated here.
[0076] Step 310: Receive a first target instruction sent by the client.
[0077] Step 320: Receive a query instruction sent by the client, where the query instruction is used to query whether the number of instructions stored in the instruction buffer reaches a first threshold.
[0078] Step 330: Send the query result in response to the query instruction.
[0079] Step 340: If the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, then receive a push instruction request from the client in a communication manner.
[0080] Step 350, in response to the push instruction request, push part of the first target instruction into the instruction buffer in sequence. Specifically, when the robot pushes the first target instruction into the instruction buffer in real time and in sequence, it can optionally divide the first target instruction into multiple parts to push them in sequence. It should be noted that the first target instruction is divided into multiple parts here, which is intended to express that pushing the first target instruction and judging whether the number of instructions stored in the instruction buffer reaches the first threshold are both a continuous and repetitive process, and it is not a one-time push of all the first target instructions into the instruction buffer, nor is it a one-time judgment to push all the first target instructions into. In this embodiment, the division of "part" does not need to be too obvious. It is only necessary that in the process of pushing the first target instruction into the instruction buffer, a part has been pushed in and a part has not been pushed in, then it can be considered that "part" of the first target instruction has been pushed in.
[0081] Step 360 again receives the query command sent by the client and sends a query result in response to the query command. If the query result indicates that the number of instructions stored in the instruction buffer has not reached the first threshold, the client sequentially pushes some of the first target instructions into the instruction buffer until a query result indicating that the number of instructions stored in the instruction buffer has reached the first threshold is sent in response to the query command, or all of the first target instructions have been pushed into the instruction buffer. Specifically, while sequentially pushing some of the first target instructions into the instruction buffer, the client must repeatedly determine whether the number of instructions stored in the instruction buffer has reached the first threshold, and then determine whether there is room in the instruction buffer to store more first target instructions. The client sends the query command again, and the robot receives and sends a query result in response to the query command. It should be understood that since the client has already submitted a push command request by calling the robot's API corresponding to the push command function or sending the TCP command corresponding to the push command function to the robot in the form of a string during the entire process of the robot controlling and executing the target motion, there is no need to submit a push command request again. If the query result indicates that the number of instructions stored in the instruction buffer has not reached the first threshold, the robot can directly push some of the first target instructions into the instruction buffer in sequence. It should also be understood that as long as the number of instructions has not reached the first threshold, the first target instruction can be pushed in; as long as the first target instruction is pushed in, it is necessary to further determine whether the number of instructions has reached the first threshold. Until the number of instructions reaches the first threshold, it indicates that the instruction buffer has no extra space to allow the first target instruction to be stored at this time, so the first target instruction is stopped from being pushed into the instruction buffer; or, until all the first target instructions have been pushed into the first buffer, the pushing ends at this time. If the number of instructions stored in the instruction buffer reaches the first threshold, the client can make a request to the robot to end the pushing instruction by calling the robot's API corresponding to the function of ending the pushing instruction, or sending the TCP instruction corresponding to the function of ending the pushing instruction to the robot in the form of a character string, so as to indicate the end of pushing the first target instruction.
[0082] In step 370, the robot performs forward processing on the first target command in the command buffer. It should be noted that as long as the first target command enters the command buffer, the robot performs forward processing on the first target command in the command buffer. This is a continuous process. That is, in this embodiment, step 370 and subsequent steps are not actually executed in any specific order relative to step 360.
[0083] Step 380 : If the number of the first target instructions after the forward processing reaches a preset second threshold, a motion start request from the client is received in a communication manner.
[0084] Step 390 , in response to the motion start request, executing the target motion in sequence according to the first target instruction after the forward processing.
[0085] In this embodiment, while the robot pushes some of the first target instructions into the instruction buffer in sequence, the client continuously and repeatedly sends query instructions to query whether the number of instructions stored in the instruction buffer reaches the first threshold to determine whether the first target instructions can continue to be pushed into the instruction buffer.
[0086] like Figure 4 As shown, in one embodiment, the query instruction includes a query password; the above step 230, in response to the query instruction, sends the query result, including the following steps 410 to 420.
[0087] Step 410 verifies the query password against the preset command password. Specifically, as described in the previous embodiment, when a client sends a get, put, or post command, it must send a correct token, and the robot must verify the token before executing the client's get, put, or post command. Based on this, in this embodiment, the query command sent by the client to the robot includes a query password. Upon receiving the query command, the robot verifies the query password against the preset command password.
[0088] Step 420: If the query password verification is successful, the robot sends the query result in response to the query instruction. Specifically, if the query password verification is successful, the robot executes the query instruction of the client, that is, sends the query result to the client.
[0089] In addition, it can be understood that the query instruction sent by the client can optionally include information corresponding to date, from, and to, and the query result sent by the robot must also include information corresponding to date, from, and to.
[0090] In this embodiment, the robot verifies the query password carried in the query instruction sent by the client, and executes the query instruction of the client if the verification is successful, which is beneficial to improving the security of remote communication control.
[0091] like Figure 5 As shown, in one embodiment, the robot control method includes the following steps 510 to 570. Among them, steps 510 to 550 correspond to steps 110 to 150 in the aforementioned embodiment, and steps 510 to 550 of this embodiment can be referred to the discussion of the aforementioned embodiment, and will not be repeated here.
[0092] Step 510: Receive a first target instruction sent by the client.
[0093] Step 520: If the number of instructions stored in the instruction buffer does not reach a preset first threshold, a push instruction request from the client is received in a preset communication manner.
[0094] Step 530 , in response to the push instruction request, push the first target instruction into the instruction buffer in sequence, and perform forward processing on the first target instruction in the instruction buffer in sequence.
[0095] Step 540 : If the number of the first target instructions after the forward processing reaches a preset second threshold, a motion start request from the client is received in a communication manner.
[0096] Step 550 : In response to the motion start request, execute the target motion in sequence according to the first target instruction after the forward processing.
[0097] Step 560, receiving the second target instruction sent by the client. The second target instruction also refers to a dynamic instruction that causes the robot to execute the target motion. After the client remotely controls the robot to execute the target motion corresponding to the first target instruction, the client continues to send the second target instruction to the robot to remotely control the robot to execute the target motion corresponding to the second target instruction. At this time, the robot receives the second target instruction. It should be noted that the client sends the first target instruction to control the robot to execute the target motion, and then sends the second target instruction to control the robot to execute the target motion. This is an overall process. The client can also choose to combine the first target instruction and the second target instruction into an overall target instruction, and then control the robot to execute the target motion. It should also be noted that if the client also sends an instruction to the robot for querying whether the target motion corresponding to the first target instruction has been executed, the client will continue to send the second target instruction to the robot after the robot responds to this instruction and sends the result of executing the target motion to the client.
[0098] In step 570, if the number of instructions stored in the instruction buffer does not reach the first threshold, the second target instructions are sequentially pushed into the instruction buffer. Preview processing is then performed on the second target instructions in the instruction buffer. If the number of second target instructions after preview processing reaches the second threshold, the target motion is executed sequentially according to the preview processed second target instructions until the target motion is completed. Specifically, after receiving the second target instruction, the robot must communicate with the client, similar to the process of controlling the execution of the target motion corresponding to the first target instruction. The difference is that in this overall process, the client has already submitted a request to push instructions and a request to start motion. Therefore, when communicating with the second target instruction, if the number of instructions stored in the instruction buffer does not reach the first threshold, the robot directly pushes the second target instructions into the instruction buffer. If the number of second target instructions after preview processing reaches the second threshold, the robot directly executes the target motion according to the preview processed second target instructions, without having to receive separate requests from the client to push instructions and start motion.
[0099] It can be understood that after the client remotely controls the robot to execute the target motion corresponding to the second target instruction, it can continue to send a third target instruction to the robot to remotely control the robot to execute the target motion corresponding to the third target instruction, and so on, until the client no longer needs the robot to execute more target motions.
[0100] In this embodiment, the client can control the robot to execute target movements multiple times in one overall process. After the previous set of target movements is completed, the client can control the execution of the next set of target movements, so that the robot can execute the target movements coherently and orderly.
[0101] like Figure 6 As shown, in one embodiment, the robot control method includes the following steps 601 to 612.
[0102] The robot executes step 601 to receive the first target instruction sent by the client. Then, it executes step 602 to receive the query instruction sent by the client, and the query instruction is used to query whether the number of instructions stored in the instruction buffer reaches the first threshold. The query instruction includes a query password, and then step 603 is executed to verify the query password according to the preset instruction password. Step 604, if the query password verification is successful, the query result is sent in response to the query instruction. Step 605, if the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, the client receives the push instruction request proposed by calling the API and / or sending the TCP instruction in JSON data format. Further, the robot executes step 606, and in response to the push instruction request, pushes part of the first target instruction into the instruction buffer in sequence. Furthermore, the robot executes step 607, receives the query instruction sent by the client again, and sends the query result in response to the query instruction. If the query result indicates that the number of instructions stored in the instruction buffer has not reached the first threshold, then some of the first target instructions are pushed into the instruction buffer in sequence, until the query result that the number of instructions stored in the instruction buffer reaches the first threshold is sent in response to the query instruction or all the first target instructions have been pushed into the instruction buffer. In no particular order to the execution of step 607, the robot also executes step 608, and performs forward processing on the first target instructions in the instruction buffer in sequence; step 609, if the number of first target instructions after forward processing reaches the preset second threshold, then the client receives a start motion request by calling an API and / or sending a TCP instruction in JSON data format; step 610, in response to the start motion request, the target motion is executed in sequence according to the first target instruction after forward processing. It should be noted that although Figure 6 Although steps 607 and 608 to 610 are shown to be sequential, in reality, there is no sequential order between these two processes. Through the above steps, the robot responds to the client's request in real time and controls the execution of the target movement in accordance with the client's first target instruction until the target movement is completed.
[0103] Furthermore, the robot executes step 611 to receive the second target instruction sent by the client. Furthermore, in step 612, if the number of instructions stored in the instruction buffer does not reach the first threshold, the second target instructions are sequentially pushed into the instruction buffer. Preview processing is performed on the second target instructions in the instruction buffer. If the number of second target instructions after preview processing reaches the second threshold, the target movement is executed sequentially according to the preview processing second target instructions until the target movement is completed. Through the above steps, the robot continues to control the execution of the target movement in sequence according to the second target instruction of the client until the target movement is completed.
[0104] In this embodiment, the remote communication control process does not require a complex instruction system, and the robot and the client do not need to combine the instruction data. Based on the temporary and orderly storage of the client's first target instruction and the client's real-time request in the instruction buffer, the robot can respond to the client's request in real time and efficiently control the execution of target movement in sequence according to the client's first target instruction, which is conducive to improving control efficiency and making the remote communication control process simpler.
[0105] It should be understood that although the flowcharts involved in the above embodiments are Figures 1-6 The steps in the embodiment are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Figures 1-6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0106] Based on the same inventive concept, embodiments of the present application also provide a robot control device for implementing the aforementioned robot control method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more robot control device embodiments provided below can be found in the above-described limitations of the robot control method and will not be further elaborated here.
[0107] like Figure 7 As shown, an embodiment of the present application also provides a robot control device 10. The robot control device 10 includes an instruction receiving module 11, a first request receiving module 12, an instruction pushing module 13, a second request receiving module 14 and a motion execution module 15. The instruction receiving module 11 is used to receive a first target instruction sent by a client. The first request receiving module 12 is used to receive an instruction pushing request submitted by the client in a preset communication mode if the number of instructions stored in the instruction buffer does not reach a preset first threshold. The instruction pushing module 13 is used to push the first target instruction into the instruction buffer in response to the instruction pushing request, and to perform forward processing on the first target instruction in the instruction buffer in turn. The second request receiving module 14 is used to receive a motion start request submitted by the client in a communication mode if the number of the first target instructions after the forward processing reaches a preset second threshold. The motion execution module 15 is used to execute the target motion in response to the motion start request according to the first target instruction after the forward processing.
[0108] In one embodiment, the robot control device 10 further includes a query instruction receiving module 11 and a query result sending module. The query instruction receiving module 11 is configured to receive a query instruction sent by a client, wherein the query instruction is configured to query whether the number of instructions stored in the instruction buffer has reached a first threshold. The query result sending module is configured to send a query result in response to the query instruction. The first request receiving module 12 is further configured to receive a push instruction request from the client via communication if the query result indicates that the number of instructions stored in the instruction buffer has not reached the first threshold.
[0109] In one embodiment, the instruction push module 13 is further configured to sequentially push some of the first target instructions into the instruction buffer. The robot control device 10 further includes a cyclic query module configured to again receive a query instruction sent by the client and send a query result in response to the query instruction. If the query result indicates that the number of instructions stored in the instruction buffer has not reached a first threshold, the module sequentially pushes some of the first target instructions into the instruction buffer until a query result indicating that the number of instructions stored in the instruction buffer has reached the first threshold is sent in response to the query instruction, or all of the first target instructions have been pushed into the instruction buffer.
[0110] In one embodiment, the query instruction includes a query password; the query result sending module includes a password verification unit and a query result sending unit. The password verification unit is configured to verify the query password against a preset instruction password. The query result sending unit is configured to send the query result in response to the query instruction if the query password verification succeeds.
[0111] In one embodiment, the robot control device 10 also includes a loop execution module for receiving a second target instruction sent by the client; if the number of instructions stored in the instruction buffer does not reach a first threshold, the second target instructions are pushed into the instruction buffer in sequence, and the second target instructions in the instruction buffer are forward-processed in sequence. If the number of second target instructions after the forward-processing reaches a second threshold, the target motion is executed in sequence according to the second target instructions after the forward-processing until the execution of the target motion is completed.
[0112] Each module in the robot control device 10 can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the robot's processor in hardware form, or can be stored in the robot's memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0113] like Figure 8As shown, an embodiment of the present application further provides a robot. The robot includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned robot control method when executing the computer program.
[0114] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the present application scheme, and does not constitute a limitation on the robot to which the present application scheme is applied. The specific robot may include Figure 8 More or fewer components may be shown, or some components may be combined, or the components may be arranged differently.
[0115] An embodiment of the present application also 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 above-mentioned robot control method are implemented.
[0116] An embodiment of the present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned robot control method when executed by a processor.
[0117] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0118] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0119] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A robot control method, characterized in that: The method comprises: receiving a first target instruction sent by a client; If the number of instructions stored in the instruction buffer does not reach a preset first threshold, receiving a push instruction request from the client in a preset communication mode; In response to the push instruction request, sequentially push the first target instructions into the instruction buffer, and sequentially perform forward processing on the first target instructions in the instruction buffer; If the number of the first target instructions after the forward processing reaches a preset second threshold, receiving a motion start request submitted by the client via the communication method; In response to the motion start request, executing the target motion in sequence according to the first target instruction after the forward processing; receiving a second target instruction sent by the client; If the number of instructions stored in the instruction buffer does not reach the first threshold, the second target instructions are pushed into the instruction buffer in sequence, and the second target instructions in the instruction buffer are forward-processed in sequence. If the number of the second target instructions after the forward-processing reaches the second threshold, the target movement is executed in sequence according to the second target instructions after the forward-processing until the execution of the target movement is completed.
2. The method according to claim 1, characterized in that The communication method includes calling an API and / or sending a TCP instruction in JSON data format.
3. The method according to claim 1, characterized in that The method further comprises: receiving a query instruction sent by the client, wherein the query instruction is used to query whether the number of instructions stored in the instruction buffer reaches the first threshold; In response to the query instruction, sending the query result; If the number of instructions stored in the instruction buffer does not reach a preset first threshold, receiving a push instruction request from the client in a preset communication mode, including: If the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, the push instruction request proposed by the client in the communication manner is received.
4. The method according to claim 3, characterized in that The sequentially pushing the first target instructions into the instruction buffer includes: sequentially pushing some of the first target instructions into the instruction buffer; After sequentially pushing some of the first target instructions into the instruction buffer, the method further includes: Receive the query instruction sent by the client again, and send the query result in response to the query instruction. If the query result indicates that the number of instructions stored in the instruction buffer does not reach the first threshold, then push some of the first target instructions into the instruction buffer in sequence until the query result indicating that the number of instructions stored in the instruction buffer reaches the first threshold is sent in response to the query instruction or all of the first target instructions have been pushed into the instruction buffer.
5. The method according to claim 3, characterized in that The query instruction includes a query password; and sending a query result in response to the query instruction includes: Verifying the query password according to a preset command password; If the query password is successfully verified, the query result is sent in response to the query instruction.
6. A robot control device, characterized in that: The device comprises: An instruction receiving module, configured to receive a first target instruction sent by a client; a first request receiving module, configured to receive a push instruction request from the client in a preset communication mode if the number of instructions stored in the instruction buffer does not reach a preset first threshold; an instruction push module, configured to push the first target instructions into the instruction buffer in sequence in response to the instruction push request, and perform forward processing on the first target instructions in the instruction buffer in sequence; a second request receiving module, configured to receive a motion start request from the client via the communication method if the number of the first target instructions after the forward processing reaches a preset second threshold; a motion execution module, configured to respond to the motion start request and sequentially execute the target motion according to the first target instruction after the forward processing; A cyclic execution module is used to receive the second target instruction sent by the client; if the number of instructions stored in the instruction buffer does not reach the first threshold, the second target instructions are pushed into the instruction buffer in sequence, and the second target instructions in the instruction buffer are forward-processed in sequence; if the number of the second target instructions after the forward-processing reaches the second threshold, the target movement is executed in sequence according to the second target instructions after the forward-processing until the execution of the target movement is completed.
7. A robot comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Implementation method for command multi-transmitting mechanism of numerical control system
CN102540973A
Multi-axis motion control method and multi-axis motion device
CN111381555A