A method for interpreting industrial robot programming language
By defining custom variable formats and instruction set formats, and using linked lists and identification files for syntax and semantic analysis, the problem of low efficiency of industrial robot programming language interpreters in the existing technology is solved, and fast and accurate robot action execution is achieved, ensuring that Efficient production process is completed.
Patent Information
- Application Number
- CN202111222543.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-10-20
AI Technical Summary
The existing industrial robot programming language interpreters are inefficient and difficult to scale, resulting in complex parsing processes and difficult to achieve fast and accurate robot motion execution.
By defining custom variable formats and instruction set formats, using linked lists to store variable information and identification files to store instruction information, perform syntax and semantic analysis, generate instruction structures and send them to shared memory, achieving rapid interpretation and execution.
It improves the speed and accuracy of programming language interpretation, simplifies the operation process, and ensures that the robot can complete complex production processes efficiently.
Smart Images

Figure CN113961195B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial robots, and in particular to an industrial robot programming language interpretation method. Background Art
[0002] As an important interface for human-computer interaction and an important way for robots to realize their intelligence, robot language has become an indispensable part of robot numerical control systems. The operation of robots depends to a large extent on programs compiled in robot language, and its importance is becoming increasingly prominent.
[0003] Robot language uses symbols to describe the robot's actions, so that the robot can complete various complex actions and operations according to the programmer's intentions. In practical applications, operators can compile more complex programs according to actual needs. Therefore, it is a research direction in the field of industrial robots to accurately interpret programming language symbols, convert robot language symbols into intermediate data according to reasonable rules, and then interpret and process the intermediate data so that the robot can understand the programmer's intentions and complete the required actions. However, there are many types of robot programming instructions, and each type of programming instructions has a large number of instructions. The parsing process is complicated, resulting in low efficiency and difficulty in expansion of existing robot programming language interpreters. Summary of the invention
[0004] The purpose of the present invention is to provide a robot programming language interpretation method, which is simple to operate, fast in parsing speed, high in accuracy, and can dispatch robots to complete complex production processes.
[0005] The technical solution to achieve the purpose of the present invention is: a method for interpreting an industrial robot programming language, comprising the following steps:
[0006] Store variable information in a variable file according to a custom format, input the variable file, parse the variable information in the variable file and store it in the form of a linked list;
[0007] Set corresponding identification for process control instructions, statement type instructions, instructions in instruction set, operators, special symbols, and variables and save them to identification files;
[0008] Edit the program code, input the edited program file, and interpret the program code in the program file into the tag file based on the identification file;
[0009] Perform syntax analysis on the tag file and variable list. If there is a syntax error, prompt it, otherwise proceed to the next step;
[0010] Based on the tag file and variable linked list, the program code is semantically parsed line by line, and finally an instruction structure is generated. The instruction structure is sent to the shared memory, waiting for the controller to command the robot to move.
[0011] Furthermore, the custom format of the variable information is variable name: type: = variable value, and the variable linked list records the name, type, structure and variable value of the variable.
[0012] Furthermore, the program file is edited online through robot teaching, or edited offline through text editing software.
[0013] Furthermore, when editing the program code, the instruction statement format in the instruction set is: CMD (param1, param2, ..., paramN), where CMD is the instruction in the instruction set, param1, param2, ..., paramN are parameters of the instruction, the parameters are custom variables or specific values, and the instruction set includes motion instructions, setting instructions, input and output instructions and system function instructions.
[0014] Furthermore, when editing the program code, the format of the flow control instruction statement is:
[0015] Process
[0016] Instruction Statement
[0017] End_process
[0018] Process is a process control statement, an instruction statement is an instruction in an instruction set, a statement-type instruction, or multiple nested process control instruction statements, and End_process indicates the end.
[0019] Furthermore, the tag file is stored in text lines, and the format of each line is "program code line number, tag 1, [value 1], ..., tag n, [value n] <cr> <lf> ”, <cr> <lf>It is a carriage return and line feed character.
[0020] Furthermore, the syntax parsing of the markup file is to perform syntax checking on each line of statements in the markup file in turn. For process control instruction statements, check whether the expression is legal and whether the instruction statement string is matched; for instructions in the instruction set, check whether the number of parameters is correct and whether the parameter type is legal.
[0021] Furthermore, for the flow control instruction statement, the instruction stack is used to perform semantic analysis on it, and the stack content stores the line number of the instruction and the value of the expression.
[0022] Furthermore, the parsing of statement-type instructions is specifically as follows: operators are stored through the operator stack, variables used in the expression and their initial values are obtained from the variable list, operands are stored through the operand stack, and then the expression is evaluated and stored in the value result stack.
[0023] Furthermore, the first bit of the instruction structure for semantically parsing the instructions in the instruction set is the instruction identifier, followed by the value of the variable used in the instruction, the type of the variable, the number of nodes included, and the value of each node.
[0024] Compared with the prior art, the present invention has the following significant effects: (1) The present invention defines the variable format, the instruction statement format in the instruction set, and the format of the process control instruction statement. Because the grammatical structure is unified, the programming operation is simple and easy to implement; (2) The method of the present invention has a fast parsing speed and can be executed while interpreting, with high execution efficiency; (3) The parsing accuracy of the present invention is high, which can ensure a high degree of safety and can dispatch robots to complete complex production processes. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The figure is an overall flow chart of the method of the present invention.
[0026] Figure 2 The figure is an input-output relationship diagram for each step in the method of the present invention. DETAILED DESCRIPTION
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 are within the scope of protection of the present invention.
[0028] Combination Figure 1 and Figure 2 , the present invention provides a robot programming language interpretation method, comprising:
[0029] Step 1: For a general single instruction, the definition format is:
[0030] CMD(param1, param2,..., paramN)
[0031] Among them, CMD is an instruction in the instruction set, param1, param2, ..., paramN are parameters of the instruction, and the parameters can be user-defined variables or specific values. The instruction set includes motion instructions, setting instructions, input and output instructions, and system function instructions.
[0032] For flow control statements, the definition format is:
[0033] Process
[0034] Instruction Statement
[0035] End_process
[0036] Process is a process control statement such as IF and WHILE. The instruction statement in the middle can be a single instruction, an expression, or multiple nested process statements, and finally ends with End_process.
[0037] Step 2, input the variable file, and store the variable information in the variable file into the custom variable linked list in the computer memory; user-defined variables are stored in the variable file in the format of (variable name: type: = value), and the variable information is stored in the form of a linked list through variable resolution, and the information records the variable name, type, structure and variable value in detail;
[0038] Step 3, input the program file, and interpret the program code (including flow control instructions, statement type instructions and instruction set instructions) in the program file into the tag file;
[0039] Program files can be edited online through teaching, or offline on a computer using text editing software. Each motion instruction, statement instruction, operator, special symbol, and variable has a corresponding identifier, and the identifier method is recorded in a specific file. This interpretation method interprets the instruction statements in the program code into the tag file according to the defined identifier method. The tag file is stored in text lines, and the format of a line is "line number, tag 1, [value 1], ..., tag n, [value n] <cr> <lf> ”, <cr> <lf>It is a carriage return and line feed character.
[0040] Step 4: Input the tag file and variable list, parse the syntax, and prompt if there is an error; this interpretation method performs syntax check on each line of statement in the tag file in turn. For flow control instructions, check whether the expression is legal and whether the instruction statement string is matched; for a single instruction, check whether the number of parameters is correct and whether the parameter type is legal. If there is an error, prompt.
[0041] Step 5, input the tag file and variable linked list, perform semantic checks on each line of statements in the tag file in turn, store the results in the instruction structure, and then send the instruction structure of this statement to the shared memory, waiting for the controller to command the robot to move.
[0042] For process control instructions (mainly including selection instructions, loop instructions, and used in conjunction with instructions in the robot programming instruction set), they are parsed using the instruction stack, and the stack content saves the line number of the instruction and the value of the expression.
[0043] For expression operation statements (statement-type instructions, which are operation expressions), the operator stack is used to store operators, the variables used in the expression and their initial values are obtained from the variable linked list, the operand stack is used to store operands, and then the expression is evaluated, and finally the value result stack is used to store the final result.
[0044] For the motion instructions, setting instructions, input and output instructions and system function instructions in the instruction set, this interpretation method stores the parsing results in the instruction structure. The first bit of the instruction structure is the instruction identifier, followed by the values of the variables used in the instruction. The types of variables are different, and the number of nodes they contain is also different. The value of each node of the variable in the instruction structure will also be recorded in detail.
[0045] The present embodiment provides an industrial robot programming language interpretation method, which establishes a set of calibration methods for most of the instructions in the instruction set (including motion instructions, setting instructions, input and output instructions and system function instructions), process control instructions, operators, special symbols, and variables, and interprets the robot programming language according to the defined identification method. The operator inputs the source program code file through teaching programming or offline programming, and then provides the variable file to be used. The method interprets the motion instruction program code through four steps of variable analysis, lexical analysis, syntax analysis and semantic analysis, and stores the analysis results in the instruction structure. The robot controller reads the structure information to command the robot to move and complete the specified action.
[0046] Example
[0047] This embodiment provides a robot programming language interpretation method, which writes a program file test.tip, in which the program code is:
[0048] PTP(ap0)
[0049] abc:=abc+1
[0050] LOOP 2DO
[0051] Lin(ap0,dyn0)
[0052] END_LOOP
[0053] IF abc>0THEN
[0054] y=2
[0055] ELSE
[0056] y=3
[0057] END_IF
[0058] WaitTime(y)
[0059] The format of the variables involved is: (variable name: type: = value), and the content of the variable file test.tid is as follows:
[0060] ap0:AXISPOS:=(a1:=3.1,a2:=4.2,a3:=5.3,a4:=6.4,a5:=7.5,a6:=8.6)
[0061] dyn0:DYNAMIC:=(50,60,0,0,30,40,0,10)
[0062] abc:DINT CONST:=100
[0063] y:DINT
[0064] The specific interpretation process of the test.tip source program file is as follows:
[0065] (1) Generate a variable linked list programVarList, which stores the names, types, and values of the four variables in the above test.tid.
[0066] (2) The program code of test.tip is interpreted into the tag file test.tmp. The format of each line is "line number, tag 1, [value 1], ..., tag n, [value n]". For example, the first line "PTP (ap0)" is interpreted as "1, 257, 28, 19, ap0, 29", where 1 represents the line number; 257 represents the PTP point-to-point command and has no value; 28 represents the left bracket and has no value; 19 represents the variable and has a value of "ap0"; and 29 represents the right bracket and has no value.
[0067] The contents of the test.tmp tag file are as follows:
[0068] 1,257,,28,,19,ap0,29,
[0069] 2,19,abc,27,,19,abc,41,,16,1
[0070] 3,1545,,16,2,1543,
[0071] 4,258,,28,,19,ap0,22,,19,dyn0,29,
[0072] 5,1546, 6
[0074] 7,1537,,19,abc,32,,16,0,1538,
[0075] 8,19,y,31,,16,2
[0076] 9,1539,
[0077] 10,19,y,31,,16,3
[0078] 11,1541,
[0079] 12,769,,28,,19,y,29, 13
[0081] (3) Check whether the number and type of parameters in the PTP and Lin instructions are legal, check whether the expression in the LOOP is legal, and whether there is a matching END_LOOP statement, check whether the expression in the IF command is legal, and whether the ELSE and END_IF statements are matched. If there is no error, the interpretation process continues to the next step, otherwise the program reports an error.
[0082] (4) Generate an instruction structure, including the PTP command and two Lin commands, the PTP parameter ap0, its type AXISPOS and the values of its nodes a1-a6, the Lin parameter ap0, its type AXISPOS and the values of its nodes a1-a6, the parameter dyn0, its type DYNAMIC and the values of its nodes. The instruction structure is transferred to the shared memory, and the controller is waiting to read the structure information to command the robot's six-axis motion to complete the specified point-to-point and linear motion.< / lf> < / cr> < / lf> < / cr> < / lf> < / cr> < / lf> < / cr>
Claims
1. A method for interpreting an industrial robot programming language, characterized in that: The following steps are involved: Store variable information in a variable file according to a custom format, input the variable file, parse the variable information in the variable file and store it in the form of a linked list; Set corresponding identification for process control instructions, statement type instructions, instructions in instruction set, operators, special symbols, and variables and save them to identification files; Edit the program code, input the edited program file, and interpret the program code in the program file into the tag file based on the identification file; Perform syntax analysis on the tag file and variable list. If there is a syntax error, prompt it, otherwise proceed to the next step; Based on the tag file and variable linked list, the program code is semantically parsed line by line, and finally an instruction structure is generated. The instruction structure is sent to the shared memory, waiting for the controller to command the robot to move.
2. The industrial robot programming language interpretation method according to claim 1, characterized in that: The custom format of the variable information is variable name: type: = variable value, and the variable linked list records the name, type, structure and variable value of the variable.
3. The industrial robot programming language interpretation method according to claim 1, characterized in that: The program file is edited online through robot teaching, or edited offline through text editing software.
4. The industrial robot programming language interpretation method according to claim 1, characterized in that: When editing the program code, the instruction statement format in the instruction set is: CMD (param1, param2, ..., paramN), where CMD is the instruction in the instruction set, param1, param2, ..., paramN are parameters of the instruction, the parameters are custom variables or specific values, and the instruction set includes motion instructions, setting instructions, input and output instructions and system function instructions.
5. The industrial robot programming language interpretation method according to claim 1, characterized in that: When editing the program code, the format of the flow control instruction statement is: Process Instruction Statement End_process Process is a process control statement, an instruction statement is an instruction in an instruction set, a statement-type instruction, or multiple nested process control instruction statements, and End_process indicates the end.
6. The industrial robot programming language interpretation method according to claim 2, characterized in that: The tag file is stored in text lines, and the format of each line is "program code line number, tag 1, [value 1], ..., tag n, [value n] <cr> <lf> ”, <cr> <lf> It is a carriage return and line feed character.< / lf> < / cr> < / lf> < / cr> 7. The industrial robot programming language interpretation method according to claim 1, characterized in that: The syntax parsing of the markup file is to perform syntax checking on each line of statements in the markup file in turn. For process control instruction statements, check whether the expression is legal and whether the instruction statement string is matched; for instructions in the instruction set, check whether the number of parameters is correct and whether the parameter type is legal.
8. The method for interpreting an industrial robot programming language according to claim 1, characterized in that: For flow control instruction statements, the instruction stack is used to perform semantic analysis, and the stack content stores the line number of the instruction and the value of the expression.
9. The industrial robot programming language interpretation method according to claim 1, characterized in that: The specific analysis of statement-type instructions is as follows: the operator is stored in the operator stack, the variables used in the expression and their initial values are obtained from the variable list, the operands are stored in the operand stack, and then the expression is evaluated and stored in the value result stack.
10. The industrial robot programming language interpretation method according to claim 1, characterized in that: The first bit of the instruction structure for semantically parsing instructions in the instruction set is the instruction identifier, followed by the value of the variable used in the instruction, the type of the variable, the number of nodes included, and the value of each node.
