LINUXCNC源程序原理说明.docx
- 文档编号:5283855
- 上传时间:2022-12-14
- 格式:DOCX
- 页数:40
- 大小:35.90KB
LINUXCNC源程序原理说明.docx
《LINUXCNC源程序原理说明.docx》由会员分享,可在线阅读,更多相关《LINUXCNC源程序原理说明.docx(40页珍藏版)》请在冰豆网上搜索。
LINUXCNC源程序原理说明
opLINUXCNC源程序学习
源程序的树结构如下:
Overviewoftheemc2directory(generatedbytree-I.git-d):
.
|--app-defaults
|--bin(usermodebinaries)
|--configs
||--5axis
||--boss
||--common
||--dallur-thc
||--demo_mazak(samplemazakconfigfiles)
||--demo_sim_cl(samplesimwithladderIO)
||--demo_step_cl(samplestepperwithladderIO)
||--etch-servo
||--halui_halvcp
||--hexapod-sim
||--lathe-pluto
||--m5i20(sampleservousingMesaPCI)
||--max
||--motenc(sampleservousingVitalPCI)
||--nist-lathe
||--plasma-thc
||--plasma-thc-sim
||--ppmc
||--puma
||--scara
||--sim(simulatedmotionandIO)
||--stepper(parportstepperdriver)
||--stepper-gantry
||--stepper-xyza
||--stg(sampleservousingSTGISA)
||--univpwm(samplePICOservogenerator)
||--univstep(samplePICOsteppergenerator)
|`--vti
|--debian(filesneededtobuilddebpackages)
||--extras-Ubuntu-5.10(extrafilesforUbuntu5.10)
|||--etc
||||--modprobe.d
||||--udev
|||||--rules.d
||||`--scripts
|||`--xdg
|||`--menus
|||`--applications-merged
||`--usr
||`--share
|||--applications
|||--desktop-directories
||`--pixmaps
||--extras-Ubuntu-6.06(extrafilesforbuildingonUbuntu6.06DapperDrake)
|||--etc
||||--modprobe.d
||||--udev
|||||--rules.d
||||`--scripts
|||`--xdg
|||`--menus
|||`--applications-merged
||`--usr
||`--share
|||--applications
|||--desktop-directories
||`--pixmaps
||--extras-Ubuntu-7.10(extrafilesforbuildingonUbuntu7.10)
|||--etc
||||--modprobe.d
||||--udev
||||`--rules.d
|||`--xdg
|||`--menus
|||`--applications-merged
||`--usr
||`--share
|||--applications
|||--desktop-directories
||`--pixmaps
||--extras-Ubuntu-8.04(extrafilesforbuildingonUbuntu8.04HardyHeron)
|||--etc
||||--modprobe.d
|||`--xdg
|||`--menus
|||`--applications-merged
||`--usr
||`--share
|||--applications
|||--desktop-directories
||`--pixmaps
||--extras-sim-Ubuntu-5.10(extrafilesforsimpackageforUbuntu5.10)
|||--etc
|||`--xdg
|||`--menus
|||`--applications-merged
||`--usr
||`--share
|||--applications
|||--desktop-directories
||`--pixmaps
|`--extras-sim-Ubuntu-6.06(extrafilesforsimpackageforUbuntu6.06DapperDrake)
||--etc
||`--xdg
||`--menus
||`--applications-merged
|`--usr
|`--share
||--applications
||--desktop-directories
|`--pixmaps
|--docs(AlltheimportantandrelevantDocs.)
||--help
||--html(htmlversionofdocs-somegeneratedfromlyx)
||--man(manpages)
|||--man1
|||--man3
||`--man9
|`--src(APIandsourcenotesshouldbeineachsrcdir.)(sourceforthehandbooks)(toplevel.lyxfiles)
||--code
||--common(shared.lyxfilesandimages,suchasglossary,GPLDlicense)
||--config
||--gcode(.lyxfiles,images,etc.forG-Codedocumentation)
||--gui(.lyxfiles,images,etc.forGUIdocumentation)
||--hal(.lyxfiles,images,etc.forHALdocumentation)
||--install
||--ladder
||--motion
|`--quickstart
|--include(headersinstalledhere-originalsinsrc/xxx/)
|--lib(usermodeobjectfiles)
|`--python
||--rs274
|`--yapps
|--nc_files(SampleNCfiles)
|--rtlib(kernelmodeobjectfiles,onlyafterasuccessfullcompile)
|--scripts(bashscriptslikelinuxcnc,realtime,rip-environment,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
||`--LC_MESSAGES
|`--zh_CN
|`--LC_MESSAGES
|--src(sourcetree-configurescript,toplevelmakefile,Makefile.inc,etc)
||
||--depends(generateddependencytree)
||
||--emc(actualLinuxCNCcode)
|||--canterp(interpreterforcanonicalcommands)
|||--ini(inifilerelatedoperations)
|||--iotask(IOinterface,lotsofHALpins)
|||--kinematics(trajectoryplannerandkinematics)
|||--motion(motioncontroller,talksthroughSHMtotherestofEMC)
|||--nml_intf(emcspecificNMLimplementation,allmessagessentinemc)
|||--rs274ngc(thers274g-codeinterpreter)
|||--sai
|||--task(corecomponentinemc,dispatchesactionstootherparts)
||`--usr_intf(interfacesforsomeGUIs,andotherinterfaces:
AXIS,halui,stepconf)
|||--axis
||||--etc
||||--extensions
|||`--scripts
||`--stepconf
||--hal(theHardwareAbstractionLayer,providesaunifiedinterfaceacrossallhardware)
|||--classicladder
|||`--projects_examples
|||--components
|||--drivers
||||--m5i20
|||||--bit
||||`--hostmot5_src
||||--mesa-hostmot2
|||||--doc
||||`--firmware
|||||--5i20
|||||`--SOURCE
||||`--7i43
|||||--CPLD
|||||`--SOURCE
||||`--SOURCE
||||--mesa7i43-firmware
|||||--gpio
|||||`--source
|||||--hostmot2
|||||`--src
||||`--source
||||--mesa_5i2x
||||`--firmware
||||--pluto_servo_firmware
|||`--pluto_step_firmware
|||--user_comps
||||--devices
|||`--vcp
||`--utils
||`--halgui
||--libnml(acleanimplementationofRCSLIB)
|||--buffer
|||--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
||||--classicladder
||||--components
||||--drivers
||||--user_comps
|||||--devices
||||`--vcp
|||`--utils
|||--libnml
||||--buffer
||||--cms
||||--inifile
||||--linklist
||||--nml
||||--os_intf
||||--posemath
|||`--rcs
|||--rtapi
|||--rtemc
||||--kinematics
|||`--motion
|||--rthal
||||--classicladder
||||--components
|||`--utils
|||--rtlibnml
|||`--posemath
||`--rtobjects
||`--hal
||`--components
||--po(Translationfilesfori18nsupport)
||--rtapi(*.cand*.hforRTAPI)(unifiedRTAPI,wrapsoverRTLinux,RTAIandsim)
||`--examples(testingexamplesfortheRTAPI)
|||--extint
|||--fifo
|||--semaphore
|||--shmem
||`--timer
|`--tests
|--tcl(tkemc.tcl,mini.tcl-thetclGUI's)
||--bin
|`--scripts
`--tests
|--abs.0
|--and-or-not-mux.0
|--basic
|--ccomp
||--lathe-comp
||--mill-g90g91g92
||--mill-line-arc-entry
|`--mill-zchanges
|--counter-encoder.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.0
Overviewoftheemc2installdirs:
/(filesystemroot)
|
|
|---etc/
||
|\---init.d/
||
|\---realtime(realtimestart/stopscript)
|
|
|---$(prefix)(default:
/usr/local)
||(allthefollowing$xxxxdirareconfigurablethroughautoconf
||
||---bin/(knownas$bindir,filesfromEMC2/bin)
||
||---sbin/(knownas$sbindir,)
||
||---etc/(knownas$sysconfdir,configfilesandsubdirsfromconfigs/)
||
||---lib/(knownas$libdir,libfiles*.sofromlibs/)
||
|\---share/
||
|\---emc/
||
||
||---docs/
|||
||\---(AlltheimportantandrelevantDocs.)
||
||---handbooks/
|||
||\---(PDFversionsofhandbooks)
||
|\---nc_files/
||
|\---(SampleNCfiles)
|
|---$MAN_DIR/(default:
/usr/local/man)
||
||---man1/
|||
||
||
|\---man3/
||
|
|
\---$moduledir/(basedonwhere./configurefindstheRTOSmodules)
根据这个结构树,我们可以清楚的知道每一个文件夹,每一个子文件的作用,包括了接口,硬件抽象层,实时内核等等部分。
当然,在这里面我们需要深入研究的是linuxcnc-dev/src/emc文件夹中的各个文件,也是该数控系统的核心所在。
我们再次列出linuxcnc-dev/src/emc中的子结构树:
linuxcnc-dev/src/emc中的子结构树:
||--emc(actualLinuxCNCcode)
|||--canterp(interpreterforcanonicalcommands)
|||--ini(inifilerelatedoperations)
|||--iotask(IOinterface,lotsofHALpins)
|||--kinematics(trajectoryplannerandkinematics)
|||--motion(motioncontroller,talksthroughSHMtotherestofEMC)
|||--nml_intf(emcspecificNMLimplementation,allmessagessentinemc)
|||--rs274ngc(thers274g-codeinterpreter)
|||--sai
|||--task(corecomponentinemc,dispatchesactionstootherparts)
||`--usr_intf(interfacesforsomeGUIs,andotherinterfaces:
AXIS,halui,stepconf)
|||--axis
||||--etc
||||--extensions
|||`--scripts
||`--stepconf
根据该结构树,我们一个一个的再一次进行分析:
(1)canterp(interpreterforcanonicalcommands,即规范命令的解释器)
#include
#include
#include
#include
#include
#include"config.h"
#include"emc/nml_intf/interp_return.hh"
#include"emc/nml_intf/canon.hh"
#include"emc/rs274ngc/interp_base.hh"
其中包括了语法解析,读取,执行等函数,对刀具信息、主轴转速、开始、停止等信息进行判断和执行工作。
(2)ini(inifilerelatedoperations,初始化相关的文件)
同样,列出该文件夹的结构树:
||--ini(inifilerelatedoperations)
|||--emcIniFile.cc/hh
|||--iniaxis.cc/hh
|||--inihal.cc/hh
|||--initraj.cc/hh
|||--initool.cc/hh
(2.1)emcIniFile.cc/hh
#include
#incl
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LINUXCNC 源程序 原理 说明