CN111580806A - Collaborative robot graphical programming system - Google Patents
Collaborative robot graphical programming system Download PDFInfo
- Publication number
- CN111580806A CN111580806A CN202010280118.XA CN202010280118A CN111580806A CN 111580806 A CN111580806 A CN 111580806A CN 202010280118 A CN202010280118 A CN 202010280118A CN 111580806 A CN111580806 A CN 111580806A
- Authority
- CN
- China
- Prior art keywords
- primitives
- module
- instruction
- graphical
- library
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明涉及一种图形化编程系统,特别涉及一种协作机器人图形化编程系统。The invention relates to a graphical programming system, in particular to a graphical programming system for a collaborative robot.
背景技术Background technique
目前,目前,随着科学技术的发展与人力成本的提高,越来越多的公司选择用协作机器人代替工人工作。机器人与人交互的核心就是编程系统,现阶段,机器人语言是一种在人与机器之间相互交换信息或者记录信息的程序语言,它与传统的高级语言相似。但是协作机器人更多的是面向非计算机专业的用户,而且需要灵活的编程,传统的机器人语言比较晦涩难懂,而且不利于理解掌握,所以不能广泛的满足用户的编程需求。At present, with the development of science and technology and the increase of labor costs, more and more companies choose to replace workers with collaborative robots. The core of the interaction between robots and humans is the programming system. At this stage, the robot language is a programming language that exchanges or records information between humans and machines. It is similar to traditional high-level languages. However, collaborative robots are more for non-computer professional users, and require flexible programming. The traditional robot language is relatively obscure and difficult to understand, and it is not conducive to understanding and mastering, so it cannot widely meet the programming needs of users.
基于这样的背景下,研究一种直观、简单的编程系统是非常有必要的。为此,开发一种机器人图形化编程可以大大缩短操作者的学习时间,降低协作机器人操作的准入门槛。Based on this background, it is very necessary to study an intuitive and simple programming system. To this end, the development of a robot graphical programming can greatly shorten the operator's learning time and lower the entry threshold for collaborative robot operation.
如申请公布号为CN107972035A,公布日为2018.05.01的中国专利公开了一种工业机器人指令集及其图形化处理方法。包括接收操作指令,对操作指令进行处理,生成图形按钮,图形按钮与动作对应。但是图形化处理得比较简单,各图形化按钮之间的逻辑关系表现得不够清楚,运动中点位信息表达的不清晰,图形化编程的界面不够直观,没有将对应指令集进行编译处理,且没有程序检错的功能。For example, the Chinese patent with the application publication number CN107972035A and the publication date of 2018.05.01 discloses an industrial robot instruction set and a graphical processing method thereof. It includes receiving an operation instruction, processing the operation instruction, and generating a graphic button, and the graphic button corresponds to the action. However, the graphical processing is relatively simple, the logical relationship between the graphical buttons is not clear enough, the point information in the movement is not clearly expressed, the graphical programming interface is not intuitive enough, the corresponding instruction set is not compiled and processed, and There is no program error checking function.
如申请公布号为CN105843630A,公布日为2016.08.10的中国专利公开了一种基于机器人图形化编程开发的方法。包括基于Visual Studio 2012开发的图形化编程模块,可视化交互式仿真环境模块搭建可视化交互式仿真环境,但是基于windows系统下开发的图形化界面不是开源的,目前大部分的示教器基于开源的linux系统下开发,所以通用性比较差,使用Windows系统的成本比较高。For example, the Chinese patent with the application publication number of CN105843630A and the publication date of 2016.08.10 discloses a method based on robot graphical programming development. Including the graphical programming module developed based on Visual Studio 2012, and the visual interactive simulation environment module to build a visual interactive simulation environment, but the graphical interface developed based on the windows system is not open source, and most of the current teaching devices are based on the open source linux It is developed under the system, so the versatility is relatively poor, and the cost of using the Windows system is relatively high.
发明内容SUMMARY OF THE INVENTION
本发明为解决公知技术中存在的技术问题而提供一种开源的且可检错的协作机器人图形化编程系统。The present invention provides an open-source and error-checkable graphical programming system for collaborative robots in order to solve the technical problems existing in the prior art.
本发明为解决公知技术中存在的技术问题所采取的技术方案是:一种协作机器人图形化编程系统,包括人机界面、解释器以及机器人指令集;所述人机界面基于Linux操作系统的QT开发,其设有如下模块:菜单栏模块、工具栏模块、图形化编程模块、图形化接口模块、逻辑模块以及参数编辑模块;所述图形化编程模块用于对机器人指令集进行图形化处理,其包括指令分类库以及对应指令分类库的部件库;所述图形化接口模块用于实现图元操作、触发事件以及事件处理;所述逻辑模块用于规定各图元与函数接口之间以及各图元之间的连接关系;所述参数编辑模块用于实现对图元的信息进行编辑及修改。The technical solution adopted by the present invention to solve the technical problems existing in the known technology is: a graphical programming system for a collaborative robot, including a human-machine interface, an interpreter and a robot instruction set; the human-machine interface is based on the QT of the Linux operating system. development, which is provided with the following modules: a menu bar module, a toolbar module, a graphical programming module, a graphical interface module, a logic module and a parameter editing module; the graphical programming module is used for graphical processing of the robot instruction set, It includes an instruction classification library and a component library corresponding to the instruction classification library; the graphical interface module is used to implement primitive operations, trigger events and event processing; The connection relationship between the primitives; the parameter editing module is used to edit and modify the information of the primitives.
进一步地,所述指令分类库包括运动指令库、逻辑指令库、事件指令库、函数指令库、变量指令库、输入输出指令库;所述运动指令库包括直线运动图元、关节运动图元、圆弧运动图元和速度设置图元;所述逻辑指令库包括判断开始图元、判断结束图元、循环开始图元、循环结束图元;所述事件指令库包括等待图元、停止图元、指令跳转图元;所述函数指令库包括新建函数图元、函数结束图元、函数跳转图元;所述变量指令库包括新建变量图元;所述输入输出指令库包括输入输出指令图元。Further, the instruction classification library includes a motion instruction library, a logic instruction library, an event instruction library, a function instruction library, a variable instruction library, and an input and output instruction library; the motion instruction library includes linear motion primitives, joint motion primitives, Arc motion primitives and speed setting primitives; the logic instruction library includes a judgment start primitive, a judgment end primitive, a cycle start primitive, and a cycle end primitive; the event instruction library includes a wait primitive, a stop primitive , instruction jump primitives; the function instruction library includes new function primitives, function end primitives, and function jump primitives; the variable instruction library includes new variable primitives; the input and output instruction library includes input and output instructions Primitive.
进一步地,所述逻辑模块规定函数接口及对应图元的属性,其中属性包括父节点、第一级子节点和第二级子节点;每个图元依次按照父节点、第一级子节点、第二级子节点的顺序与一个函数接口相对应,当出现图元属性与函数接口不对应时,所述逻辑模块输出错误信息并禁止图元的拖动或编辑。Further, the logic module specifies the function interface and the attributes of the corresponding primitives, wherein the attributes include a parent node, a first-level child node and a second-level child node; The sequence of the second-level sub-nodes corresponds to a function interface. When the primitive attribute does not correspond to the function interface, the logic module outputs an error message and prohibits the dragging or editing of the primitive.
进一步地,所述图形化接口模块包括图元操作子模块、触发事件子模块以及事件处理子模块;其中:Further, the graphical interface module includes a primitive operation sub-module, a trigger event sub-module and an event processing sub-module; wherein:
所述图元操作子模块用于实现对部件库中的图元进行拖动并进行连线的操作;The primitive operation submodule is used to realize the operation of dragging and connecting the primitives in the component library;
所述触发事件子模块用于实现鼠标点击事件及鼠标拖动事件;The trigger event submodule is used to realize a mouse click event and a mouse drag event;
所述事件处理子模块用于用户通过外部输入来编辑移动点位信息或逻辑条件信息。The event processing sub-module is used by the user to edit the moving point information or logic condition information through external input.
进一步地,所述图形化接口模块通过QT中的QmouseEvent鼠标事件和QDrag拖动事件实现,并在QmouseMoveEvent的鼠标事件启动拖动。Further, the graphical interface module is implemented through the QmouseEvent mouse event and the QDrag drag event in QT, and starts dragging in the QmouseMoveEvent mouse event.
进一步地,所述解释器包括词法分析器、语法分析器和语义分析器。Further, the interpreter includes a lexical analyzer, a syntax analyzer and a semantic analyzer.
进一步地,所述词法分析器,根据机器人语言规则,对每条指令按关键字、标识符、常量进行划分,生成单词符号对照表,使每一个单词都有对应的标号值及属性值;所述词法分析器创建一个类的对象来保存对应单词的编号值与属性值,用于语法分析器的调用。Further, the lexical analyzer, according to the robot language rules, divides each instruction according to keywords, identifiers, and constants, and generates a word symbol comparison table, so that each word has a corresponding label value and attribute value; The predicate lexical analyzer creates an object of a class to store the number value and attribute value of the corresponding word for the invocation of the parser.
进一步地,所述语法分析器采用上下文无关文法的语法规则,将词法分析器处理后的单词编号值进行处理,将编号值存入到编号表中,利用BNF式文法形成一系列表达式,利用这些表达式形成语法树,最后对语法树进行遍历,形成目标代码。Further, the grammatical analyzer adopts the grammatical rules of context-free grammar, and the word number value after the lexical analyzer is processed is processed, and the numbered value is stored in the numbering table, and a series of expressions is formed by utilizing the BNF-style grammar, utilizing These expressions form a syntax tree, and finally the syntax tree is traversed to form the object code.
进一步地,所述图形化编程模块将所有的图元尺寸统一为相同尺寸,将程序编辑区域划分为图元大小的网格,当在程序编辑区域有图元时,使图元自动寻找最近的网格区域放置。Further, the graphical programming module unifies all the primitive sizes into the same size, divides the program editing area into grids of the primitive size, and when there are primitives in the program editing area, makes the primitives automatically find the nearest Grid area placement.
进一步地,还包括通信模块,所述通信模块基于TCP通讯协议,实现所述人机界面和下位机之间的数据传输。Further, a communication module is also included, and the communication module realizes data transmission between the man-machine interface and the lower computer based on the TCP communication protocol.
本发明具有的优点和积极效果是:本发明的一种基于图形化的机器人编程系统,其具有编程简单、使用门槛低、编程效率高等特点。使用图像化编程界面可以有效提高编程的效率,有效地降低了编程人员的编程量,也有效的提高了编程的可读性,便于编程人员对已有程序进行修改。The advantages and positive effects of the present invention are: a graphical-based robot programming system of the present invention has the characteristics of simple programming, low use threshold and high programming efficiency. Using the graphical programming interface can effectively improve the efficiency of programming, effectively reduce the programming amount of programmers, and effectively improve the readability of programming, which is convenient for programmers to modify existing programs.
本发明的人机界面基于LINUX下QT进行开发的,由于LINUX系统的开源的特点,大大的节省了机器人厂家的成本,使用FLEX和BISON基于LINUX下C语言开发的解释器,可移植性高,可以将本系统用于不同的机器人厂家,只需要修改机器人指令集与目标代码。The human-machine interface of the present invention is developed based on QT under LINUX. Due to the open source feature of the LINUX system, the cost of the robot manufacturer is greatly saved. The interpreter developed by FLEX and BISON based on the C language under LINUX has high portability. This system can be used for different robot manufacturers, only need to modify the robot instruction set and target code.
附图说明Description of drawings
图1是本发明的一种应用流程图;Fig. 1 is a kind of application flow chart of the present invention;
图2是本发明的一种人机界面的显示界面图;Fig. 2 is a display interface diagram of a man-machine interface of the present invention;
图3是本发明的一种开发流程图;Fig. 3 is a kind of development flow chart of the present invention;
图4是本发明的一种解释器的开发流程图。FIG. 4 is a development flow chart of an interpreter of the present invention.
图中:1、菜单栏;2、工具栏;3、指令库;4、编程区。In the figure: 1. Menu bar; 2. Toolbar; 3. Instruction library; 4. Programming area.
具体实施方式Detailed ways
为能进一步了解本发明的发明内容、特点及功效,兹列举以下实施例,并配合附图详细说明如下:In order to further understand the content of the invention, features and effects of the present invention, the following embodiments are listed herewith, and are described in detail as follows in conjunction with the accompanying drawings:
请参见图1至图4,一种协作机器人图形化编程系统,包括人机界面、解释器以及机器人指令集;所述人机界面基于Linux操作系统的QT开发,其设有如下模块:菜单栏模块、工具栏模块、图形化编程模块、图形化接口模块、逻辑模块以及参数编辑模块;所述图形化编程模块用于对机器人指令集进行图形化处理,其包括指令分类库以及对应指令分类库的部件库;用图元表示指令分类库中的指令,以及用图元表示部件库中的部件。Please refer to FIG. 1 to FIG. 4 , a graphical programming system for a collaborative robot, including a human-machine interface, an interpreter, and a robot instruction set; the human-machine interface is developed based on the QT of the Linux operating system, and is provided with the following modules: a menu bar module, toolbar module, graphical programming module, graphical interface module, logic module and parameter editing module; the graphical programming module is used to perform graphical processing on the robot instruction set, which includes an instruction classification library and a corresponding instruction classification library The component library of ; use the primitive to represent the instructions in the instruction classification library, and use the primitive to represent the components in the component library.
所述图形化接口模块用于实现图元操作、触发事件以及事件处理;所述逻辑模块用于规定各图元与函数接口之间以及各图元之间的连接关系;所述参数编辑模块用于实现对图元的信息进行编辑及修改。本发明的人机界面利用Linux开源操作系统和QT图形开发工具作为开发环境进行搭建;基于linux系统开发的图形界面可以经过交叉编译适用于其他嵌入式示教器上使用,兼容性较强。The graphical interface module is used to implement primitive operations, trigger events and event processing; the logic module is used to specify the connection relationship between each graphic element and the function interface and between each graphic element; the parameter editing module uses It is used to edit and modify the information of primitives. The man-machine interface of the present invention is constructed by using the Linux open source operating system and the QT graphic development tool as the development environment; the graphic interface developed based on the Linux system can be cross-compiled and suitable for use on other embedded teaching devices, with strong compatibility.
在菜单栏1可以进行新建文件、保存文件、运行程序、查看版本内容等操作,也可以在工具栏2点击对应图标进行这些操作,图形化编程模块可以点击对应的模块图元,调用不同的编程图元。将指令库3的图元拖入编程区4可以进行机器人程序的编程。In the
采用本系统可新建一个图形编程的工程,选择指令分类库,可以选择调用对应的不同属性的部件库,拖动不同部件库中的图元,会调用不同的函数接口,拖动或者点击时会触发不同的事件,拖动图元会触发拖动事件,可以对图元进行拖动,双击图元会触发鼠标事件,对特定的图元会生成编辑界面。Using this system, you can create a new graphic programming project, select the instruction classification library, you can choose to call the corresponding component library with different attributes, drag the primitives in different component libraries, different function interfaces will be called, and when you drag or click, the Trigger different events, dragging a primitive will trigger a drag event, you can drag the primitive, double-clicking the primitive will trigger a mouse event, and an editing interface will be generated for a specific primitive.
逻辑模块规定了各图元拼接的规则,比如逻辑判断图元在结束的时候要有逻辑判断结束图元,确保逻辑判断语句的范围;逻辑循环图元在结束的时候要有逻辑循环结束图元,确保逻辑循环语句的范围;新建函数图元在结束时要有新建函数结束图元,确保新建函数的范围;新建变量图元不能在上述逻辑判断结束图元、逻辑循环图元以及新建函数图元的图元内部调用;函数跳转图元要在新建函数图元之后调用;停止图元不能在程序开始调用;死循环中不允许调用其他循环、判断语句;循环中不能新建函数等。The logic module specifies the rules for the splicing of each graphic element. For example, when the logical judgment graphic element ends, there must be a logical judgment end graphic element to ensure the scope of the logical judgment statement; the logical loop graphic element must have a logical loop end graphic element when it ends. , to ensure the scope of the logical loop statement; the new function primitive must have a new function end primitive at the end to ensure the scope of the new function; the new variable primitive cannot be in the above logic judgment end primitive, logical loop primitive and new function diagram Internal call of primitive primitives; function jump primitives should be called after creating function primitives; stop primitives cannot be called at the beginning of the program; other loops and judgment statements cannot be called in infinite loops; functions cannot be created in loops, etc.
在图形化编程界面中为了避免出现拖动图元出现重叠的现象,可将所有的图元尺寸统一为相同尺寸,将程序编辑区域划分为图元大小的网格,当在程序编辑区域有图元时,图元会自动寻找最近的网格区域放置。In the graphical programming interface, in order to avoid the phenomenon of overlapping the dragged primitives, the size of all primitives can be unified to the same size, and the program editing area is divided into grids of the size of the primitives. When the element is selected, the element will automatically find the nearest grid area to place it.
进一步地,所述指令分类库可包括运动指令库、逻辑指令库、事件指令库、函数指令库、变量指令库、输入输出指令库;所述运动指令库可包括直线运动图元、关节运动图元、圆弧运动图元和速度设置图元;所述逻辑指令库可包括判断开始图元、判断结束图元、循环开始图元、循环结束图元;所述事件指令库可包括等待图元、停止图元、指令跳转图元;函数指令库可包括新建函数图元、函数结束图元、函数跳转图元;变量指令库可包括新建变量图元;输入输出指令库可包括输入输出指令图元。Further, the instruction classification library may include a motion instruction library, a logic instruction library, an event instruction library, a function instruction library, a variable instruction library, and an input and output instruction library; the motion instruction library may include linear motion primitives, joint motion diagrams primitives, arc motion primitives and speed setting primitives; the logic instruction library may include judgment start primitives, judgment end primitives, loop start primitives, and loop end primitives; the event instruction library may include wait primitives , stop primitives, instruction jump primitives; function instruction library may include new function primitives, function end primitives, function jump primitives; variable instruction library may include new variable primitives; input and output instruction library may include input and output primitives Command primitive.
进一步地,所述逻辑模块可规定函数接口及对应图元的属性,其中属性可包括父节点、第一级子节点和第二级子节点;每个图元可依次按照父节点、第一级子节点、第二级子节点的顺序与一个函数接口相对应,当出现图元属性与函数接口不对应时,所述逻辑模块可输出错误信息并禁止图元的拖动或编辑。输出错误信息在编程界面上进行显示,提示操作者改正。这样,图形界面中每一个图元对应各自的函数接口,这样拖动一个图元会调用相对应的函数接口而不需要遍历、查找,大大提高了图元解析的速度;图形化编程界面加入了检错与错误处理功能,用户可以根据提示进行错误排查,提高了图形化编程的准确性和编程速度。Further, the logic module can specify the function interface and the attributes of the corresponding primitives, wherein the attributes can include a parent node, a first-level child node and a second-level child node; The order of the child nodes and the second-level child nodes corresponds to a function interface. When a primitive attribute does not correspond to the function interface, the logic module can output an error message and prohibit the dragging or editing of the primitive. The output error message is displayed on the programming interface, prompting the operator to correct it. In this way, each primitive in the graphical interface corresponds to its own function interface, so dragging a primitive will call the corresponding function interface without traversing and searching, which greatly improves the speed of primitive parsing; the graphical programming interface adds With the function of error detection and error handling, users can check errors according to the prompts, which improves the accuracy and programming speed of graphical programming.
图形化接口模块可实现图元操作、触发事件、事件状态分析、错误处理、事件处理等功能。图元的操作指的是对部件库中的图元进行拖动并进行连线的操作;触发的事件主要为鼠标点击事件、鼠标拖动事件,分为单击与双击事件以及拖动事件;事件状态分析指的是确定鼠标事件是否已经触发;错误处理指的是图元的操作与事件的触发是否符合接口逻辑;事件处理指的是用户通过外部输入可以编辑点位信息、条件信息。点位信息为坐标信息,条件信息包括逻辑关系、输入输出、跳转位置。The graphical interface module can realize the functions of primitive operation, trigger event, event state analysis, error handling, event handling and so on. The operation of primitives refers to the operation of dragging and connecting the primitives in the component library; the triggered events are mainly mouse click events and mouse drag events, which are divided into click and double-click events and drag events; Event state analysis refers to determining whether the mouse event has been triggered; error handling refers to whether the operation of the graphic element and the triggering of the event conform to the interface logic; event processing refers to the user can edit point information and condition information through external input. The point information is coordinate information, and the condition information includes logical relationship, input and output, and jumping position.
优选地,所述图形化接口模块可包括图元操作子模块、触发事件子模块、事件状态分析子模块、事件处理子模块以及错误处理子模块等;其中:Preferably, the graphical interface module may include a primitive operation submodule, a trigger event submodule, an event state analysis submodule, an event processing submodule, an error processing submodule, etc.; wherein:
所述图元操作子模块用于实现对部件库中的图元进行拖动并进行连线的操作;The primitive operation submodule is used to realize the operation of dragging and connecting the primitives in the component library;
所述触发事件子模块用于实现鼠标点击事件及鼠标拖动事件;The trigger event submodule is used to realize a mouse click event and a mouse drag event;
所述事件状态分析子模块可用于判断图元当前状态是否满足处理的条件。The event state analysis submodule can be used to judge whether the current state of the graphic element satisfies the processing conditions.
所述事件处理子模块用于用户通过外部输入来编辑移动点位信息或逻辑条件信息。The event processing sub-module is used by the user to edit the moving point information or logic condition information through external input.
所述错误处理子模块可用于检知图元的操作与事件的触发是否符合接口逻辑。The error handling sub-module can be used to detect whether the operation of the primitive and the triggering of the event conform to the interface logic.
优选地,所述图形化接口模块可通过QT中的QmouseEvent鼠标事件和QDrag拖动事件实现,并在QmouseMoveEvent的鼠标事件启动拖动。采用在QmouseMoveEvent的鼠标事件启动拖动的,而不是在QmousePressEvent的鼠标事件中启用,这样做的好处是只有在鼠标点击不放并移动过程才会拖动图元,避免操作过程中误点而产生的拖动。QmouseEvent、QmouseMoveEvent、QDrag、QmousePressEvent均为QT的指令。Preferably, the graphical interface module can be implemented by the QmouseEvent mouse event and the QDrag drag event in QT, and the dragging is started in the mouse event of QmouseMoveEvent. The drag is started in the mouse event of QmouseMoveEvent instead of in the mouse event of QmousePressEvent. The advantage of this is that the primitive will be dragged only when the mouse is clicked and moved, avoiding the error caused by the wrong click during the operation. drag. QmouseEvent, QmouseMoveEvent, QDrag, QmousePressEvent are all QT commands.
编写完成的源程序进入解释器进行处理,由解释器完成词法分析、语法分析及语义分析,将源代码翻译成可以运行的脚本代码。解释器可具有检错和错误处理功能,对图形化编程中在编辑界面中输入的信息进行检错,如果出现错误,对应的编辑界面的图元会出现错误提示。The written source program enters the interpreter for processing, and the interpreter completes lexical analysis, syntax analysis and semantic analysis, and translates the source code into runnable script code. The interpreter can have the function of error detection and error processing, which can detect errors in the information input in the editing interface in the graphical programming.
进一步地,所述解释器可包括词法分析器、语法分析器和语义分析器。Further, the interpreter may include a lexical analyzer, a syntax analyzer and a semantic analyzer.
所述词法分析器,可根据机器人语言规则,对每条指令按关键字、标识符、常量进行划分,生成单词符号对照表,可使每一个单词都有对应的标号值及属性值;所述词法分析器可创建一个类的对象来保存对应单词的编号值与属性值,用于语法分析器的调用。词法分析器对传入的单词进行词法检错,如果没有定义的单词会传给错误处理模块,经过错误处理后返回给人机界面显示出来。The lexical analyzer can divide each instruction by keywords, identifiers and constants according to the robot language rules, and generate a word symbol comparison table, so that each word can have a corresponding label value and attribute value; the The lexical analyzer can create a class object to save the number value and attribute value of the corresponding word for the invocation of the lexical analyzer. The lexical analyzer performs lexical error detection on the incoming words. If there is no defined word, it will be passed to the error processing module, and after error processing, it will be returned to the human interface for display.
所述语法分析器可采用上下文无关文法的语法规则,将词法分析器处理后的单词编号值进行处理,可将编号值存入到编号表中,可利用BNF式文法形成一系列表达式,利用这些表达式形成语法树,最后对语法树进行遍历,形成目标代码。语法分析器会进行语法错误检查,如果语法出现错误,会调用错误处理模块,错误信息将会在人机界面上显示出来。BNF中文释义为巴科斯范式(BNF:Backus-Naur Form的缩写),其是由John Backus和PeterNaur首先引入的用来描述计算机语言语法的符号集。The grammatical analyzer can adopt the grammatical rules of the context-free grammar, process the word number value processed by the lexical analyzer, store the number value in the number table, and use the BNF grammar to form a series of expressions. These expressions form a syntax tree, and finally the syntax tree is traversed to form the object code. The syntax analyzer will check the syntax errors. If there is an error in the syntax, the error handling module will be called, and the error message will be displayed on the man-machine interface. The Chinese interpretation of BNF is Backus Normal Form (BNF: Abbreviation of Backus-Naur Form), which is a set of symbols first introduced by John Backus and Peter Naur to describe the grammar of computer languages.
语义分析器可依照语法制导的编译原理,对所有的机器人语句,都编辑成与机器人语句对应的语义子程序,语法分析的指令跟语义子程序匹配后,可将语法分析器生成的中间代码编译成机器人能够识别的脚本代码。The semantic analyzer can edit all robot statements into semantic subprograms corresponding to the robot statements according to the syntax-guided compilation principle. After the syntax analysis instructions match the semantic subprograms, the intermediate code generated by the syntax analyzer can be compiled. into a script code that the robot can recognize.
解释器的流程图可如图4所示,因为图形化程序不能直接通过解释器进行编译,所以编辑生成的图形化程序会自动生成一个由语句构成的源程序,源程序会通过解释器进行编译,生成机器人工作的脚本语言。The flowchart of the interpreter can be shown in Figure 4. Because the graphical program cannot be compiled directly through the interpreter, the graphical program generated by editing will automatically generate a source program composed of statements, and the source program will be compiled through the interpreter. , a scripting language that generates robot jobs.
首先解释器对源程序进行词法分析,词法分析会进行错误检查,如果出现错误会进行错误处理,并返回给人机界面,用户可以清楚地了解程序错误位置,如果没有错误会生成中间代码A。First, the interpreter performs lexical analysis on the source program. The lexical analysis will perform error checking. If there is an error, it will perform error processing and return it to the human interface. The user can clearly understand the location of the program error. If there is no error, the intermediate code A will be generated.
中间代码会继续进入语法分析器,语法分析会进行错误检查,如果出现错误进行错误处理,并将错误返回给人机界面,如果没有错误会形成中间代码B。The intermediate code will continue to enter the parser, and the syntax analysis will perform error checking. If there is an error, it will handle the error and return the error to the human interface. If there is no error, the intermediate code B will be formed.
进一步的中间代码B会进行语义分析,并将中间代码B编译成可以供机器人运动的脚本代码。Further intermediate code B will perform semantic analysis and compile intermediate code B into script code that can be used by the robot to move.
进一步地,所述机器人指令集可包括运动语句、逻辑语句、事件语句、函数语句、变量语句及输入输出语句;所述运动语句可包括直线运动语句、关节运动语句及圆弧运动语句;所述逻辑语句可包括if语句、while语句及结束语句;所述事件语句可包括延迟语句、跳转语句及停止语句;所述函数语句可包括新建函数语句、调用函数语句以及函数结束语句;所述变量语句可包括int语句、double语句以及string语句;所述输入输出语句可包括基础IO语句及扩展IO语句等。Further, the robot instruction set may include motion statements, logic statements, event statements, function statements, variable statements, and input/output statements; the motion statements may include linear motion statements, joint motion statements, and arc motion statements; the The logic statement may include an if statement, a while statement, and an end statement; the event statement may include a delay statement, a jump statement, and a stop statement; the function statement may include a new function statement, a call function statement, and a function end statement; the variable Statements may include int statements, double statements, and string statements; the input and output statements may include basic IO statements, extended IO statements, and the like.
进一步地,本系统还可包括通信模块,所述通信模块可基于TCP通讯协议,实现所述人机界面和下位机之间的数据传输。Further, the system may further include a communication module, and the communication module may realize data transmission between the man-machine interface and the lower computer based on the TCP communication protocol.
经过解释器编译完成的脚本代码,会通过通信模块传到下位机,下位机接收到脚本代码后可以运行程序。The script code compiled by the interpreter will be transmitted to the lower computer through the communication module, and the lower computer can run the program after receiving the script code.
下面以本发明的一个优选实施例来进一步说明本发明的工作方法及工作原理:The working method and working principle of the present invention are further described below with a preferred embodiment of the present invention:
本发明的一种图形化编程系统,包括机器人指令集、人机界面、解释器和通信模块。A graphical programming system of the present invention includes a robot instruction set, a man-machine interface, an interpreter and a communication module.
其中,机器人指令集包括直线运动(movel)、关节运动(movej)、圆弧运动(movec)、速度设定语句(set_v)、if语句、while语句、等待指令(wait)、停止指令(stop)、跳转指令(jump)、新建函数指令(fun)、函数跳转指令(fun jump)新建变量指令(var)、以及输入输出指令(in/out)等各种指令。人机界面包括主菜单、工具栏2、编程模块、程序显示区,其中部件库与运动指令集相对应。Among them, the robot instruction set includes linear motion (movel), joint motion (movej), arc motion (movec), speed setting statement (set_v), if statement, while statement, waiting instruction (wait), stop instruction (stop) , jump instruction (jump), new function instruction (fun), function jump instruction (fun jump), new variable instruction (var), and input and output instruction (in/out) and other instructions. The man-machine interface includes a main menu, a
在linux系统下通过交叉编译会生成可以在示教器运行的可执行文件,本发明是基于HTQ的交叉编译环境下测试的,在示教器上执行一个脚本文件,开机会直接调用生成的可执行文件,图形化编程界面会在示教器上显示。Under the linux system, an executable file that can be run on the teach pendant will be generated through cross-compilation. The present invention is tested in the HTQ-based cross-compilation environment. When a script file is executed on the teach pendant, the generated executable file will be directly invoked at startup. Execute the file, and the graphical programming interface will be displayed on the teach pendant.
在菜单栏1点击新建文件或者点击工具栏2里的新建按钮可以新建一个机器人程序,点击运动指令库调用机器人的指令部件库,拖动其中的图元到编程界面,如点击编程界面中的直线运动图元,可以在直线运动编辑界面进行点位信息的编辑,手动移动协作机器人到第一个点,点击示教按钮,此时点位信息中的起始点为示教点坐标信息,手动输入终止点的坐标信息,点击确定,程序会自动生成对应的父节点,一级子节点,二级子节点,源程序文件里就会产生直线运动对应的指令。同样的方式可以对机器人指令进行编辑,源程序文件也会形成相对应的指令。Click the new file in the
在编程界面可以对图元及图形化界面比如按钮等进行拖动,并可以进行连线操作,各图形化按钮之间存在逻辑关系,如果拖动的图形化按钮不符合逻辑关系,拖动的图形按钮会返回原位置或者连线报错。In the programming interface, you can drag primitives and graphical interfaces such as buttons, and you can perform connection operations. There is a logical relationship between the graphical buttons. If the dragged graphical button does not conform to the logical relationship, the dragged The graphic button will return to its original position or a connection error will be reported.
点击编译按钮,源文件中会进行编译,将对应的机器人指令集编译成机器人可以识别的脚本指令,此模块是存在于界面后台的,编程人员只需要进行图形化编程,脚本语言是自动生成的。为了提高该系统的适用性,只需要修改机器人指令集与脚本代码,该图形化编程系统可以适用于大部分的机器人。Click the compile button, the source file will be compiled, and the corresponding robot instruction set will be compiled into script instructions that the robot can recognize. This module exists in the background of the interface. The programmer only needs to perform graphical programming, and the script language is automatically generated. . In order to improve the applicability of the system, it is only necessary to modify the robot instruction set and script code, and the graphical programming system can be applied to most robots.
解释器首先对图形化界面形成的源代码进行词法分析,词法分析的过程是首先源程序按换行符进行分割,每个换行符之间为一条语句,将每条语句存到输入缓存区,词法分析器会读取字符,如果和词法分析器定义的关键字匹配,则会输出单词,比如movej为我们定义的一个关键字,如果程序语句中有匹配,则该关键字会输出,并有属性值,标号值,在词法分析器里将运动指令的关键字的属性值我们设为0,movej的标号值为1,movel标号值为2,movec编号值为3,逻辑语句的属性值为2,标号值从0开始类推,同理可以设定其他语句的属性值和标号值。每完成一条语句的分析后,输入缓存区会关闭,当有下一条语句输入时,会开辟一个新的输入缓存区,直到所有的语句全部完成词法分析。对无法识别的单词进行错误处理。实际上错误处理的功能在图形化界面上是用不到的,因为我们已经将图形化界面与关键词都对应好了,但是错误处理功能是很有用的,这可以将该解释器用于非图形化界面。The interpreter first performs lexical analysis on the source code formed by the graphical interface. The process of lexical analysis is to first divide the source program according to newline characters. Each newline character is a statement, and each statement is stored in the input buffer area. The analyzer will read characters. If it matches the keyword defined by the lexical analyzer, it will output the word, such as a keyword defined by movej for us. If there is a match in the program statement, the keyword will be output and have attributes Value, label value, in the lexical analyzer, we set the attribute value of the keyword of the motion instruction to 0, the label value of movej is 1, the label value of movej is 2, the value of movec number is 3, and the attribute value of the logic statement is 2 , the label value starts from 0 and so on. Similarly, the attribute value and label value of other statements can be set. After the analysis of each statement is completed, the input buffer area will be closed. When the next statement is input, a new input buffer area will be opened until all statements have completed lexical analysis. Error handling of unrecognized words. In fact, the function of error handling is not used in the graphical interface, because we have already mapped the graphical interface to the keywords, but the error handling function is very useful, which can be used for non-graphical interpreters. interface.
经过词法分析的单词流会进行语法分析,语法分析的过程是提取单词流中的单词序列号和单词标号,进行序列号和单词标号的匹配,然后通过定义的语法规则,例如通过BISON定义关键字运动(movej/movel/movec)的后面只能跟点位信息,如果匹配失败则进行错误处理。经过语法分析的中间代码会经过语义分析。BISON是一种通用解析器生成器。The word stream that has undergone lexical analysis will be grammatically analyzed. The process of grammatical analysis is to extract the word sequence number and word label in the word stream, match the sequence number and word label, and then define keywords through defined grammar rules, such as BISON. Movement (movej/movel/movec) can only be followed by point information, and if the match fails, error handling will be performed. The intermediate code that has undergone syntax analysis will undergo semantic analysis. BISON is a generic parser generator.
上述生成的脚本代码经过通信模块,通过基于TCP协议的通信模块,在程序中将图形界面的ip地址和端口号和下位机一致,则可以将脚本代码传给下位机,机器人就可以根据编写的程序对应的执行运动。The script code generated above passes through the communication module, and through the communication module based on the TCP protocol, in the program, the ip address and port number of the graphical interface are consistent with the lower computer, then the script code can be passed to the lower computer, and the robot can be written according to the script code. The execution motion corresponding to the program.
以上所述的实施例仅用于说明本发明的技术思想及特点,其目的在于使本领域内的技术人员能够理解本发明的内容并据以实施,不能仅以本实施例来限定本发明的专利范围,即凡本发明所揭示的精神所作的同等变化或修饰,仍落在本发明的专利范围内。The above-mentioned embodiments are only used to illustrate the technical idea and characteristics of the present invention, and the purpose is to enable those skilled in the art to understand the content of the present invention and implement them accordingly, and the present invention cannot be limited only by the present embodiment. The patent scope, that is, all equivalent changes or modifications made to the spirit disclosed in the present invention, still fall within the patent scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010280118.XA CN111580806A (en) | 2020-04-10 | 2020-04-10 | Collaborative robot graphical programming system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010280118.XA CN111580806A (en) | 2020-04-10 | 2020-04-10 | Collaborative robot graphical programming system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111580806A true CN111580806A (en) | 2020-08-25 |
Family
ID=72113023
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010280118.XA Pending CN111580806A (en) | 2020-04-10 | 2020-04-10 | Collaborative robot graphical programming system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111580806A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527256A (en) * | 2020-12-16 | 2021-03-19 | 北京中水科水电科技开发有限公司 | Integrated hydropower station model development system and method |
CN112764899A (en) * | 2021-01-20 | 2021-05-07 | 深圳橙子自动化有限公司 | Method and device for processing visual task based on application program |
CN113495725A (en) * | 2021-06-08 | 2021-10-12 | 山西三友和智慧信息技术股份有限公司 | Artificial intelligence visual programming tool system based on big data |
CN113674585A (en) * | 2021-08-18 | 2021-11-19 | 杭州优必学科技有限公司 | Programming learning machine system |
CN113741882A (en) * | 2021-09-16 | 2021-12-03 | 杭州分叉智能科技有限公司 | RPA graphical instruction design method |
CN113778414A (en) * | 2021-11-11 | 2021-12-10 | 深圳市越疆科技有限公司 | Machine vision communication script generation method and device based on graphical programming |
CN114185532A (en) * | 2022-02-15 | 2022-03-15 | 武汉慧联无限科技有限公司 | Graphical programming system |
CN114237585A (en) * | 2021-12-22 | 2022-03-25 | 中国长江三峡集团有限公司 | PLC ladder diagram editing method based on scene view structure |
CN114610293A (en) * | 2022-03-24 | 2022-06-10 | 上海节卡机器人科技有限公司 | A custom instruction development method and data interaction framework |
CN115061673A (en) * | 2022-08-18 | 2022-09-16 | 湖南云畅网络科技有限公司 | Low-code visual expression based arranging and executing method and system |
CN117421251A (en) * | 2023-12-18 | 2024-01-19 | 武汉天喻信息产业股份有限公司 | Method and system for debugging user interface of embedded terminal |
WO2024041081A1 (en) * | 2022-08-22 | 2024-02-29 | 腾讯科技(深圳)有限公司 | Data processing method, apparatus and device, and readable storage medium |
CN118626075A (en) * | 2022-03-10 | 2024-09-10 | 重庆唯哲科技有限公司 | Development and upgrade method of graphic programming cloud platform based on graphic primitives |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1997011416A1 (en) * | 1995-09-19 | 1997-03-27 | Kabushiki Kaisha Yaskawa Denki | Robot language processor |
CN104503754A (en) * | 2014-12-16 | 2015-04-08 | 江南大学 | Programming and compiling design method in robot graphical programming system |
CN105843630A (en) * | 2016-06-08 | 2016-08-10 | 江西洪都航空工业集团有限责任公司 | Method for graphical programming development based on robot |
CN106406890A (en) * | 2016-09-23 | 2017-02-15 | 江西洪都航空工业集团有限责任公司 | A method of constructing robot modules by using multiple languages |
CN108406764A (en) * | 2018-02-02 | 2018-08-17 | 上海大学 | Intelligence style of opening service robot operating system and method |
CN109605366A (en) * | 2018-11-09 | 2019-04-12 | 中科新松有限公司 | Robot graphic programming interactive system and robot |
-
2020
- 2020-04-10 CN CN202010280118.XA patent/CN111580806A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1997011416A1 (en) * | 1995-09-19 | 1997-03-27 | Kabushiki Kaisha Yaskawa Denki | Robot language processor |
CN104503754A (en) * | 2014-12-16 | 2015-04-08 | 江南大学 | Programming and compiling design method in robot graphical programming system |
CN105843630A (en) * | 2016-06-08 | 2016-08-10 | 江西洪都航空工业集团有限责任公司 | Method for graphical programming development based on robot |
CN106406890A (en) * | 2016-09-23 | 2017-02-15 | 江西洪都航空工业集团有限责任公司 | A method of constructing robot modules by using multiple languages |
CN108406764A (en) * | 2018-02-02 | 2018-08-17 | 上海大学 | Intelligence style of opening service robot operating system and method |
CN109605366A (en) * | 2018-11-09 | 2019-04-12 | 中科新松有限公司 | Robot graphic programming interactive system and robot |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527256A (en) * | 2020-12-16 | 2021-03-19 | 北京中水科水电科技开发有限公司 | Integrated hydropower station model development system and method |
CN112764899A (en) * | 2021-01-20 | 2021-05-07 | 深圳橙子自动化有限公司 | Method and device for processing visual task based on application program |
CN113495725A (en) * | 2021-06-08 | 2021-10-12 | 山西三友和智慧信息技术股份有限公司 | Artificial intelligence visual programming tool system based on big data |
CN113674585A (en) * | 2021-08-18 | 2021-11-19 | 杭州优必学科技有限公司 | Programming learning machine system |
CN113741882B (en) * | 2021-09-16 | 2024-03-26 | 杭州分叉智能科技有限公司 | RPA graphical instruction design method |
CN113741882A (en) * | 2021-09-16 | 2021-12-03 | 杭州分叉智能科技有限公司 | RPA graphical instruction design method |
CN113778414A (en) * | 2021-11-11 | 2021-12-10 | 深圳市越疆科技有限公司 | Machine vision communication script generation method and device based on graphical programming |
CN114237585A (en) * | 2021-12-22 | 2022-03-25 | 中国长江三峡集团有限公司 | PLC ladder diagram editing method based on scene view structure |
CN114185532A (en) * | 2022-02-15 | 2022-03-15 | 武汉慧联无限科技有限公司 | Graphical programming system |
CN118626075A (en) * | 2022-03-10 | 2024-09-10 | 重庆唯哲科技有限公司 | Development and upgrade method of graphic programming cloud platform based on graphic primitives |
CN114610293A (en) * | 2022-03-24 | 2022-06-10 | 上海节卡机器人科技有限公司 | A custom instruction development method and data interaction framework |
CN115061673A (en) * | 2022-08-18 | 2022-09-16 | 湖南云畅网络科技有限公司 | Low-code visual expression based arranging and executing method and system |
WO2024041081A1 (en) * | 2022-08-22 | 2024-02-29 | 腾讯科技(深圳)有限公司 | Data processing method, apparatus and device, and readable storage medium |
CN117421251A (en) * | 2023-12-18 | 2024-01-19 | 武汉天喻信息产业股份有限公司 | Method and system for debugging user interface of embedded terminal |
CN117421251B (en) * | 2023-12-18 | 2024-03-19 | 武汉天喻信息产业股份有限公司 | Method and system for debugging user interface of embedded terminal |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111580806A (en) | Collaborative robot graphical programming system | |
US8726233B1 (en) | System and method of using an active link in a state programming environment to locate an element | |
JP4195479B2 (en) | Incremental generation system | |
US7949995B2 (en) | Visual programming method | |
CN106776343A (en) | A kind of web application automated test tool and method | |
JPH02272645A (en) | Method for supporting program debugging | |
JP5147240B2 (en) | Method and system for reversible design tree transformation | |
CN107391222A (en) | The code execution method and device of a kind of process visualization | |
Vegdahl | Using visualization tools to teach compiler design | |
Laffra et al. | HotWire-A Visual Debugger for C++. | |
Korn et al. | Traversal-based visualization of data structures | |
Nagl et al. | A specification environment for graph grammars | |
US11714609B2 (en) | Automatic generation of source code implementing a regular expression | |
Olsen Jr et al. | Research directions for user interface software tools | |
Livadas et al. | System dependence graphs based on parse trees and their use in software maintenance | |
Lewis et al. | Code generators | |
Czeranski et al. | Analyzing xfig using the Bauhaus tool | |
Blunk et al. | Efficient development of domain-specific simulation modelling languages and tools | |
Wąsowski et al. | Building Modeling Languages | |
Kahn et al. | CENTAUR: the system | |
Bjarnason | Interactive Tool Support for Domain-Specific Languages | |
Glass et al. | Llun—a high‐level debugger for generated parsers | |
Foubister | Graphical application and visualization of lazy functional computation. | |
Clément et al. | Centaur: the system | |
Chete et al. | Towards the Design and Implementation of a Programming Language (Beex) |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20200825 |
|
WD01 | Invention patent application deemed withdrawn after publication |