LINUXCNC源程序原理说明.docx

上传人:b****8 文档编号:9607090 上传时间:2023-02-05 格式:DOCX 页数:34 大小:27.33KB
下载 相关 举报
LINUXCNC源程序原理说明.docx_第1页
第1页 / 共34页
LINUXCNC源程序原理说明.docx_第2页
第2页 / 共34页
LINUXCNC源程序原理说明.docx_第3页
第3页 / 共34页
LINUXCNC源程序原理说明.docx_第4页
第4页 / 共34页
LINUXCNC源程序原理说明.docx_第5页
第5页 / 共34页
点击查看更多>>
下载资源
资源描述

LINUXCNC源程序原理说明.docx

《LINUXCNC源程序原理说明.docx》由会员分享,可在线阅读,更多相关《LINUXCNC源程序原理说明.docx(34页珍藏版)》请在冰豆网上搜索。

LINUXCNC源程序原理说明.docx

LINUXCNC源程序原理说明

源程序的树结构如下:

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)

||--(extrafilesforUbuntu

|||--etc

||||--

||||--udev

|||||--

||||`--scripts

|||`--xdg

|||`--menus

|||`--applications-merged

||`--usr

||`--share

|||--applications

|||--desktop-directories

||`--pixmaps

||--(extrafilesforbuildingonUbuntuDapperDrake)

|||--etc

||||--

||||--udev

|||||--

||||`--scripts

|||`--xdg

|||`--menus

|||`--applications-merged

||`--usr

||`--share

|||--applications

|||--desktop-directories

||`--pixmaps

||--(extrafilesforbuildingonUbuntu

|||--etc

||||--

||||--udev

||||`--

|||`--xdg

|||`--menus

|||`--applications-merged

||`--usr

||`--share

|||--applications

|||--desktop-directories

||`--pixmaps

||--(extrafilesforbuildingonUbuntuHardyHeron)

|||--etc

||||--

|||`--xdg

|||`--menus

|||`--applications-merged

||`--usr

||`--share

|||--applications

|||--desktop-directories

||`--pixmaps

||--(extrafilesforsimpackageforUbuntu

|||--etc

|||`--xdg

|||`--menus

|||`--applications-merged

||`--usr

||`--share

|||--applications

|||--desktop-directories

||`--pixmaps

|`--(extrafilesforsimpackageforUbuntuDapperDrake)

||--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,,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,-thetclGUI's)

||--bin

|`--scripts

`--tests

|--

|--

|--basic

|--ccomp

||--lathe-comp

||--mill-g90g91g92

||--mill-line-arc-entry

|`--mill-zchanges

|--

|--

|--interp

||--cam-nisley

|`--flowsnake

|--

|--

|--

|--

|--overrun

|--oword

|`--

|--

|--

|--

|--

|--

|--

|--

`--

 

Overviewoftheemc2installdirs:

/(filesystemroot)

|

|

|---etc/

||

|\---

||

|\---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""

该文件定义了一些INI文件中字符的赋值,包括一个TURE或者FAULSE,单位mm,m,角度,直线,旋转等等。

hh

#include<>

#include<>.)do{}while(0)

#else

/motion/"

#include""

#include"../motion/"

#include""

(1)tpCreate()创建队列,供后续调用。

(2)tpClearDIOs()如果需要改变的数字IO的存放队列,该函数将会清除之前的IO触发器队列供下次使用。

(3)tpClear()某种程度而言,该函数属于“软件初始化”,结构体TP_STRUCT中的参数将会被保留下来,而队列将会被清空。

(4)tpInit(),初始化TP结构体中的参数值。

(5)tpSetCycleTime(),设置程序循环时间。

(6)tpSetVmax()设置最大速度。

(7)tpSetVlimit()/tpSetAmax()同上,设置速度限制以及最大速度。

(8)tpSetId()/tpGetExecId()分别设置下一个运行周期的ID号,或获取当前的ID号。

(9)pSetTermCond(tp,cond)设置后续运动队列移动的终止条件,返回终止条件和公差。

(10)tpSetPos()设置当前位置以及目标位置。

备注:

(4-10)所返回的参数值都是TP结构的成员,可以理解为TP中都是当前运动模式下的参数值。

(11)tpAddRigidTap()/tpAddLine()/tpAddCircle()这三个函数是用于判断在原有的运动上所需要加入的新的运动模式,根据下一步的运动模式不同,设置不同的参数保存在结构体TC中,可以理解为TC结构体中存入了下一个运动模式时的参数值。

(12)tcRunCycle()该函数通过传入结构体参数TP以及TC,进行运动段的速度控制,源程序用到的是T形速度控制。

根据判断速度和加速度的状态控制速度变化。

最后返回新的速度,以及最终速度变化量(以当前的速度与最大限速进行比较,得到需要加速或者减速的多少)。

(13)tpToggleDIOs()控制数字或者模拟IO口的开或者断,保证下一次输入或者输出正确。

(14)tpRunCycle()该函数是运动控制的核心部分。

首先进行emcmotStatus的初始化;判断TC

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1