Implementation method for parallel execution of robot actions

By introducing parallel start and end instructions in robot programming, dividing parallel and serial execution areas, and adding judgment conditions, the problem of insufficient complexity and flexibility of existing programming methods is solved, and efficient parallel execution and multi-mode are achieved state control has promoted the development of intelligent robot applications.

CN119238500APending Publication Date: 2025-01-03DALIAN YUZHIXING TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411317312.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing robot programming methods have limitations in the flexibility of serial and parallel functions execution, resulting in high programming complexity, mechanical rigidity, low flexibility, and difficulty in achieving complex tasks and advanced applications.

Method used

By introducing parallel start and parallel end instructions in the programming stage, the parallel statement execution area and the serial statement execution area are divided, and judgment conditions and exit instructions are added to the parallel area to realize parallel execution and flexible control of actions.

Benefits of technology

It simplifies parallel programming operations of robots, improves programming flexibility and debugging and maintenance efficiency, supports more complex task execution and multimodal information processing, and promotes the development and popularization of advanced intelligent robots.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119238500A_ABST
    Figure CN119238500A_ABST
Patent Text Reader

Abstract

The invention discloses an implementation method for parallel execution of robot actions, and relates to the technical field of robot programming, the method comprises a programming stage, a compiling stage and an execution stage, the programming stage mainly comprises the following steps: framing a parallel statement execution area by adding a parallel start indication statement and a parallel end indication statement; the compiling stage mainly comprises the following steps of: adding grammar compiling of a parallel start indication statement, a parallel end indication statement and a parallel exit indication statement during compiling; and the execution stage mainly comprises the following steps: sequentially performing serial execution on the statement content of the serial statement execution area, and simultaneously performing parallel execution on the statement content of the parallel statement execution area. According to the method, during robot programming, robot parallel action programming can be effectively simplified, serial and parallel action programming layers are clear, and program management and maintenance are easy; and meanwhile, the operation complexity of the management and debugging robot is reduced, and the action execution flexibility is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to robot technology, in particular to a method for implementing parallel execution of robot actions. Background Art

[0002] At present, robot technology has made great progress, and robot programming is still a crucial link in the application and promotion of robot products. It is directly related to the performance and efficiency of robot use. However, there are some limitations in the existing robot programming methods, especially in the flexibility of serial and parallel function execution. These limitations not only affect the programming efficiency of robots, but also limit their application in complex tasks.

[0003] Usually, a robot with multiple degrees of freedom is composed of many action units, and their synergy constitutes the overall action of the robot, such as raising and lowering the head, raising and lowering the arms, grasping and releasing the manipulator, and moving the whole body forward, backward, and rotating. It also includes closing the two arms to hug, coordinated walking of the two legs, and even expressions achieved by the cooperation of the mouth, eyes, and eyebrows. In fact, the actions performed by the robot must meet certain requirements. For example, when the robot dances, the robot's body is required to move independently to a certain performance position at a certain time, and then the left and right arms are required to move at the same time, and then the arms and legs are required to move at the same time.

[0004] In fact, advanced robots also need to perform other functions when performing actions. When performing an action, they need to judge some external sensor information before deciding whether to perform it, such as adjusting the action when the arm hits an obstacle; or they need to accept special instructions from people at the same time when performing an action, such as talking to humans while performing an action. Such operations are very complex to be realized through existing programming methods, and there are still problems such as mechanical rigidity and low flexibility when realizing functions. For example, many dancing robots usually perform actions according to a fixed time series table, and perform corresponding actions in a certain period of time in a certain or several action units according to the time sequence, so as to realize the execution of serial and parallel actions, and it is not convenient to add judgment conditions to exit the operation of parallel execution. It is very unfavorable for robots to perform more advanced and complex tasks, and naturally it is not conducive to the popularization and promotion of robot applications. Summary of the invention

[0005] In view of the technical problems of the existing robot parallel programming methods, such as complex programming, mechanical rigidity, and low flexibility, a method for implementing parallel execution of robot actions is provided. The present invention can efficiently simplify the robot parallel programming operation, flexibly manage the serial and parallel execution of robot behaviors, and also facilitate debugging and maintenance, which can advantageously promote the development and popularization of advanced intelligent robots and allow robots to serve human society more friendly.

[0006] The technical means adopted by the present invention are as follows:

[0007] A method for implementing parallel execution of robot actions includes a programming stage, a compiling stage and an execution stage, wherein the programming stage includes the following steps:

[0008] S1. According to the robot function requirements, when writing program contents that need to be executed in parallel, a parallel start instruction statement is added before the contents that need to be executed in parallel, and a parallel end instruction statement is added at the end of the contents that need to be executed in parallel, and the area between the parallel start instruction statement and the parallel end instruction statement is framed as the parallel statement execution area, and the program area not framed is the serial statement execution area;

[0009] The compilation phase includes:

[0010] S2. When compiling the program written in the programming stage, compiling a parallel start instruction statement, a parallel end instruction statement, and a parallel exit instruction statement is added;

[0011] S3. When compiling the program written in the programming stage, a "parallel flag" dimension is added, and the statement compilation result of the "parallel flag" dimension in the parallel statement execution area is "Yes|parallel", and the statement compilation result in the serial statement execution area is "No|-";

[0012] S4. When compiling a program written in the programming stage, if the parallel start instruction statement and the parallel end instruction statement do not appear in an ordered pair, a "parallel statement boundary setting type syntax error" prompt is added; at the same time, if the parallel exit instruction statement does not appear in the ordered area of ​​the parallel start instruction statement and the parallel end instruction statement, a "parallel statement exit parallel type syntax error" prompt is added;

[0013] The execution phase includes:

[0014] S5, executing the statement contents of the serial statement execution area sequentially, and executing the statement contents of the parallel statement execution area simultaneously and in parallel;

[0015] S6. During the parallel execution of statements in the parallel statement execution area, when there is a parallel exit instruction statement, the exit condition attached to the parallel exit instruction statement is determined cyclically, and once the condition is satisfied, the current parallel execution area is exited.

[0016] Furthermore, the parallel execution area is set by a parallel start instruction statement and a parallel end instruction statement, wherein the parallel start instruction statement is set to: "parallel start ();

[0017] The parallel end instruction statement is set to: "parallel end ()";

[0018] The parallel exit instruction statement is set to: "Exit parallel ()".

[0019] Furthermore, the program content includes conventional programming statements, action state judgment statements and action execution statements;

[0020] The conventional programming statements are used to implement assignment, jump, loop and function call functions;

[0021] The action state judgment statement is used to perform the action state judgment function;

[0022] The action execution statement is used to realize the driving function of the robot execution unit.

[0023] Furthermore, the method further comprises: setting an execution state variable for each action execution statement, and assigning a value to the execution state variable according to whether the action execution is completed or not.

[0024] Furthermore, when the statements in the parallel statement execution area are executed, a parallel flag is established in the parallel statement execution area, the action execution statement with the parallel mark is established in the parallel action linked list, and the action status is monitored; a loop is performed to determine whether the action corresponding to each node in the parallel action linked list is completed, and if completed, it is deleted from the linked list.

[0025] Compared with the prior art, the present invention has the following advantages:

[0026] 1. The present invention divides the parallel statement execution area by adding area-limiting statements "parallel start ()" and "parallel end ()" as needed. Statements in the area are executed in parallel, and statements outside the area are executed serially. Without destroying the existing programming structure, serial and parallel functions are represented in a clear hierarchy, achieving programming flexibility, greatly simplifying the programming and debugging of serial and parallel functions, making it easy to manage and maintain, and can quickly and efficiently develop complex programs for robots.

[0027] 2. In the parallel work area, the present invention can exit the current parallel work area by adding program statements for judging the results of multiple information states, for example, adding statements for judging the working states of external sensor information and its own actions, and then adding exit instruction statements (such as "exit parallel ()"). In this way, the parallel work area can be exited at any time according to external conditions, making parallel control more flexible, changing the mechanical rigidity and operational inflexibility of traditional robot programming.

[0028] 3. The statements added by the present invention to the parallel work area for judging the state of the parallel action unit itself can be various logical combination conditions of the action states of multiple parallel action units in the parallel work area. For example, when executing the parallel actions of the three action units A, B, and C in the parallel work area, it can be judged by "OR" logic that as long as one of their working states is completed, the parallel work area can be exited, or it can be judged by "AND" logic that all their actions will not be exited until they are completed, or it can be judged by their "AND" and "OR" combination conditions to exit the parallel work area. In this way, flexible operations can be performed according to the combination results of various states of the action units in the parallel work area.

[0029] 4. In the parallel work area of ​​the present invention, in addition to the action control statements of the robot action unit, various other non-action program statements can also be included. For example, while executing parallel actions, other operation statements such as playing videos, playing pictures, outputting voices, and image recognition can be executed. In this way, both the combined input and combined output of multi-modal information can be realized, and the organic combination of robot intelligence and action can be effectively realized.

[0030] 5. In the parallel workspace, the exit statement "Exit Parallel()" and its attached judgment conditions added by the present invention can appear at any position in the parallel workspace. For example, after executing the action statement of action unit A, it is not necessary to immediately perform the status condition judgment of action unit A. The action status detection of action unit A can also be performed after executing other statements. Since the statement is not restricted to the order of execution of parallel statements, more flexible parallel function programming can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0032] Figure 1The present invention is a flow chart of a method for implementing parallel execution of robot actions.

[0033] Figure 2 Schematic diagram of the division of program serial and parallel statement execution areas in an embodiment of the present invention.

[0034] Figure 3 A schematic diagram of establishing a parallel flag for a parallel statement in an embodiment of the present invention.

[0035] Figure 4 Schematic diagram of a parallel action statement linked list and corresponding action states in an embodiment of the present invention.

[0036] Figure 5 This is the workflow of the serial statement execution area in an embodiment of the present invention.

[0037] Figure 6 This is the parallel statement execution area workflow in an embodiment of the present invention.

[0038] Figure 7 It is a sub-process for monitoring the action status of the parallel statement execution area and the exit parallel condition in the embodiment of the present invention.

[0039] Figure 8 It is a schematic diagram of an application example program (Chinese native language programming) of the present invention. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0041] like Figure 1 As shown, the present invention provides a method for implementing parallel execution of robot actions, including a programming stage, a compiling stage and an execution stage.

[0042] The programming phase consists of the following steps:

[0043] S1. According to the robot function requirements, when writing program content that needs to be executed in parallel, by adding a parallel start instruction statement in front of the content and a parallel end instruction statement at the end of the content, this area is framed as a parallel statement execution area, and the program area outside the parallel statement execution area that is not framed is a serial statement execution area. The number of serial statement execution areas and parallel statement execution areas in a program is unlimited, and they can appear alternately. As a preferred embodiment of the present invention, the parallel start instruction statement is set to: "Parallel Start ()", and the parallel end instruction statement is set to: "Parallel End ()". In addition, the present invention also sets the parallel exit instruction statement to "Exit Parallel ().

[0044] Specifically, according to the actual application requirements of the robot, the edited program content includes conventional programming statements, action state judgment statements and action execution statements. Among them, conventional programming statements are used to implement assignment, jump, loop and function call functions; action state judgment statements are used to execute action state judgment functions; action execution statements are used to implement the driving function of the robot execution unit.

[0045] The compilation phase includes:

[0046] S2. When compiling the program written in the programming stage, compiling the parallel start instruction statement, the parallel end instruction statement and the parallel exit instruction statement is added. In the embodiment of the present invention, the statements such as "parallel start (), "parallel end ()" and "exit parallel ()" are added to compile.

[0047] S3. For the programs written in the programming stage, the dimension of "parallel flag" is added during compilation. The compilation result of the statements in the parallel statement execution area is "Yes|Parallel", and the compilation result of the statements in the serial statement execution area is "No|-".

[0048] S4. For the programs written in the programming stage, when compiling, if "Parallel Start()" and "Parallel End()" do not appear in an ordered pair, a "Parallel statement boundary setting type syntax error" will be prompted; when compiling, if "Exit Parallel()" does not appear in the ordered area of ​​"Parallel Start()" and "Parallel End()", a "Parallel statement exit parallel type syntax error" will be prompted.

[0049] The execution phase includes:

[0050] S5. Execute the statement contents of the serial statement execution area sequentially, and execute the statement contents of the parallel statement execution area simultaneously and in parallel.

[0051] S6. During the parallel execution of statements in the parallel statement execution area, when there is an "exit parallel()" statement, the exit condition attached to the "exit parallel()" statement is judged cyclically, and once the condition is met, the current parallel execution area is exited.

[0052] The scheme and effect of the present invention are further described below through specific application examples.

[0053] like Figure 2 As shown in the figure, it describes that by adding three statements of "Parallel Start()", "Parallel End()" and "Exit Parallel()" on the basis of the existing programming language, the programming area is divided into a serial statement execution area and a parallel statement execution area. The number of statements in each serial area or each parallel execution area can be arbitrary, and the content of the statement can be either a conventional programming language statement, such as assignment, jump, loop and function call, etc., or various execution statements of the robot action unit, such as driving the robot head to turn left, raising the right arm, etc.

[0054] Specifically, the execution statements of the robot action unit can be executed in the serial area or in the parallel area, and the execution statements of the same action unit can also be used repeatedly in different areas. The specific use depends on the actual programming needs.

[0055] Figure 2 The entire program content is divided into serial and parallel interlaced statement execution areas such as serial statement execution area 1, parallel statement execution area 1, serial statement execution area 2, parallel statement execution area 2 and serial statement execution area 3. The areas not framed by "parallel start ()" and "parallel end ()" belong to the serial statement execution area. In the serial statement execution area 1, there are action unit A action statements, action unit B action statements, action unit C action statements, conventional programming language statements 1, conventional programming language statements 2, and conventional programming language statements 3. Its execution process is: only when the action unit A action statement is executed can the action unit B action statement be executed. Similarly, only when the action unit B action statement is executed can the action unit C action statement be executed; then, the conventional programming language statement 1, conventional programming language statement 2, and conventional programming language statement 3 are executed in sequence. It reflects that the statements in the serial statement execution area are all executed serially.

[0056] The areas framed by "Parallel Start()" and "Parallel End()" belong to the parallel statement execution area. In the parallel statement execution area 1, there are action unit E action statements, action unit F action statements, action unit G action statements, conventional programming language statements 10, and conventional programming language statements 11. The execution process is: after the action unit E action statement is executed, the action unit F action statement and the action unit G action statement are executed immediately; then, the conventional programming language statements 10 and the conventional programming language statements 11 are executed in sequence. Since the action unit is very fast in receiving the action statement command, usually in the microsecond level, and the action unit is relatively slow in executing the action, which is in the millisecond level or even the second level (the execution time of different action contents is different). Although these action instructions are essentially "serial" and sent out quickly in microseconds, since the mechanical mechanism takes more than milliseconds to execute the action, the delay of the action statements of the action units in these parallel execution areas in transmitting the instructions can be ignored. Therefore, in actual performance, they are all executed in parallel at the same time, which reflects the process that the actions in the parallel statement execution area are all executed in parallel. Of course, other non-action statements in the parallel execution area that are time-consuming to execute, such as the long wait when reading the result of a third-party function, are also similar to the parallel execution effect of the action class.

[0057] As for the execution of the programming language statements 10 and the conventional programming language statements 11 in this area, although they are also executed serially at the microsecond level, they do not affect the parallel execution effect of the action units in this area, thereby realizing simplified programming of the parallel functions of the robot action units in the parallel execution area.

[0058] The serial statement execution area 2 includes the conventional programming language statement 20, the conventional programming language statement 21, the action unit P action statement, and the action unit Q action statement. The execution process is exactly the same as the execution process described in the serial statement execution area 1. The serial statement execution area 2 here is just to illustrate that a certain number of serial statement execution areas can be set up between two parallel statement execution areas, or it can be set up without setting up, and one parallel execution area directly follows the next parallel execution area, depending on the actual programming needs.

[0059] The parallel statement execution area 2 includes conventional programming language statements 30, conventional programming language statements 31, action unit J action statements, action unit K action statements, action unit L action statements, statements with judgment conditions to exit the parallel execution area "if action unit J action status == 'completed' and action unit K action status == 'completed'" and the statement after line break "exit parallel ()", followed by conventional programming language statements 32 and conventional programming language statements 33. The parallel statement execution area 2 example is mainly to illustrate that in the parallel execution process, sometimes there is a need to exit the parallel area according to certain conditions, that is, usually the execution of all parallel statements in the execution area is not exited until they are all completed, but in practice, it is possible to exit the parallel when the action execution status of some action units meets the requirements, or some other external judgment conditions of non-action execution classes meet the requirements, so as to achieve programming flexibility. The execution process of parallel statement execution area 2 is: first execute conventional programming language statements 30 and 31, then execute action unit J action statement, action unit K action statement and action unit L action statement in parallel, and then execute If-type conditional statements and programming language statements 32, conventional programming language statements 33, etc. Since the statement "if action unit J action status == 'completed' and action unit K action status == 'completed'" with judgment condition to exit the parallel execution area is added, during the parallel execution of the three action units J, K, and L, as long as the action status of action unit J and the action status of action unit K are judged to have reached 'completed', the statement "exit parallel ()" to exit the current parallel execution area can be executed, regardless of whether the action status of action unit L is 'completed'. The judgment condition here is an example of "and" logic. In practice, various judgment conditions can be flexibly set according to needs. Note: Although the conditional statements corresponding to multiple "exit parallel ()" in the parallel statement execution area are executed once, the judgment condition is always monitored in a loop until the condition is met. The programming style of the python language is used in the example here, and the programming style is not limited in practice, as long as it can be executed.

[0060] In the serial statement execution area 3, conventional programming language statements 40, conventional programming language statements 41, action unit A action statements and action unit E action statements are included. The execution process is: first execute the conventional programming language statements 40 and 41, and then execute the action unit A action statement. Only after the action unit A action statement is executed, the action unit E action statement is executed. The execution process of this area is completely similar to that of the serial statement execution area 1. The purpose of the serial statement execution area 3 is to illustrate that the action unit A action statement in the serial statement execution area 1 and the action unit E action statement in the parallel statement execution area 1 can be repeatedly executed in the serial statement execution area 3, which shows that the action statement execution of the robot action unit is not limited to any position and any area, as long as the areas do not overlap.

[0061] Furthermore, in the process of implementing a specific function, the action execution state variable is first defined. Each action statement is set with an execution state variable corresponding to the statement, such as "r. Head raising state", and its result value can be represented by a string. The state variable is not limited to the data type, as long as it can be fully expressed, such as "in progress" for incomplete and "completed" for completed; or represented by an integer, such as "1" for incomplete and "0" for completed.

[0062] During the compilation phase, for all program statements in the interval from the "parallel start()" start line to the "parallel end()" end line in the program, the "parallel flag" dimension is set to "parallel", and those not in the interval are set to "-", see Figure 3 .

[0063] In the execution phase, all program statements in the parallel statement execution area are executed in normal order. All action-type statements with the "parallel" mark after the line starting with "parallel start ()" are established in the parallel action chain list, and the corresponding action states that need to be monitored are corresponding. For non-action statements, it is not necessary to establish (because they are executed in microseconds, their delay relative to the second-level action execution can be ignored), see Figure 4 .

[0064] The loop determines whether each node action in the parallel action list has been executed. If it is completed, it is deleted from the list. When the number of nodes in the parallel action list is 0, it means that all parallel actions in the parallel statement execution area have been executed.

[0065] Loop through the conditional statements marked with "Parallel" and containing "Exit Parallel()" in the current parallel statement execution area. If the "Exit Parallel()" statement is executed during the execution of these conditional statements, the number of nodes in the current parallel action linked list is cleared to 0, and the parallel statement execution area is exited.

[0066] For the statements in the serial statement execution area, they can be executed in normal order. However, each time an action statement is executed, it is necessary to determine whether the status of the action is completed. Otherwise, it is in a loop waiting state until the corresponding action status is "completed". The program then executes the next statement after the action statement.

[0067] To avoid the infinite waiting state of "in progress" caused by unexpected situations during the execution of action statements, such as mechanical jam or obstacles during the execution, each action class sets a corresponding maximum execution time. When this time limit is exceeded, the action class will be forced to exit the loop waiting state, and a prompt "XX action output timed out, forced exit" will be displayed for users to troubleshoot.

[0068] The above contents are presented in the flowchart. For the workflow of the serial statement execution area, see Figure 5 ; For the workflow of parallel statement execution area, see Figure 6 and Figure 7 , Figure 7 yes Figure 6 A subprocess of a workflow.

[0069] like Figure 8 An application example of the method of the present invention in a specific robot programming scenario is given.

[0070] Depend on Figure 8 It can be seen that the Python program sample program, including the comment lines, has a total of 48 program lines, which are divided into serial statement execution area 1 [line 2-line 15], parallel statement execution area 1 [line 17-line 35] and serial statement execution area 2 [line 37-line 48].

[0071] Since the "robot-specific control library" is used in the programming here, before introducing the method of implementing robot parallel actions, the relevant content of the "robot-specific control library" is introduced here.

[0072] The robot proprietary control library is a proprietary interface library built by Dalian Yuzhixing Technology Co., Ltd. specifically for robot programming. Currently, the library supports the robot's own embodied hardware access, as well as the existing external large model call access, etc. In the future, as the robot hardware and other external resources are upgraded, the interface library will also be upgraded accordingly. The interface supports user native language programming, that is, the robot's complex operations are encapsulated into a function library described in the user's native language, and the user can easily use it by calling the function name in his own native language.

[0073] When calling the function library in Python language, use "import yuzhixing01.lib" to import it.

[0074] For the convenience of writing programs, the instance object r = YuzhixingRobotClass() of the proprietary interface library is directly represented by the abbreviation "r" (the first letter of robot); "r.XXX()" is used to access functions, and "r.YYY" is used directly to access properties. "XXX" and "YYY" are names described in the user's native language. For example, when executing a function, "r. Straight forward (100, 30)" is used to indicate that the robot moves forward in a straight line at a speed of 30 by 100. For example, when accessing properties, "head action status = r. Turn right status" is used to directly obtain the current state of the robot turning its head to the right, "1" when turning in progress, and "0" when turning completed.

[0075] (I) Execution effect in serial statement execution area 1:

[0076] Line 3 is an assignment statement for a string variable "Welcome Content".

[0077] Line 4 is the statement that prints the string variable "Welcome Content".

[0078] The above two statements belong to "conventional programming language statements" and are conventional programming statements in the field.

[0079] The sixth line "r. Head horizontal return (0,0)" is a head movement instruction of the "robot-specific control library r", indicating that the head horizontal direction returns to the center, that is, the head and the body are facing forward in the same direction.

[0080] Line 8 "r. Turn head left (60,30)", the head turns 60 degrees to the left with an angular velocity of 30 units.

[0081] Line 10 “r.Left arm raised (90,15)” means the robot’s left arm rotates 90 degrees upward at an angular velocity of 15 units.

[0082] Line 12 "r.right arm raised (90,15)" means the robot's right arm rotates 90 degrees upward at an angular velocity of 15 units.

[0083] The 14th line “r.expression_blink()” is the robot’s facial expression to achieve the blinking effect.

[0084] The above five statements belong to the "action statements of the action unit". Since they are statements in the serial statement execution area, they execute the next action in sequence after the previous action is completed. If the previous action is not completed, the next action statement is in a waiting state.

[0085] Specific effects:

[0086] After executing the two lines of statements for string assignment, start to execute the horizontal alignment of the head. After the head is aligned, => start to turn the head to the left. After the head is turned to the left, => start to raise the left arm. After the left arm is raised to the right position, => start to raise the right arm. After the right arm is raised to the right position, => start to execute the facial expression blinking. After the blinking is completed, the statements in the entire serial area are executed.

[0087] (II) Execution effect in parallel statement execution area 1:

[0088] Line 18 "r.parallel start()" indicates that starting from the current line, all subsequent statements are parallel execution statements.

[0089] Line 20, “r.Look up(15,20)”, means the robot’s head turns 15 degrees upward at an angular velocity of 20 units.

[0090] Line 22, “r. Turn left (90,10)”, means the robot’s body turns 90 degrees to the left at an angular velocity of 10 units.

[0091] Line 24 “r. Turn right (90,10)” means that the robot’s body turns 90 degrees to the right at an angular velocity of 10 units.

[0092] Note: This statement, i.e., line 24, indicates turning right, and the previous statement, line 22, indicates turning left. Since the robot has only one body, it cannot turn left and right at the same time. The present invention stipulates that for different action statements acting on the same action unit, the last action statement always overrides the previous action statements. Therefore, when executed in the parallel statement execution area, only the right turn in line 24 is valid, and the previous statement in line 22 is an invalid statement. This is completely different from executing them sequentially in the serial statement execution area.

[0093] Line 27 "if r. turn right state == 0 and r. turn right state == 0:" is a conditional statement. When the robot has turned its head to the right and turned right to the right, the conditional judgment value is true, otherwise it is false.

[0094] Note: The status value of the right turn state is an integer, where "1" represents "in progress" and "0" represents "completed".

[0095] Line 28 "r. Exit parallel()" is the statement executed when the judgment condition in the previous line 27 is true. The execution of this statement exits the current parallel statement execution area, that is, exits to the next valid line of line 34 "r. Parallel end()", that is, executes to line 39 "r. Straight forward (100,25)".

[0096] Line 31 "r.right arm down (90,20)" means the robot's right arm rotates 90 degrees downward at an angular velocity of 20 units.

[0097] Line 33 "r. Left arm down (90,20)" means that the robot's left arm rotates 90 degrees downward at an angular velocity of 20 units.

[0098] After the execution of the statement "r.Parallel End()" on line 34, it indicates that the parallel statement execution area started by the "r.Parallel Start()" on line 18 and before this line is exited. If the subsequent statements encounter the new "r.Parallel Start()", all the statements before it are executed as serial statements.

[0099] Except for line 27 which is a conditional statement, the other 9 statements above are all "action statements of action units". Since they are statements in the parallel statement execution area, except for the "r. Exit parallel()" statement in line 27 which is executed after waiting for the condition to be met, the other action statements are all executed in parallel, that is, when the actions of the action units in the execution area are executed, they are all executed simultaneously.

[0100] Specific effects:

[0101] After the "r. Start in parallel ()" statement is executed, the robot starts to raise its head upwards and turns right (the effect of turning right instead of left is described in the description of the 24th line statement above), and the right and left arms start to lower at the same time. Since the action execution of the robot action unit takes some time to complete, the judgment statement of the 27th line is always judged as false after a period of time, and the "r. Exit in parallel ()" is not executed. After a period of time, it is detected that the head turn and the right turn are completed, and the 28th line "r. Exit in parallel ()" is directly executed to exit the parallel statement execution area, that is, the execution reaches the 39th line "r. Straight forward (100,25)".

[0102] Note: The right arm lowering and left arm lowering actions in this parallel statement execution area 1 are executed simultaneously in parallel. This is fundamentally different from the serial execution in the serial statement execution area 1 where the left arm is raised first and then the right arm is raised after it is in place. This is the difference between parallel and serial execution of action units.

[0103] In addition, in practice, for some reasons, there is a situation where the robot can never reach the completion state during the execution of certain actions, such as the arm being stuck or the robot encountering an obstacle when moving forward, causing the action to stagnate. The present invention specially sets a maximum execution time limit for action execution. When their maximum execution time is exceeded, they are forced to exit their execution state, and there is a prompt message indicating which action unit is forced to exit due to timeout during execution, which is convenient for future problem troubleshooting. In addition, this maximum execution time limit for action execution also applies to the action execution of action units in the serial statement execution area.

[0104] (III) Execution effect in serial statement execution area 2:

[0105] Line 39 "r. Straight forward (100,25)" means that the robot body moves forward in a straight line at a linear velocity of 25 units with a displacement of 100 cm.

[0106] Line 41 "r. Turn left (180,10)" means that the robot body turns 180 degrees to the left at an angular velocity of 10 units.

[0107] Line 43 "r. Raise both arms (60,15)" means that the robot's left and right arms rotate upward 60 degrees at an angular velocity of 15 units.

[0108] The 46th line "r. Play with facial expression ('happy', 'OK, now the serial and parallel actions are demonstrated!')" is the robot voice playback information, and the facial expression action of "happy" is executed while playing the sound.

[0109] Line 48 “print("==Thank you everyone,","Please give me more advice!==")” prints the string content to the output display, which is a regular programming language statement.

[0110] The first four of the five statements above belong to the "action statements of the action unit", and the last one is a regular programming language statement. Since they are statements in the serial statement execution area, they execute the next action after the previous action is completed. If the previous action is not completed, the next action statement is in a waiting state.

[0111] Specific effects:

[0112] Start to execute straight forward displacement of 100, wait until it reaches the position => start to execute 180 degree left turn, wait until it reaches the position => start to raise both arms (this is not a parallel statement but the result of executing a special double-arm operation instruction), wait until both arms are raised to the position => start to broadcast the voice with a happy expression "OK, now the serial and parallel action execution demonstration is complete!", wait until the voice playback is complete => start to print "" == Thank you everyone, ", "Please give me more advice! == "", that is, the entire serial statement execution area 2 statements are all executed.

[0113] At this point, the execution process of a robot motion programming sample program has been completed, which includes two execution modes of program statements: serial and parallel. In addition, more common programming language statements such as while, for, and call, which are commonly used in the programming field, can also be added and used.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for implementing parallel execution of robot actions, characterized in that: It includes a programming stage, a compiling stage and an execution stage, wherein the programming stage includes the following steps: S1. According to the robot function requirements, when writing program contents that need to be executed in parallel, a parallel start instruction statement is added before the contents that need to be executed in parallel, and a parallel end instruction statement is added at the end of the contents that need to be executed in parallel, and the area between the parallel start instruction statement and the parallel end instruction statement is framed as the parallel statement execution area, and the program area not framed is the serial statement execution area; The compilation phase includes: S2. When compiling the program written in the programming stage, compiling a parallel start instruction statement, a parallel end instruction statement, and a parallel exit instruction statement is added; S3. When compiling the program written in the programming stage, a "parallel flag" dimension is added, and the statement compilation result of the "parallel flag" dimension in the parallel statement execution area is "Yes|parallel", and the statement compilation result in the serial statement execution area is "No|-"; S4. When compiling a program written in the programming stage, a "parallel statement boundary setting type syntax error" is prompted when the parallel start instruction statement and the parallel end instruction statement do not appear in an ordered pair; at the same time, a "parallel statement exit parallel type syntax error" is prompted when the parallel exit instruction statement does not appear in the ordered area of ​​the parallel start instruction statement and the parallel end instruction statement; The execution phase includes: S5, executing the statement contents of the serial statement execution area sequentially, and executing the statement contents of the parallel statement execution area simultaneously and in parallel; S6. During the parallel execution of statements in the parallel statement execution area, when there is a parallel exit instruction statement, the exit condition attached to the parallel exit instruction statement is determined cyclically, and once the condition is met, the current parallel execution area is exited.

2. A method for implementing parallel execution of robot actions according to claim 1, characterized in that: The parallel execution area is set by a parallel start instruction statement and a parallel end instruction statement, wherein the parallel start instruction statement is set to: "parallel start ()"; The parallel end instruction statement is set to: "Parallel end ()"; The parallel exit instruction statement is set to: "Exit parallel (").

3. The method for implementing parallel execution of robot actions according to claim 1, characterized in that: The program content includes conventional programming statements, action state judgment statements and action execution statements; The conventional programming statements are used to implement assignment, jump, loop and function call functions; The action state judgment statement is used to perform the action state judgment function; The action execution statement is used to realize the driving function of the robot execution unit.

4. The method for implementing parallel execution of robot actions according to claim 1, characterized in that: The method further comprises: setting an execution state variable for each action execution statement, and assigning a value to the execution state variable according to whether the action execution is completed or not.

5. The method for implementing parallel execution of robot actions according to claim 1, characterized in that: When the statements in the parallel statement execution area are executed, a parallel flag is established in the parallel statement execution area, the action execution statement with the parallel mark is established in the parallel action linked list, and the action status is monitored; a loop is used to determine whether the action corresponding to each node in the parallel action linked list has been executed, and if completed, it is deleted from the linked list.

Citation Information

Patent Citations

  • Robot programming system

    CN110026983A

  • Grammar checking method applied to industrial robot programming language

    CN112114812A

  • Industrial robot programming language interpretation method

    CN113961195A

  • Robot programming assistance device, robot programming assistance program, and robot programming assistance method

    CN118435163A

  • Parallel processing programming simulator

    JP1993088940A