最新LINUXCNC源程序原理说明.docx

上传人:1595****071 文档编号:35208453 上传时间:2022-08-20 格式:DOCX 页数:155 大小:164.81KB
返回 下载 相关 举报
最新LINUXCNC源程序原理说明.docx_第1页
第1页 / 共155页
最新LINUXCNC源程序原理说明.docx_第2页
第2页 / 共155页
点击查看更多>>
资源描述

《最新LINUXCNC源程序原理说明.docx》由会员分享,可在线阅读,更多相关《最新LINUXCNC源程序原理说明.docx(155页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateLINUXCNC源程序原理说明LINUXCNC源程序原理说明opLINUXCNC源程序学习源程序的树结构如下:Overview of the emc2 directory (generated by tree -I .git -d) :.|- app-defaults|- bin (user mode binaries)|- configs| |- 5axis| |-

2、 boss| |- common| |- dallur-thc| |- demo_mazak (sample mazak config files)| |- demo_sim_cl (sample sim with ladder IO)| |- demo_step_cl (sample stepper with ladder IO)| |- etch-servo| |- halui_halvcp| |- hexapod-sim| |- lathe-pluto| |- m5i20 (sample servo using Mesa PCI)| |- max| |- motenc (sample s

3、ervo using Vital PCI)| |- nist-lathe| |- plasma-thc| |- plasma-thc-sim| |- ppmc| |- puma| |- scara| |- sim (simulated motion and IO)| |- stepper (parport stepper driver) | |- stepper-gantry| |- stepper-xyza| |- stg (sample servo using STG ISA)| |- univpwm (sample PICO servo generator)| |- univstep (

4、sample PICO stepper generator)| - vti|- debian (files needed to build deb packages)| |- extras-Ubuntu-5.10 (extra files for Ubuntu 5.10)| | |- etc| | | |- modprobe.d| | | |- udev| | | | |- rules.d| | | | - scripts| | | - xdg| | | - menus| | | - applications-merged| | - usr| | - share| | |- applicati

5、ons| | |- desktop-directories| | - pixmaps| |- extras-Ubuntu-6.06 (extra files for building on Ubuntu 6.06 Dapper Drake)| | |- etc| | | |- modprobe.d| | | |- udev| | | | |- rules.d| | | | - scripts| | | - xdg| | | - menus| | | - applications-merged| | - usr| | - share| | |- applications| | |- deskto

6、p-directories| | - pixmaps| |- extras-Ubuntu-7.10 (extra files for building on Ubuntu 7.10)| | |- etc| | | |- modprobe.d| | | |- udev| | | | - rules.d| | | - xdg| | | - menus| | | - applications-merged| | - usr| | - share| | |- applications| | |- desktop-directories| | - pixmaps| |- extras-Ubuntu-8.

7、04 (extra files for building on Ubuntu 8.04 Hardy Heron)| | |- etc| | | |- modprobe.d| | | - xdg| | | - menus| | | - applications-merged| | - usr| | - share| | |- applications| | |- desktop-directories| | - pixmaps| |- extras-sim-Ubuntu-5.10 (extra files for sim package for Ubuntu 5.10)| | |- etc| |

8、 | - xdg| | | - menus| | | - applications-merged| | - usr| | - share| | |- applications| | |- desktop-directories| | - pixmaps| - extras-sim-Ubuntu-6.06 (extra files for sim package for Ubuntu 6.06 Dapper Drake)| |- etc| | - xdg| | - menus| | - applications-merged| - usr| - share| |- applications| |

9、- desktop-directories| - pixmaps|- docs (All the important and relevant Docs.)| |- help| |- html (html version of docs - some generated from lyx)| |- man (man pages)| | |- man1| | |- man3| | - man9| - src (API and source notes should be in each src dir.) (source for the handbooks) (top level .lyx fi

10、les)| |- code| |- common (shared .lyx files and images, such as glossary, GPLD license)| |- config| |- gcode (.lyx files, images, etc. for G-Code documentation)| |- gui (.lyx files, images, etc. for GUI documentation)| |- hal (.lyx files, images, etc. for HAL documentation)| |- install| |- ladder| |

11、- motion| - quickstart|- include (headers installed here - originals in src/xxx/)|- lib (user mode object files)| - python| |- rs274| - yapps|- nc_files (Sample NC files)|- rtlib (kernel mode object files, only after a successfull compile)|- scripts(bash scripts like linuxcnc, realtime, rip-environm

12、ent, etc.)|- share| |- axis| | |- images| | - tcl| |- emc| - locale| |- de| | - LC_MESSAGES| |- es| | - LC_MESSAGES| |- fr| | - LC_MESSAGES| |- hu| | - LC_MESSAGES| |- it| | - LC_MESSAGES| |- pt_BR| | - LC_MESSAGES| |- ro| | - LC_MESSAGES| |- ru| | - LC_MESSAGES| |- se| | - LC_MESSAGES| |- sr| | - L

13、C_MESSAGES| - zh_CN| - LC_MESSAGES|- src (source tree - configure script, top level makefile, Makefile.inc, etc)| | |- depends (generated dependency tree)| | |- emc (actual LinuxCNC code)| | |- canterp (interpreter for canonical commands)| | |- ini (inifile related operations)| | |- iotask (IO inter

14、face, lots of HAL pins)| | |- kinematics (trajectory planner and kinematics)| | |- motion (motion controller, talks through SHM to the rest of EMC)| | |- nml_intf (emc specific NML implementation, all messages sent in emc)| | |- rs274ngc (the rs274 g-code interpreter)| | |- sai| | |- task (core comp

15、onent in emc, dispatches actions to other parts)| | - usr_intf (interfaces for some GUIs, and other interfaces: AXIS, halui, stepconf)| | |- axis| | | |- etc| | | |- extensions| | | - scripts| | - stepconf| |- hal (the Hardware Abstraction Layer, provides a unified interface across all hardware)| |

16、|- classicladder| | | - projects_examples| | |- components| | |- drivers| | | |- m5i20| | | | |- bit| | | | - hostmot5_src| | | |- mesa-hostmot2| | | | |- doc| | | | - firmware| | | | |- 5i20| | | | | - SOURCE| | | | - 7i43| | | | |- CPLD| | | | | - SOURCE| | | | - SOURCE| | | |- mesa7i43-firmware|

17、| | | |- gpio| | | | | - source| | | | |- hostmot2| | | | | - src| | | | - source| | | |- mesa_5i2x| | | | - firmware| | | |- pluto_servo_firmware| | | - pluto_step_firmware| | |- user_comps| | | |- devices| | | - vcp| | - utils| | - halgui| |- libnml (a clean implementation of RCSLIB)| | |- buffer|

18、 | |- cms| | |- inifile| | |- linklist| | |- nml| | |- os_intf| | |- posemath| | - rcs| |- module_helper| |- objects| | |- emc| | | |- canterp| | | |- ini| | | |- iotask| | | |- motion| | | |- nml_intf| | | |- rs274ngc| | | |- sai| | | |- task| | | - usr_intf| | | - axis| | | - extensions| | |- hal|

19、 | | |- classicladder| | | |- components| | | |- drivers| | | |- user_comps| | | | |- devices| | | | - vcp| | | - utils| | |- libnml| | | |- buffer| | | |- cms| | | |- inifile| | | |- linklist| | | |- nml| | | |- os_intf| | | |- posemath| | | - rcs| | |- rtapi| | |- rtemc| | | |- kinematics| | | - m

20、otion| | |- rthal| | | |- classicladder| | | |- components| | | - utils| | |- rtlibnml| | | - posemath| | - rtobjects| | - hal| | - components| |- po (Translation files for i18n support)| |- rtapi (*.c and *.h for RTAPI) (unified RT API, wraps over RTLinux, RTAI and sim)| | - examples (testing examp

21、les for the RTAPI)| | |- extint| | |- fifo| | |- semaphore| | |- shmem| | - timer| - tests|- tcl (tkemc.tcl, mini.tcl - the tcl GUIs)| |- bin| - scripts- tests |- abs.0 |- and-or-not-mux.0 |- basic |- ccomp | |- lathe-comp | |- mill-g90g91g92 | |- mill-line-arc-entry | - mill-zchanges |- counter-enc

22、oder.0 |- flipflop.0 |- interp | |- cam-nisley | - flowsnake |- limit3.0 |- limit3.1 |- limit3.2 |- modparam.0 |- overrun |- oword | - sub.0 |- save.0 |- save.1 |- source.0 |- stepgen.0 |- stepgen.1 |- stepgen.2 |- threads.0 - timedelay.0Overview of the emc2 install dirs: / (file system root) | | |-

23、 etc/ | | | - init.d/ | | | - realtime (realtime start/stop script) | | |- $(prefix) (default: /usr/local) | | (all the following $xxxxdir are configurable through autoconf | | | |- bin/ (known as $bindir, files from EMC2/bin) | | | |- sbin/ (known as $sbindir, ) | | | |- etc/ (known as $sysconfdir,

24、 config files and subdirs from configs/) | | | |- lib/ (known as $libdir, lib files *.so from libs/) | | | - share/ | | | - emc/ | | | | | |- docs/ | | | | | - (All the important and relevant Docs.) | | | |- handbooks/ | | | | | - (PDF versions of handbooks) | | | - nc_files/ | | | - (Sample NC file

25、s) | |- $MAN_DIR/ (default: /usr/local/man) | | | |- man1/ | | | | | | | | - man3/ | | | | - $moduledir/ (based on where ./configure finds the RTOS modules)根据这个结构树,我们可以清楚的知道每一个文件夹,每一个子文件的作用,包括了接口,硬件抽象层,实时内核等等部分。当然,在这里面我们需要深入研究的是linuxcnc-dev/src/emc文件夹中的各个文件,也是该数控系统的核心所在。我们再次列出linuxcnc-dev/src/emc中的子

26、结构树:linuxcnc-dev/src/emc中的子结构树:| |- emc (actual LinuxCNC code)| | |- canterp (interpreter for canonical commands)| | |- ini (inifile related operations)| | |- iotask (IO interface, lots of HAL pins)| | |- kinematics (trajectory planner and kinematics)| | |- motion (motion controller, talks through S

27、HM to the rest of EMC)| | |- nml_intf (emc specific NML implementation, all messages sent in emc)| | |- rs274ngc (the rs274 g-code interpreter)| | |- sai| | |- task (core component in emc, dispatches actions to other parts)| | - usr_intf (interfaces for some GUIs, and other interfaces: AXIS, halui,

28、stepconf)| | |- axis| | | |- etc| | | |- extensions| | | - scripts| | - stepconf根据该结构树,我们一个一个的再一次进行分析:(1)canterp (interpreter for canonical commands,即规范命令的解释器)#include / FILE, fopen(), fclose()#include / strcpy()#include / isspace()#include #include #include config.h#include emc/nml_intf/interp_retu

29、rn.hh#include emc/nml_intf/canon.hh#include emc/rs274ngc/interp_base.hh其中包括了语法解析,读取,执行等函数,对刀具信息、主轴转速、开始、停止等信息进行判断和执行工作。(2)ini (inifile related operations,初始化相关的文件)同样,列出该文件夹的结构树:| |- ini (inifile related operations)| | |- emcIniFile.cc/hh | | |- iniaxis.cc/hh | | |- inihal.cc/hh | | |- initraj.cc/hh

30、| | |- initool.cc /hh (2.1) emcIniFile.cc/hh #include / M_PI.#include emcIniFile.hh该文件定义了一些INI文件中字符的赋值,包括 一个TURE或者FAULSE,单位mm ,m,角度,直线,旋转等等。(2.2) iniaxis.cc/hh #include #include / NULL#include / atol(), _itoa()#include / strcmp()#include / isdigit()#include #include #include emc.hh#include rcs_print

31、.hh#include emcIniFile.hh#include iniaxis.hh/ these decls#include emcglb.h/ EMC_DEBUG#include emccfg.h/ default values for globals#include inihal.hh该文件主要用到了两个函数:loadaxis以及iniaxis。前一个函数loadaixs是对INI文件中的轴类型,轴单元,最大最小位置限值,误差限值,最大速度,加速度,加加速度等初始化参数进行读取并存储在&axisIniFile中,这些参数对应于INI文件中AXIS一栏中的参数,并将部分参数赋值给old

32、_inihal_data。除此之外,iniaxis函数主要是读取INI文件中TRAJ部分的AXIS轴数,然后调用loadaxis进行初始化加载。除去两个主要函数,还有一个精度判断函数iniGetFloatPrec以及状态函数(可有可无)。(2.3)initraj.cc/hh该文件主要包含以下几个函数:loadTraj,用于加载INI文件中TRAJ中的配置参数,然后将读取的参数值进行保存,主要赋值给old_inihal_data以及traj_max_velocity等变量,供后续其他文件调用。同时该文件的后面还有一个坐标轴返回原点的判断程序,从而保证TRAJ中的原点坐标。其实,该文件类似于ini

33、axis.cc/hh。(2.4)inihal.cc/hh#include rcs_print.hh#include emc.hh#include #include hal.h#include rtapi.h#include inihal.hh该文件中主要包含以下几个函数:ini_hal_init,用于定义HAL中的新的管脚,包括了各轴中的INI参数管脚,以及TRAJ中的INI参数管脚;ini_hal_init_pins,用于对之前定义好的新管脚进行赋值,主要是将old_inihal_data中的参数值存储到*(the_inihal_data-NAME)中去。check_ini_hal_item

34、s(),用于对各个管脚的值进行更新检查。备注:old_inihal_data中的值都是在iniaxis.cc以及initraj.cc中赋值了的。(3) iotask该文件在这里不做详细介绍,主要是创建“iocontrol”组件,并对一些接口文件进行配置。(4)Kinamitcs该文件夹中包含了不同的运动控制模块,例如五轴、三轴、六轴等等。除此之外,还包含了插补以及速度控制的轨迹规划文件。(4.1)运动控制模块(4.2)轨迹规划模块TC.C文件主要是基于轨迹规划的简单判别文件,由TP.C调用。下面我们分别说明该文件中的一些函数。#include rtapi.h/* rtapi_print_msg

35、 */#include posemath.h#include emcpos.h#include tc.h(1)tcGetStartingUnitVector 主要是获取运动轨迹的起始点的起始单位向量,如果是直线或者攻丝,那么直接计算起始与终止点的位移大小。如果不是,那么就是圆形运动,计算曲率,半径,起始点等等。(2)tcGetEndingUnitVector 主要是获取运动轨迹的终止点的终止单位向量,如果是直线,那么直接计算终点坐标减去起点坐标的大小。如果是攻丝,那么计算起点坐标减去终点坐标的大小。对于其他运动,即曲线运动,则根据转过的角度,计算终点坐标,然后计算曲率半径,并将数据保存到指定位置V中。(3)tcGetPos/tcGetEndpoint 两个都是通过调用函数tcGetPosReal从而得到位置信息。(4)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 成人自考

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com