开源数控EMC2用户手册.doc_第1页
开源数控EMC2用户手册.doc_第2页
开源数控EMC2用户手册.doc_第3页
开源数控EMC2用户手册.doc_第4页
开源数控EMC2用户手册.doc_第5页
已阅读5页,还剩45页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

开源数控EMC2用户手册第 1 章 前言 ForewordEMC2 is modular and flexible. These attributes lead many to see it as a confusing jumble of littlethings and wonder why it is the way it is. This page attempts to answer that question before youget into the thick of things. EMC2是模块化设计的,柔性很强。很多人都觉得它是由一些令人迷惑的小东西堆叠而成,很奇怪它是怎样做到的。那么在进入实质内容以前,让我们首先试图回答这个问题。EMC started at the National Institute of Standards and Technology in the USA. It grew up usingUnix as its operating system. Unix made it different. Among early Unix developers there grew a setof code writing ideas that some call the Unix way. These early EMC authors followed those ways. EMC项目起源于NIST(美国国家标准与技术研究院)。它起初是在Unix操作系统下运行的,这使它与众不同。早期Unix开发者规定了一些代码编写的原则或方法,称为Unix编程方法(Unix way),EMC项目的作者们遵循了这些方法。Eric S. Raymond, in his book The Art of Unix Programming, summarizes the Unix philosophyas the widely-used engineering philosophy, Keep it Simple, Stupid (KISS Principle).He then describes how he believes this overall philosophy is applied as a cultural Unixnorm, although unsurprisingly it is not difficult to find severe violations of most of thefollowing in actual Unix practice:* Rule of Modularity: Write simple parts connected by clean interfaces.* Rule of Clarity: Clarity is better than cleverness.* Rule of Composition: Design programs to be connected to other programs.* Rule of Separation: Separate policy from mechanism; separate interfaces from engines. Eric S. Raymond在他的著作The Art of Unix Programming中把Unix的哲学上升为普遍适用的工程哲学,即“KISS原则”(Keep it Simple, Stupid)(保持简单化、傻瓜化)。然后他描述了这个KISS原则和Unix规范之间的文化纽带,尽管他也明明知道在Unix的编程实践中找到违反这些规则的例子代码也是不困难和不令人惊奇的。 模块化原则:写出具有清晰接口的简单模块。 简洁性原则:简洁比聪明更重要。 组合性原则:设计程序是为了和其它程序对接。 分离性原则:把策略从机制中分离出来,把接口从上分离出来。(译者注:这句太难懂了,个人理解:从面向对象的角度说,就是把解决问题的方法和问题本身分离,也就是方法和数据分离;然后把接口从方法中分离出来。)Mr Raymond offered several more rules but these four describe essential characteristics of the EMC2motion control system. Raymond先生还提出了一些其它的原则,但这四个原则就是EMC2运动控制系统最重要的特征。The Modularity rule is critical. Throughout these handbooks you will find talk of the interpreter ortask planner or motion or HAL. Each of these is a module or collection of modules. Its modularitythat allows you to connect together just the parts you need to run your machine. 模块化原则是最关键的原则。纵观EMC2系列手册,你会发现无论是G代码解释器、任务规划器、运动控制器,还是硬件抽象层(HAL),它们都是模块或模块的集合。模块化使你能把需要的功能集成起来构成一个系统,而不需要的部分则可以去掉。The Clarity rule is essential. EMC2 is a work in progress it is not finished nor will it ever be. It iscomplete enough to run most of the machines we want it to run. Much of that progress is achievedbecause many users and code developers are able to look at the work of others and build on whatthey have done. 简洁性原则是最重要的原则。EMC2项目已经可以在很多机器系统上运行,但它仍然是一个正在进行的项目,它永远也不会停止。EMC2的成功归功于许多用户以及代码开发人员。由于遵守了简洁性编程的原则,人们才能够互相看到彼此的工作,并很容易的理解代码以及为其添加新的内容。The Composition rule allows us to build a predictable control system from the many modulesavailable by making them connectable. We achieve connectability by setting up standard interfacesto sets of modules and following those standards. 组合性原则促使开发人员为模块提供可连接性,这样使用人员就可以从许多模块中只选择他们需要的模块来构成目标系统。EMC2的组合性是通过标准的接口以及符合该接口标准的模块实现的。The Separation rule requires that we make distinct parts that do little things. By separating functionsdebugging is much easier and replacement modules can be dropped into the system andcomparisons easily made. 分离性原则要求开发人员尽量分解系统功能,并用不同的部件实现它们。这么做的好处一是便于调试,二是可以方便的比较同一功能的不同实现(因为它们有相同的接口,可以很容易的组合进系统中进行测试)。What does the Unix way mean for you as a user of EMC2. It means that you are able to make choicesabout how you will use the system. Many of these choices are a part of machine integration, but manyalso affect the way you will use your machine. As you read you will find many places whereyou will need to make comparisons. Eventually you will make choices, Ill use this interface ratherthan that” or, “Ill write part offsets this way rather than that way. Throughout these handbookswe describe the range of abilities currently available. 那么Unix规范对于使用者又意味着什么呢?它意味着你可以选择怎样配置EMC2系统的功能以适应你的数控系统,也就是说配置EMC2系统是设计数控机床工作的一部分。同时EMC2的某些功能或配置又反过来影响你设计数控机床的方法和过程。在阅读系列手册的过程中,你会一边看一边比较,最后你可能说:“我将使用这个接口而不使用那个接口”,或者“我将这样使用部件偏移而不会那样使用”。继续看下去吧,在系列手册中,我们将讨论所有这些功能和配置。As you begin your journey into using EMC2 we offer two cautionary notes:2Praphrasing the words of Doug Gwyn on UNIX: emc2 was not designed to stop its users fromdoing stupid things, as that would also stop them from doing clever things.Likewise the words of Steven King: emc2 is user-friendly. It just isnt promiscuous aboutwhich users its friendly with. 在你继续阅读之前,我们提供两条注意事项:EMC2不会防止它的使用者干傻事,因为那会同样防止它的使用者干聪明的事。EMC2肯定是用户友好的,只不过它在对哪个用户友好的问题上,用情比较专一而已。第 2 章 EMC2 The Enhanced Machine Control 2.1 关于本手册The focus of this manual is on using EMC. It is intended to be used once EMC is installed andconfigured. For standard installations see the Getting Started Guide for step by step instructionsto get you up and going. For detailed information on installation and configuration of EMC see theIntegrator Manual. 本手册的焦点是如何使用EMC2 。当EMC2安装并配置完毕后应当阅读本手册。关于简易安装EMC2的问题,请参见入门手册“Getting Started Guide”。关于安装和配置的详细信息,请参见综合手册“Integrator Manual”。 2.2 EMC2如何工作The Enhanced Machine Controller (EMC2) is a lot more than just another CNC mill program. Itcan control machine tools, robots, or other automated devices. It can control servo motors, steppermotors, relays, and other devices related to machine tools.There are four main components to the EMC2 software: a motion controller, a discrete I/O controller,a task executor which coordinates them, and graphical user interfaces. In addition there isa layer called HAL (Hardware Abstraction Layer) which allows configuration of EMC2 without theneed of recompiling. 可不敢把EMC2想象成另外一个CNC数控加工程序,它能做的可多了。它可以控制机床、机器人、自动化设备,还能控制伺服电机、步进电机、继电器以及其它机床电器。 EMC2由四个主要部分:运动控制器、离散IO控制器、任务执行器(用来协调这四个部件)、图形用户界面。另外还有一个硬件抽象层HAL(Hardware Abstraction Layer),有了HAL,无需重新编译EMC2,就可以按照实际需要配置EMC2的硬件。Figure 2.1 shows a simple block diagram showing what a typical 3-axis EMC2 system might looklike. This diagram shows a stepper motor system. The PC, running Linux as its operating system,is actually controlling the stepper motor drives by sending signals through the printer port. Thesesignals (pulses) make the stepper drives move the stepper motors. The EMC2 can also run servomotors via servo interface cards or by using an extended parallel port to connect with externalcontrol boards. As we examine each of the components that make up an EMC2 system we willremind the reader of this typical machine. 图2.1(参见英文原版图片)的方框图展示了一个典型的3轴数控系统看起来的样子。这是一个步进电机系统。PC机上运行着Linux操作系统和EMC2程序,控制信号则从打印口(并口)传送到电机驱动器上,电机驱动器根据控制信号驱动步进电机(当然EMC2也可以通过伺服接口卡或使用与扩展并口相连的外部控制卡来控制伺服电机)。我们接下来会介绍EMC2系统的每一个组成部分,在介绍的过程中可能会反复提到这幅图片。 2.3 用户接口A user interface is the part of the EMC2 that the machine tool operator interacts with. The EMC2comes with several types of user interfaces:AXIS an OpenGL-based GUI (Graphical User Interface), with an interactive G-Code previewer.This interface is one of the few that are still under active development and improvement.Keystick a character-based screen graphics program suitable for minimal installations (withoutthe X server running).Xemc an X Windows programtwo Tcl/Tk-based GUIs named TkEMC and Minia HAL based user interface called halui, which allows to control emc2 using knobs andswitchesa telnet based user interface called emcrsh, which allows commands to be sent to emc2 fromremote computers 用户接口是EMC2的一部分,机床操作员与这个接口交互从而达到操作机床的目的。EMC2提供了几种不同的用户接口供用户选择使用: AXIS 界面:是一个基于“OpenGL”的图形用户界面,有一个交互式的G代码预览器。AXIS界面目前仍然处于持续开发升级的过程中。 Keystick界面:是一个基于字符的界面,没有图形,只不过字符排列有规律,看起来像图形一样。只能用键盘操作。如果目标系统没有X server,还想使用EMC2的话,就只能用这个将就了。 Xemc界面:一个X Windows的图形用户界面。 TkEMC界面和Mini界面:两个基于“Tcl/Tk”的图形用户界面。 halui用户接口:基于HAL的用户接口,允许使用开关、旋钮控制EMC2系统。 emcrsh用户接口:基于telnet的用户接口,允许用远程计算机发来的命令控制EMC2系统。2.4 语言EMC2 uses translation files to translate EMC User Interfaces into many languages. You just need tolog in with the language you intend to use and when you start up EMC it comes up in that language.If your language has not been translated contact a developer on the IRC or the mailing list if youcan assist in the translation. EMC2使用翻译文件把用户接口翻译成多种语言。你只需用你想使用的语言登录进操作系统,然后当你启动EMC2时,你看到的界面就已经采用你想使用的语言了。如果你想使用的语言还没有被翻译,而你恰好想帮忙翻译,可以通过“IRC”或邮件列表的方式与开发人员取得联系。2.5 像机床操作员一样思考This book will not even pretend that it can teach you to run a mill or a lathe. Becoming a machinisttakes time and hard work. An author once said, We learn from experience, if at all. Broken tools,gouged vices, and scars are the evidence of lessons taught. Good part finish, close tolerances, andcareful work are the evidence of lessons learned. No machine, no computer program, can take theplace of human experience.As you begin to work with the EMC2 program, you will need to place yourself in the position ofoperator. You need to think of yourself in the role of the one in charge of a machine. It is a machinethat is either waiting for your command or executing the command that you have just given it.Throughout these pages we will give information that will help you become a good operator of theEMC2 mill. You will need some information right up front here so that the following pages will makesense to you. 本书不能教你如何开动一台铣床或车床,成为这方面的专家需要时间和艰苦的努力。有位作家曾经说过:“如果我们学到了什么,那一定是在亲身经历中学到的”。破损的刀具、凿坏的工装、伤痕累累的产品是我们得到的教训,完美的收刀、精密的加工、精细的产品是我们得到的经验。没有任何机床、计算机软件能取代人的阅历和经验。 现在要和EMC2一起工作了,你需要把自己放到机床操作员的位置,要知道是你主宰着机床,而机床就在等待你的命令,执行你的命令。当然通过学习系列手册,你会得到一些信息,它们将帮助你成为一名好的EMC2铣床操作员。在继续之前,你可能需要一些基本信息,接下来的一些篇幅将帮助你找找感觉。2.6 操作方式 Modes of OperationWhen an EMC2 is running, there are three different major modes used for inputting commands.These are Manual, Auto, and MDI. Changing from one mode to another makes a big difference inthe way that the EMC2 behaves. There are specific things that can be done in one mode that cannot be done in another. An operator can home an axis in manual mode but not in auto or MDImodes. An operator can cause the machine to execute a whole file full of G-codes in the auto modebut not in manual or MDI. 当一个EMC2系统运行时,输入命令的方式主要有三种:手动、自动、MDI。在这三种方式下,EMC2 的行为表现差异很大。有些事情在一种方式下可以,在另一种方式下却不可以。比如在手动方式时,操作员可以原点复归某个轴,但在自动和MDI方式下却不行。又比如在自动方式下,操作员可以执行一个全部是G代码的文件,但在手动和MDI方式下却不行。In manual mode, each command is entered separately. In human terms a manual command mightbe turn on coolant or jog X at 25 inches per minute. These are roughly equivalent to flipping aswitch or turning the hand wheel for an axis. These commands are normally handled on one of thegraphical interfaces by pressing a button with the mouse or holding down a key on the keyboard.In auto mode, a similar button or key press might be used to load or start the running of a wholeprogram of G-code that is stored in a file. In the MDI mode the operator might type in a block ofcode and tell the machine to execute it by pressing the or key on the keyboard. 在手动方式下,每个命令是分开输入的,用人类的语言讲,这些命令类似于“开启冷却”或者“在X轴上每分钟前进25英寸”等等,它们大致相当于拨动一个开关或者转动某个轴上的手轮,具体操作则是在某个图形用户界面上用鼠标点击某个按钮或按住键盘上的某个按键完成的。在自动方式下,点击一个按钮就可以装载或启动预先存储在某个文件里面的全部G代码程序。在MDI方式下,操作员可以键入一批代码,然后按回车键命令机床执行。Some motion control commands are available and will cause the same changes in motion in allmodes. These include ABORT, ESTOP, and FEED RATE OVERRIDE. Commands like these should beself explanatory.The AXIS user interface hides some of the distinctions between Auto and the other modes by makingAuto-commands available at most times. It also blurs the distinction between Manual and MDIbecause some Manual commands like Touch Off are actually implemented by sending MDI commands.It does this by automatically changing to the mode that is needed for the action the userhas requested. 有些运动控制命令在所有操作方式下均可使用,效果也相同。包括ABORT、 ESTOP、FEED RATE OVERRIDE等。这些命令都具有自解释的特点。 AXIS用户界面有一个特点,就是它隐藏了一些如上所述的三种操作方式的区别。它在大部分情况下都能提供自动命令,从而隐藏了自动方式和其它两种方式的区别;它也淡化了手动方式和MDI方式的区别,像“Touch Off”这种手动命令也可以通过发送MDI命令来执行。在用户提出请求时,它会自动切换到相应的操作方式,从而实现这种隐藏,而用户在感觉上没有什么异常。第 3 章 用户概念 User ConceptsThis chapter covers important user concepts that should be understood before attempting to run aCNC machine with g code. 本章包含重要的用户概念,在使用G代码运行一个CNC机床之前,应当理解本章的概念。3.1 轨迹控制 Trajectory Control3.1.1 轨迹规划 Trajectory PlanningTrajectory planning, in general, is the means by which EMC follows the path specified by your GCode program, while still operating within the limits of your machinery.A G Code program can never be fully obeyed. For example imagine you specify as a single-lineprogram the following move:G1 X1 F10 (G1 is linear move, X1 is the destination, F10 is the speed)In reality, the whole move cant be made at F10, since the machine must accelerate from a stop,move toward X=1, and then decelerate to stop again. Sometimes part of the move is done at F10,but for many moves, especially short ones, the specified feed rate is never reached at all. Havingshort moves in your G Code can cause your machine to slow down and speed up for the longermoves if the naive cam detector is not employed with G64 Pn.The basic acceleration and deceleration described above is not complex and there is no compromiseto be made. In the INI file the specified machine constraints such as maximum axis velocity andaxis acceleration must be obeyed by the trajectory planner. 轨迹规划是指EMC2跟踪G代码所指定路径的方法,轨迹规划时不能超出机床工作台的运行范围。从某种程度讲,G代码程序永远不能被机床严格执行。就比如下面这一行程序: G1 X1 F10 (G1 表示线性移动, X1 是目的位置, F10 代表速度) 事实上,这个动作不可能完全以F10的速度完成,因为机床必须从静止开始加速,向 X=1的位置进发,在要到达目标位置之前还要减速最后停止。这样就只有部分运动是以F10完成的,如果路程比较短,可能 F10这个速度根本就不会达到。在“G64 Pn”的方式下,如果不指定“ naive cam detector”参数即“Q-”参数,则采用短运动段会让机床运行变慢,采用长运动段可以让机床运行的快一点。 机床加速性能和减速性能取决于机床本身,经实验确定以后,作为机床的特性固定下来,没什么要讨论的。另外机床最大速度也是机床的一个特性。这些特性参数都保存在INI文件中,轨迹规划器必须遵守这些特性。3.1.2 路径跟随 Path FollowingA less straightforward problem is that of path following. When you program a corner in G Code, thetrajectory planner can do several things, all of which are right in some cases: it can decelerate to astop exactly at the coordinates of the corner, and then accelerate in the new direction. It can also dowhat is called blending, which is to keep the feed rate up while going through the corner, making itnecessary to round the corner off in order to obey machine constraints. You can see that there is atrade off here: you can slow down to get better path following, or keep the speed up and have worsepath following. Depending on the particular cut, the material, the tooling, etc., the programmermay want to compromise differently.Rapid moves also obey the current trajectory control. With moves long enough to reach maximumvelocity on a machine with low acceleration and no path tolerance specified, you can get a fairlyround corner. 路径跟随的问题要稍微简单一些。当你用 G代码设计的产品有个棱角的时候,轨迹规划器有几种不同的轨迹规划方式处理这个棱角:比如可以减速并停在棱角所处的坐标位置,然后再按照新的方向加速并离开棱角;它还可以采用混合模式(blending):在通过棱角时保持进给速度,由于机床特性方面的限制,这样做的结果必然在棱角处产生一个圆角。因此在棱角处的路径跟随就存在这样一种情况:要获得更好的路径跟随效果就必须减速,要保持速度,就必然导致差一点的路径跟随效果。具体如何抉择,要由程序员根据具体产品、材料、刀具等情况权衡而定。 快速加工也遵循当前采用的轨迹控制方式。比如采用 G64方式,不指定误差条件,且加速度较低时,让机床运行足够长的距离并达到最大速度,就可以得到非常好的圆角效果。3.1.3 编程确定轨迹规划方式 Programming the PlannerThe trajectory control commands are as follows: 轨迹控制命令如下:G61 (Exact Path Mode) visits the programmed point exactly, even though that means it mighttemporarily come to a complete stop in order to change direction to the next programmedpoint.G61.1 (Exact Stop Mode) tells the planner to come to an exact stop at every segments end. G61:准确路径方式。准确跟踪编程位置,如果到下一个编程位置需要改变方向,则机床会完全停止再改变方向。 G61.1:准确定位方式。在每一个程序段结束时,机床都会停止到相应的编程位置。(无论下一个运动的方向是否需要改变)G64 (Blend Without Tolerance Mode) G64 is the default setting when you start EMC. G64 is justblending and the naive cam detector is not enabled. G64 and G64P0 tell the planner to sacrificepath following accuracy in order to keep the feed rate up. This is necessary for sometypes of material or tooling where exact stops are harmful, and can work great as long as theprogrammer is careful to keep in mind that the tools path will be somewhat more curvy thanthe program specifies. When using G0 (rapid) moves with G64 use caution on clearance movesand allow enough distance to clear obstacles based on the acceleration capabilities of yourmachine. G64:不附加误差条件的混合方式。这个方式也是启动EMC2时默认的方式。G64只是混合方式,没有采用“naive cam detector”功能。“G64”和“G64 P0”是一样的效果,都是告诉轨迹规划器牺牲路径跟随的精度,保证提升进给速度。有时候程序设计人员就想要一个圆角,那么这个模式就用的上了,当然设计人员要清楚采用这种方式加工出的圆角可能和设计值有一定偏差,曲率会大一点。当使用“G0 G64”组合进行快速加工时,要根据机床的加速度性能预留足够的加速空间以保证切削效果。G64 P- Q- (Blend With Tolerance Mode) This enables the naive cam detector and enables blendingwith a tolerance. If you program G64 P0.05, you tell the planner that you want continuousfeed, but at programmed corners you want it to slow down enough so that the tool path canstay within 0.05 user units of the programmed path. The exact amount of slowdown dependson the geometry of the programmed corner and the machine constraints, but the only thingthe programmer needs to worry about is the tolerance. This gives the programmer completecontrol over the path following compromise. The blend tolerance can be changed throughoutthe program as necessary. Beware that a specification of G64 P0 has the same effect as G64alone (above), which is necessary for backward compatibility for old G Code programs. See theG Code Chapter for more information on G64 P- Q-. G64 P- Q- :附加误差条件的混合方式。其中“Q-”参数将打开“naive cam detector”功能,“P-”参数指定误差条件。程序代码“ G64 P0.05”指示轨迹规划器采用连续加工方式(即混合方式blending),但要在棱角处降速以确保轨迹误差不大于0.05个用户单位(英寸或毫米)。具体降速的程度取决于待加工产品的几何尺寸以及机床特性,但这些算法都不需要程序员考虑,程序员只需要考虑他想要多少误差就行了。这种方式给了程序员很大的轨迹跟随控制力,在程序中,他可以随时改变这个误差值来获得他想要的任何效果。要注意的是“G64 P0”和“G64”是一样效果,它只是为了和旧G代码程序保持兼容而设计的。参考 G代码相关的章节可以获得更多关于“G64 P- Q-”的信息。Blending without tolerance The controlled point will touch each specifi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论