Home

Developer Manual V2.5, 2015-10-24

image

Contents

1. Eee ORAS am dee E 10 4121 ern 10 LE IE CD 10 228 IDESASBLE 211 3453xa08 a RS Ro Ren iR a Uh UR RIAL 10 ETT 10 LT voco 10 272 ENABLE AMPLIFIER 222 2 2 2 2 2 225555 42 10 PANEM Cono c s edga eede a ea 5 eA ho k ee 10 Developer Manual V2 5 2015 10 24 iii 2 7 10 2 41 2 JA 2 7 14 2 1 15 254 16 FAM I 2 1 18 2 7 19 2 1 28 DU PME o pe ea eRe le e s 10 DISABLE AMPLIFIER 2245 4 2 onde Si k Skata ha eli SOFA SU 11 27 81 Bequagements ee Ee Ree ESSA n 11 2782 EA e x OBA x REC RUE E oe ae ee 11 SON SI OPE ete eee Eee Ce aa ded he oe 11 2741 Requirements cases 22525 WP Eom eS 11 42782 440 eee eee ee 11 DEACIIVATE JOINT Ba ea em Rede de 11 PAA quies KAKE SR Nu RU RUE x ee 11 ENG Ix m eee E RNA Ra Se eS IT 11 ENABLE WATCHDOG Oe Fosse m AG ee Bed n 11 Requirements i 536 6865 bb eRe S Robo MNE mo Ro eee E GR qos 11 Cot So Ta UA ks ESSE aS Pie eee Se PEERS OS 12 DISABLE WALICHDOG s 328 PEN e
2. OFE TYPE 222222522 ee eS BESS OR 49 AUX SIST RORIS RACE mue X Rache 5 49 39 SPINDLE hw Bi ROS NU OE Re e X Foe c Bea 49 39 1 EMC SPINDLE INIT TYPE OS ELI Re Rh dn 49 292 EMC SPINDLE HALT 222 4424 Yeh wR EY ee 49 293 EMC SPINDLE ABORT TYPES 65264444455 664454 2555 v 49 394 EMC SPINDLE ON TYPE cc cp eses koe obo E e 49 393 SPINDLE OFF TYPE 21 1 008 56445 e464 bbe EA eee a dem VOX Xo e x x 50 A905 EMC SPINDLE FORWARD eeu Cede x MAN NE Yee 50 297 EMC SPINDLE REVERSE og vos oom RE wR KN E 50 295 EMC SPINDLE STOP dedy sus 222556292 ssi 50 399 EMC SPINDLE INCREASE kokon kokkoa RRR m m t m mm 50 3 9 IU EMC SPINDLE DECREASE TYPE 2 2 5 OX 50 359 1 EMC SPINDLE CONSTANT uere cv vues m d Seale er EIER TG 51 39 12 EMC SPINDLE BRAKE RELEASE 2 iam 51 3 9 13 SPINDLE BRAKE ENGAGB TYPE 51 3 14 EMC SPINDLE ENABLE TYPE 22252202265 se YR vx mus ar MGE eX 51 3913 EMC SPINDLE DISABLE TYPE x 51 3916 EMC SPINDLE STAT cce Rey Gy ROT E ow Rok Ee
3. S BOR re 16 MC TT ee aus 16 uobis PCT eS SS De a a eo eh 16 bo TD C ee wee eee a ee ee bee Dir oe ea eG Ee 17 cial p cv en GS 17 CMs cas bh Gee SES EO eee Re ok ee ee ee ee Lae E 17 Conti enratjot Dile formiat ew EL eA eh de Roh 18 BTG URE lt s s 2 k sn bee Rcx e x Ob RE Rok RE E Om Euge eee m Ree Rel 18 22002 specie CnES sa KS ee 19 c M C PTT 19 2 204 Ones COMENS Lc lu ok RUP bk A ee GOEL RO Re 20 NME t ER heo PEA Cea eee 20 Zell NME ee SURGE ee sii BES p dono 21 NASE SUE ee OR E we eee BB ee OR 21 212112 NML TSS 22 222 ew ERA X dee E SEU REX 21 2 21 13 and NME relationships ca o som RR RE So a e 21 Adds custom NNIL commands lt lt 5 045 pd ee Ska ke OR Ros ee 21 The Tool Table and TOolehammet soi 44 2 4 oder OK S Rum beers x ue nes E SS ERU S E 22 2 23 1 Toolchanper abstraction 2 2 2 2 25 24 42 22 243 1 Nonrandom Toolchangers lt lt cs ees 2 me S y ed 22 2 23 12 Random 22222
4. 22222222 252552585220 S 35 343 EMC TRAI SET CYCLE TIME 36 344 EMC TRAJ SET MODE 9x x dem ox Xo e x 36 ads TRAI SET VBLOCITY 252222595 EC eee x EISE ESSE 36 346 EMC TRAJ SET ACCELERATION TYPE 54 mm RR SEG RE 36 347 TRAJ SET MAX VELOCITY TYPE y 36 245 TRAJ ACCBLERAIION 37 S49 TRAJ SET SCALE R SOY 37 34 10 TRAI SET MOTION ID SESE RSS 37 222222222589 ie a 37 34 12 EMC TRAJ i kok ea S Ro 37 340 15 EMC ENABLE TYPE lt lt 3 3 eee image 38 34M EMC TRAJ DISABLE iue Re RA RRR BO OEE ER ee a 38 34 13 EMC TRAJ ABORT 2 64 4 250445046554 484 dox 2 See eee ee een 38 34 18 EMC PAUSE TYPE Ra eae 38 EMC TRAJ SRP oe ES Park ran 38 3418 RESUME lt 2256 244068086 e468 he Rt SEEPS S ROS x eee eS 39 3 4 19 EMC DELAY ech 2 024 042 Seba eh eR Be ea 39 342 TRA LINEAR
5. BMC ooo ks m Rm SLR hans UI E e yy 45 BMC TOOL muon 2 2 ee bh Dae hw kbs eae ebd oe edm de 46 EMC TOOL INIT TYPE Bae dome Een 46 Su ERIC TYPES Ge cet ed rear Bernie and Se oa 46 EMC TOOL ABORT TYPE 2 2255 a m ern 46 3 14 EMC TOOL PREPARE 2222 222554 ov E E 46 Developer Manual V2 5 2015 10 24 viii 372 EMC TOOL LOAD TYPE 22 ee ee ee 47 S5 EMC POOL UNLOAD TYPE 2 devo eR SOY ORO huno SEG SUR EUM ORC S 47 3 57 EMC TOOL LOAD TOOL TABLE 22 22 sorg he kok Rok Room a ee ER ws 47 348 TOOL SBT OFFSET TYPE cerre 264 222252225225 0 5 47 RER BMC TOM STAT TYPE uud Ee Sub Sue oe 47 2e CPC OTT TIT 48 3 5 1 EMC AUX INIT k kkk n Roo o x ho A ew do ae e a 48 3 9 EMC AUX ed de a 48 28 3 EMC AUX ABORT ak ce 48 Amd AUX DIO WRITE 225222 Shaw c 48 3 353 AUX AIO WRITE 48 3 5 6 AUX ESTOP ON 22 22 222222225552 44 48
6. b emccanon Builds an TRAJ SET OFFSET message containing the offsets and sends it to Task Task copies the offsets to emcStatus task toolOffset and sends them on to Motion via an EMCMOT SET OFFSET command Motion copies the offsets to emcmotStatus tool offset where it gets used to offset future motions 3 Back in interp offsets are recorded in settings gt tool offset The effective pocket is recorded in settings tool offset index though this value is never used 2 23 3 4 G10 L1 L10 L11 Modifies the tool table Handled by Interp convert setup tool 1 Picks the tool number out of the P word in the block and finds the pocket for that tool a With a nonrandom toolchanger config this is always the pocket number in the toolchanger even when the tool is in the spindle b With a random toolchanger config if the tool is currently loaded it uses pocket 0 pocket 0 means the spindle and if the tool is not loaded it uses the pocket number in the tool changer This difference is important 2 Figures out what the new offsets should be 3 The new tool information diameter offsets angles and orientation along with the tool number and pocket number are passed to the Canon call SET TOOL TABLE a saicanon Copy the new tool information to the specified pocket in sai s internal tool table tools Developer Manual V2 5 2015 10 24 25 77 b emccanon Buil
7. 3 6 17 EMC TASK STAT TYPE Description NML Type 599 Written From none Read To none Parameter Type heartbeat unsigned long int a HUGE load of params Developer Manual V2 5 2015 10 24 46 77 3 7 TOOL 3 7 1 EMC TOOL INIT TYPE Description NML Type starts TOOL init 1101 Obs used for initializing the IO stuff should load the tool table too Written From emclolnit iotaskintf cc Read To main ioControl cc simloControl cc emc io get command iosh cc Parameter Type 3 7 2 EMC TOOL HALT TYPE Description NML Type stops TOOL 1102 Obs used for stopping IO doesn t actually do anything so far in EMCI it was send to subordinates too spindle aux coolant ube Written From emcloHalt iotaskintf cc Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type 3 7 3 EMC TOOL ABORT TYPE Description NML Type aborts TOOL 1103 Obs used for aborting IO doesn t actually do anything so far in EMCI it was send to subordinates too spindle aux coolant lube Written From emcloAbort iotaskintf cc Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type 3 7 4 EMC TOOL PREPARE TYPE Description NML Type prepares a tool for tool changing 1104 Obs loads the prep tool in emcioStatus tool toolPrepped should go to PLC and make it move the desired tool in the toolchanging position Written From SELEC
8. Parameter Type delay double 3 4 20 EMC TRAJ LINEAR MOVE TYPE Description NML Type sends a linear move from the interp to motion 220 Obs used Written From STRAIGHT TRAVERSE ARC FEED emccanon cc Read To checkInterpList emcTaskIssueCommand emctaskmain cc calls emcTrajLinearMove minimill bridgeporttaskintf cc which sends EMCMOT SET LINE Parameter Type end EmcPose 3 4 21 TRAJ CIRCULAR MOVE Description NML Type sends a circular move from the interp to motion 221 Obs used Written From ARC FEED emccanon cc Read To checkInterpList emcTaskIssueCommand emctaskmain cc calls emcTrajCircularMove minimill bridgeporttaskintf cc which sends SET CIRCLE Parameter Type end EmcPose center PM CARTESIAN normal PM CARTESIAN turn int 3 4 22 TRAJ SET TERM COND TYPE Description NML Type chooses between blending or exact path mode 222 Obs used seems the interp knows exact PATH STOP and BLEND motion however knows only BLEND or STOP Written From SET MOTION CONTROL MODE emccanon cc Read To emcTaskIssueCommand emctaskmain cc calls emcTrajSetTermCond minimill bridgeporttaskintf cc which sends EMCMOT TERM COND STOP or EMCMOT TERM COND BLEND Parameter Type cond int Developer Manual V2 5 2015 10 24 40 77 3 4 23 EMC TRAJ SET OFFSET TYPE Description NML Type is used for tool length offset 223 Obs used the message could tran
9. 3 3 13 AXIS SET HOME TYPE Description NML Type 113 Written From none Read To none Parameter Type axis in AXIS CMD MSG int homingVel double 3 3 14 AXIS SET HOME OFFSET TYPE Description NML Type 114 Written From none Read To none Parameter Type axis in AXIS CMD MSG int home double 3 3 15 AXIS SET MIN FERROR TYPE Description NML Type sets min following error 115 Obs also handled by iniaxis which directly calls emcAxisSetMinFerror Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetMinFerror taskintf cc which sends EMCMOT SET MIN FERROR Parameter Type axis in AXIS CMD MSG int offset double Developer Manual V2 5 2015 10 24 32 77 3 3 16 EMC AXIS SET MAX VELOCITY TYPE Description NML Type sets max velocity 116 Obs not used Written From none Read To none Parameter Type axis in EMC AXIS CMD MSG int ve double 3 3 17 AXIS INIT TYPE Description NML Type 118 Obs not used Written From none Read To none Parameter Type axis in AXIS CMD MSG int 3 3 18 AXIS HALT Description NML 119 Obs not used only read Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisHalt taskintf cc Parameter Type axis in EMC AXIS CMD MSG int 3 3 19 AXIS ABORT TYPE Description NML Typ
10. 1302 Written From none Read To none Parameter Type 3 9 3 EMC SPINDLE ABORT TYPE Description NML Type 1303 Written From none Read To none Parameter Type 3 9 4 EMC SPINDLE ON TYPE Description NML Type 1304 Written From none Read To none Parameter Type speed double Developer Manual V2 5 2015 10 24 50 77 3 9 5 EMC SPINDLE OFF TYPE Description NML Type 1305 Written From none Read To none Parameter Type 3 9 6 EMC SPINDLE FORWARD TYPE Description NML Type 1306 Written From none Read To none Parameter Type speed double 3 9 7 EMC SPINDLE REVERSE TYPE Description NML Type 1307 Written From none Read To none Parameter Type speed double 3 9 8 EMC SPINDLE STOP TYPE Description NML Type 1308 Written From none Read To none Parameter Type speed double 3 9 9 EMC SPINDLE INCREASE TYPE Description NML Type 1309 Written From none Read To none Parameter Type speed double 3 9 10 EMC SPINDLE DECREASE TYPE Description NML Type 1310 Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24 51 77 3 9 11 EMC SPINDLE CONSTANT TYPE Description NML Type 1311 Written From none Read To none Parameter Type 3 9 12 EMC SPINDLE BRAKE RELEASE TYPE Description NML Type 1312 Written From none Read To none Parameter Type 3 9 13 EMC SPINDLE BRAKE ENGAGE T
11. 38 77 3 4 13 EMC TRAJ ENABLE TYPE Description NML Type 213 Obs not used Written From none Read To none Parameter Type 3 4 14 EMC TRAJ DISABLE TYPE Description NML Type 214 Obs not used Written From none Read To none Parameter Type 3 4 15 TRAJ ABORT TYPE Description NML Type causes traj to abort 215 Obs not used only read Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcTrajAbort taskintf cc which sends EMCMOT ABORT Parameter Type 3 4 16 EMC TRAJ PAUSE TYPE Description NML Type causes traj to pause 216 Obs not used only read Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcTrajPause minimill bridgeporttaskintf cc which sends EMCMOT PAUSE Parameter Type 3 4 17 TRAJ STEP TYPE Description NML Type 217 Obs not used Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24 39 77 3 4 18 EMC TRAJ RESUME TYPE Description NML Type causes traj to resume 218 Obs not used only read Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcTrajResume minimill bridgeporttaskintf cc which sends EMCMOT RESUME Parameter Type 3 4 19 EMC TRAJ DELAY TYPE Description NML Type sets a delay in the task execution 219 Obs used with dwelling Written From DWELL emccanon cc Read To emcTaskIssueCommand emctaskmain cc
12. Copyright c 2000 2013 LinuxCNC org Permission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 1 1 or any later version published by the Free Software Foundation with no Invariant Sections no Front Cover Texts and one Back Cover Text This LinuxCNC Handbook is the product of several authors writing for linuxCNC org As you find it to be of value in your work we invite you to contribute to its revision and growth A copy of the license is included in the section entitled GNU Free Documentation License If you do not find the license you may order a copy from Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 7 2 GNU Free Documentation License GNU Free Documentation License Version 1 1 March 2000 Copyright O 2000 Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed 0 PREAMBLE The purpose of this License is to make a manual textbook or other written document free in the sense of freedom to assure everyone the effective freedom to copy and redistribute it with or without modifying it either commercially or noncommercially Secondarily this License preserves for the author and publisher a way to get credit for their work while not being considered responsible for modifications made
13. Like running indent on single files renames still make it more difficult to follow changes over time At a minimum you should seek consensus on irc or the mailing list that the rename is an improvement 5 7 9 Prefer rebase Usegit pull rebase instead of bare git pull in order to keep a nice linear history When you rebase you always retain your work as revisions that are ahead of origin master so you do things like format patch them to share with others without pushing to the central repository 5 8 Other ways to contribute There are many ways to contribute to LinuxCNC that are not addressed by this document These ways include Answering questions on the forum mailing lists and in IRC Reporting bugs on the bug tracker forum mailing lists or in IRC Helping test experimental features Developer Manual V2 5 2015 10 24 67 77 Chapter 6 Glossary A listing of terms and what they mean Some terms have a general meaning and several additional meanings for users installers and developers Acme Screw A type of lead screw that uses an Acme thread form Acme threads have somewhat lower friction and wear than simple triangular threads but ball screws are lower yet Most manual machine tools use acme lead screws Axis One of the computer controlled movable parts of the machine For a typical vertical mill the table is the X axis the saddle is the Y axis and the guill or knee is the Z axis Angular a
14. c and h are reserved for plain C Headers are for class method and structure declarations not code unless the functions are declared inline 4 10 Python coding standards Use the PEP 8 style for Python code 4 11 Comp coding standards In the declaration portion of a comp file begin each declaration at the first column Insert extra blank lines when they help group related items In the code portion of a comp file follow normal C coding style Developer Manual V2 5 2015 10 24 63 77 Chapter 5 Contributing to LinuxCNC 5 1 Introduction This document contains information for developers about LinuxCNC infrastructure and describes the best practices for con tributing code and documentation updates to the LinuxCNC project Throughout this document source means both the source code to the programs and libraries and the source text for the documentation 5 2 Communication among LinuxCNC developers The two main ways that project developers communicate with each other are e IRC at linuxcnc devel on FreeNode e Via email on the developers mailing list https lists sourceforge net lists listinfo emc developers 5 3 LinuxCNC Source Forge project We use Source Forge for mailing lists and bug tracking Our SF mailing lists are here http sourceforge net p emc mailman Our SF bug tracker is here http sourceforge net p emc bugs 5 4 Thegit Revision Control System of the LinuxCN
15. calls emcTrajSetVelocity minimill bridgeporttaskintf cc which sends EMCMOT SET VEL Parameter Type velocity double 3 4 6 EMC TRAJ SET ACCELERATION TYPE Description NML Type 206 Obs not used Written From none Read To none Parameter Type acceleration double 3 4 7 EMC TRAJ SET MAX VELOCITY TYPE Description NML Type 207 Obs not used Written From none Read To none Parameter Type velocity double Developer Manual V2 5 2015 10 24 37 77 3 4 8 TRAJ SET ACCELERATION Description NML Type 208 Obs not used Written From none Read To none Parameter Type acceleration double 3 4 9 EMC TRAJ SET SCALE TYPE Description NML Type set the feed override to be the percent value 209 Obs used for feed override messages Written From sendFeedOverride emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcTrajSetScale taskintf cc which sends EMCMOT SCALE Parameter Type scale double 3 4 10 EMC TRAJ SET MOTION ID TYPE Description NML Type 210 Obs not used Written From none Read To none Parameter Type id int 3 4 11 EMC TRAJ INIT Description NML Type 211 Obs not used Written From none Read To none Parameter Type 3 4 12 EMC TRAJ HALT TYPE Description NML Type 212 Obs not used Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24
16. 16 SCALE The SCALE command scales all velocity limits and commands by a specified amount It is used to implement feed rate override and other similar functions The scaling works in free teleop and coord modes and affects everything including homing velocities etc However individual joint velocity limits are unaffected 2 7 16 1 Requirements None The command can be issued at any time and will always be accepted 2 7 16 2 Results velocity commands are scaled by the specified constant 2 7 17 OVERRIDE LIMITS The OVERRIDE LIMITS command prevents limits from tripping until the end of the next JOG command It is normally used to allow a machine to be jogged off of a limit switch after tripping The command can actually be used to override limits or to cancel a previous override 2 7 17 1 Requirements None The command can be issued at any time and will always be accepted I think it should only work in free mode 2 7 17 2 Results Limits on all joints are over ridden until the end of the next JOG command This is currently broken once an OVER RIDE LIMITS command is received limits are ignored until another OVERRIDE LIMITS command re enables them 2 7 18 HOME The HOME command initiates a homing sequence on a specified joint The actual homing sequence is determined by a number of configuration parameters and can range from simply setting the current position to zero to a multi stage search for a home switch
17. 24 7 77 2 6 Block diagrams and Data Flow The following figure is a block diagram of a joint controller There is one joint controller per joint The joint controllers work at a lower level than the kinematics a level where all joints are completely independent All the data for a joint is in a single joint structure Some members of that structure are visible in the block diagram such as coarse_pos pos cmd and motor pos fb JOINT CONTROLLER Feedback to Kinematics motor of fset free mode backlash amp trajectory pnr free made Lommands ra acd Amar cubk anista beg Kinamatics nterpalator hone sw In Joint Controller Block Diagram The above figure shows five of the seven sets of position information that form the main data flow through the motion controller The seven forms of position data are as follows 1 emcmotStatus gt carte pos cmd Thisis the desired position in Cartesian coordinates It is updated at the traj rate not the servo rate In coord mode it is determined by the traj planner In teleop mode it is determined by the traj planner In free mode it is either copied from actualPos or generated by applying forward kins to 2 or 3 2 emcmotStatus gt joints n coarse pos This is the desired position in joint coordinates but before interpolation It is updated at the traj rate not the servo rate In coord mode it is generated by applying inverse kins to 1 In teleop mode
18. IO gets the signal from HAL that the toolchanger prep is complete after a Txxx command this variable is set to the pocket of the requested tool When IO gets the signal from HAL that the tool change itself is complete after an M6 command this variable gets reset to 1 emcioStatus tool toolInSpindle Tool number of the tool currently installed in the spindle Exported on the HAL pin iocontrol 0 tool number s32 emcioStatus tool toolTable An array of CANON TOOL TABLE structures CANON POCKETS long Loaded from the tool table file at startup and maintained there after Index 0 is the spindle indexes 1 CANON_POCKETS_MAX 1 are the pockets in the toolchanger This is a complete copy of the tool information maintained separately from Interp s sett ings tool_ table 2 23 4 2 interp settings is of type settings whichis struct setup_struct Definedin src emc rs274ngc interp_inte rnal hh settings selected_pocket Pocket of the tool most recently selected by Txxx settings current_pocket Original pocket of the tool currently in the spindle In other words which toolchanger pocket the tool that s currently in the spindle was loaded from settings tool_table An array of tool information The index into the array is the pocket number aka slot number Pocket 0 is the spindle pockets 1 through CANON POCKETS MAX 1 are the pockets of the toolchanger settings tool offset index Unused FIXME Should pro
19. MOVE 2 2 22 4 2 2 39 2421 EMC TRAI CIRCULAR MOVE 222222222222 22222224225 99584655 39 24 22 EMC TRAJ SET TERM COND TYPE Las k s eR ern 39 3423 EMC SET TYPE 2 22222 2 222 2 42 40 Developer Manual V2 5 2015 10 24 vii 3 6 221 JS EMC SET OBISIN s 40 2405 EMC SET HOME adeeb debs REG SE ee ews 40 24 EMC TRAJ SET PROBE INDEX 40 3 4 27 SET PROBE POLARITY m ex ER 40 3 4 28 TRAJ CLEAR PROBE TRIPPED FLAG TYPE 41 34120 EMC TRAJ PROBE uon ks s RR ROS SKI EA EO eR 41 34 30 TRAI SET TELEOP ENABLE TYPE 2222 41 3 4 21 TRAI SET TELEOP VBECIOR TYPE ko e memo kn ee isi 41 3432 EML TRAD STAT TYPE cn ee USE Uy RUE AE 41 BMC MOTION ovs ge erbaut bes fos ar eut v uU eem iue s s 42 EMC MOTION INIT EXPE e sk RR Rc Baar 42 332 EMC MOTION HALT is sk Po ka hk c E ko KMK Rum vox kon 22 e 42 Sd EMU MOTION ABORT lt lt 12400 Kaas KONEEN IS oh 4
20. Oe XO ee 51 3 0 COOLANT ir d ann p 52 2 00 EMC COODLANT INIT TYPE 400g ES ROO ran 52 S102 EMC COOLANT HALI TYPE eee he Roti YR innen 52 3 10 3 COOLANT ABORT E Rom ROSEO SRA ei 52 3104 EMC COOLANT MIST ON TYPE kx ode ren eee den 52 3105 EMC CODLANT MIST SER nd ee ea 53 3100 EMC COOLANT FLOOD ON pas k sf RIN heran 53 3 1097 COOLANT FLOOD TYPE 22 4 544 560 Reese 53 Developer Manual V2 5 2015 10 24 ix EMC COOLANT STAT TYPE sudo ER eR eR 53 3 11 BNI LUBE 2 2 42 E UN Bus ed E UR 53 ALI BMC EURE INIT TYPI edd ee BES nee 53 3 112 EMC LUBE TYPE Sah RC Blok EEG 54 31L3 EMC LUBE ABORI Behand 54 SALA EMC LUBE UN TYPE aa KUR RR eR Ge eee ee S 54 34115 EMC LUBE RU dte 54 118 LUBE STAT KINK SEA SASS SH Ra MS OL 55 Ble BRAISED Be Eus xus A OR de TR 55 3 12 1 EMC SET DIO INDEX 2 022 0 oS 55 3 122 EMC SET AIO INDEX
21. TABLE ENTRYY This second tool table update is not needed on random toolchanger machines because there tools don t have a home pocket and instead we just updated the tool in pocket 0 directly 2 23 3 5 M61 FIXME Set current tool number This switches which tool is in the spindle without actually moving the toolchanger or swapping any tools Handled by Interp convert tool change Canon CHANGE TOOL NUMBER settings gt current pocket is assigned the pocket number currently holding the tool specified by the O word argument Ithink this m code is broken 2 23 3 6 G41 G41 1 G42 G42 1 Enable cutter radius compensation usually called cutter comp Handled by Interp convert cutter compensation on No Canon call cutter comp happens in the interpreter Uses the tool table in the expected way if a D word tool number is supplied it looks up the pocket number of the specified tool number the table and if no D word is supplied it uses pocket 0 the spindle 2 23 3 7 G40 Cancel cutter radius compensation Handled by Interp convert cutter compensation off No Canon call cutter comp happens in the interpreter Does not use the tool table 2 23 4 Internal state variables This is not an exhaustive list Tool information is spread through out LinuxCNC Developer Manual V2 5 2015 10 24 26 77 2 23 4411 10 emcioStatus is of type EMC IO STAT emcioStatus tool pocketPrepped When
22. TYPE bee cm opm OR 55 3123 EMC SET POLARITY TYPE Room eR moy Roe x Yee 55 EN SE PL LLL 55 EMC IO INIT E eG m Ban RR hae RS ALKOI e un 55 2455 EMC IO HALL onem mero om edes ine meom ehem rok etd Reed 56 2123 EMC LABORT pe 2 2 dun be eee SORTE E 56 3 134 EMC IO SET CYCLE TIME sia o m a ee RR Rm ec 56 ENM STAT TIPE 222222502255 SAAS EES ew x ERPS 56 3 4 EMEC INIT HALT Q ABORT quus RO er en 56 INET shh kos ee o OR bee eee bE 56 EMC HALL TYPE nenne UR Ras ES Um 57 2442 EMC ABORT TYPE hee a ee ee 57 A ee EOE EAE CREPES TT 57 k LOG OPEN X YER ou NIRE d sS 57 2452 EMC LOG START TYPE he ie e 57 2 155 EMC LOG STOP TYPE cde eee eee eek Son Ade GE SACR OR 57 3454 EMC LOG CLOSE 245440554 em ROT eae 58 SOP See eo be ea eis SE SAS dob e GS 58 SAG ENG aS a eee AS quee Ee acp desine 58 4 Coding Style 59 be Ee eee in BLESS SEES 59 D C NA onde Be ee SS arte Be GS wee ote we 59 43 Ing nbladO
23. Type index unsigned char start double end double Developer Manual V2 5 2015 10 24 43 77 3 5 6 EMC MOTION STAT TYPE Description NML Type status for motion not sent as a message but used as is 399 Written From none Read To none Parameter Type heartbeat unsigned long int EMC TRAJ STAT AXIS MAX EMC AXIS STAT 3 6 EMCTASK 3 6 1 EMC TASK INIT TYPE Description NML Type calls the Task init 501 Obs not used emcTasklnit called directly from emctask startup Written From none Read emcTaskIssueCommand emctaskmain cc calls emcTaskInit Parameter Type 3 6 2 EMC TASK HALT TYPE Description NML Type 502 Written From none Read To none Parameter Type 3 6 3 TASK ABORT TYPE Description NML Type aborts task cleans up 503 Obs used on shutdown Written From sendAbort emcsh cc Read To emcTaskIssueCommand emctaskmain cc aborts all Parameter Type 3 6 4 TASK SET MODE Description NML Type sets current TASK mode MANUAL MDI AUTO 504 Obs used for switching the current mode Written From sendManual sendMdi sendAuto emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcTaskSetMode emcTask cc Parameter Type mode enum EMC TASK MODE 3 6 5 EMC TASK SET STATE TYPE Description NML Type 505 Written From none Read To none Parameter Type state enum TASK STATE ENUM
24. and index pulse followed by a move to an arbitrary home location For more information about the homing sequence see the homing section of the Integrator Manual 2 7 18 1 Requirements The command will be ignored silently unless the machine is in free mode 2 7 18 2 Results Any jog or other joint motion is aborted and the homing sequence starts Developer Manual V2 5 2015 10 24 14 77 2 7 19 JOG CONT The JOG CONT command initiates a continuous jog on a single joint A continuous jog is generated by setting the free mode trajectory planner s target position to a point beyond the end of the joint s range of travel This ensures that the planner will move constantly until it is stopped by either the joint limits or an ABORT command Normally a GUI sends a JOG CONT command when the user presses a jog button and ABORT when the button is released 2 7 19 1 Requirements The command handler will reject the JOG CONT command with an error message if machine is not in free mode or if any joint is in motion GET MOTION INPOS FLAG FALSE or if motion is not enabled It will also silently ignore the command if the joint is already at or beyond its limit and the commanded jog would make it worse 2 7 19 2 Results The free mode trajectory planner for the joint identified by emcmotCommand gt axis is activated with a target position beyond the end of joint travel and a velocity limit of emcmotCommand gt vel This starts the joint mo
25. be replaced with a single copy If there are multiple Invariant Sections with the same name but different contents make the title of each such section unique by adding at the end of it in parentheses the name of the original author or publisher of that section if known or else a unique number Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work In the combination you must combine any sections entitled History in the various original documents forming one section entitled History likewise combine any sections entitled Acknowledgements and any sections entitled Dedications You must delete all sections entitled Endorsements 6 COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License and replace the indi vidual copies of this License in the various documents with a single copy that is included in the collection provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects Developer Manual V2 5 2015 10 24 75 77 You may extract a single document from such a collection and distribute it individually under this License provided you insert a copy of this License into the extracted document and follow this License in all other respects regarding verbatim copying of that document 7 AGGREGATION WITH INDEPENDENT WORKS A compil
26. branch from the upstream branch possibly editing commits dropping commits or squashing combining commits with others Rebase can also be used to split individual commits into multiple new commits 5 7 7 Make sure every commit builds If your change consists of several patches git rebase i may be used to reorder these patches into a sequence of com mits which more clearly lays out the steps of your work A potential consequence of reordering patches is that one might get dependencies wrong for instance introducing a use of a variable and the declaration of that variable only follows in a later patch While the branch HEAD will build not every commit might build in such a case That breaks git bisect something somebody else might use later on to find the commit which introduced a bug So beyond making sure your branch builds it is important to assure every single commit builds as well There s an automatic way to check a branch for each commit being buildable see http dustin sallings org 2010 03 28 git test sequence html and the code at https github com dustin bindir blob master git test sequence Use as follows in this case testing every commit from origin master to HEAD including running regression tests cd linuxcnc dev git test sequence origin master src make runtests This will either report All s well or Broke on commit 5 7 8 Renaming files Please use the ability to rename files very cautiously
27. cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisJog taskintf cc which sends EMCMOT JOG CONT Parameter Type axis in EMC AXIS MSG int ve double 3 3 24 AXIS INCR JOG TYPE Description NML Type jogs an axis with an increment 125 Obs used on jogging Written From sendJogIncr emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisIncrJog taskintf cc which sends INCR Parameter Type axis in EMC AXIS CMD MSG int incr double vel double 3 3 25 AXIS ABS JOG TYPE Description NML Type jogs an axis with an absolute value 126 Obs not used only read Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisAbsJog taskintf cc which sends EMCMOT JOG ABS Parameter Type axis in EMC AXIS CMD MSG int double vel double Developer Manual V2 5 2015 10 24 34 77 3 3 26 EMC AXIS ACTIVATE TYPE Description NML Type 127 Obs not used Written From none Read To none Parameter Type axis in EMC AXIS MSG int 3 3 27 AXIS DEACTIVATE Description NML 128 Obs not used Written From none Read To none Parameter Type axis in EMC AXIS CMD MSG int 3 3 28 EMC AXIS OVERRIDE LIMITS TYPE Description NML Type overrides min max limits during homing 129 Obs used from tkemc amp mini through emc override limit Written From sendOver
28. covering how they work together This document is very much a work in progress and its layout may change in the future 2 3 Termsand definitions AXIS An axis is one of the nine degrees of freedom that define a tool position in three dimensional Cartesian space Those nine axes are referred to as X Y Z A B C U V and W The linear orthagonal coordinates X Y and Z determine where the tip of the tool is positioned The angular coordinates A B and C determine the tool orientation A second set of linear orthagonal coordinates U V and W allows tool motion typically for cutting actions relative to the previously offset and rotated axes Unfortunately axis is also sometimes used to mean a degree of freedom of the machine itself such as the saddle table or quill of a Bridgeport type milling machine On a Bridgeport this causes no confusion since movement of the table directly corresponds to movement along the X axis However the shoulder and elbow joints of a robot arm and the linear actuators of a hexapod do not correspond to movement along any Cartesian axis and in general it is important to make the distinction between the Cartesian axes and the machine degrees of freedom In this document the latter will be called joints not axes The GUIs and some other parts of the code may not always follow this distinction but the internals of the motion controller do e JOINT A joint is one of the movable pa
29. for chatter caused by the cutter s teeth Spindle Speed Override assumes that the LinuxCNC software has been configured to control spindle speed Stepconf An LinuxCNC configuration wizard It is able to handle many step and direction motion command based machines It writes a full configuration after the user answers a few questions about the computer and machine that LinuxCNC is to run on Stepper Motor A type of motor that turns in fixed steps By counting steps it is possible to determine how far the motor has turned If the load exceeds the torque capability of the motor it will skip one or more steps causing position errors TASK The module within LinuxCNC that coordinates the overall execution and interprets the part program Tel Tk A scripting language and graphical widget toolkit with which several of LinuxCNCs GUIs and selection wizards were written Traverse Move A move in a straight line from the start point to the end point Units See Machine Units Display Units or Program Units Unsigned Integer A whole number that has no sign In HAL it is known as u32 An unsigned 32 bit integer has a usable range of zero to 4 294 967 296 World Coordinates This is the absolute frame of reference It gives coordinates in terms of a fixed reference frame that is attached to some point generally the base of the machine tool Developer Manual V2 5 2015 10 24 72177 Chapter 7 Legal Section 7 1 Copyright Terms
30. in the document and put the following copyright and license notices just after the title page Copyright c YEAR YOUR NAME Permission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 1 1 or any later version published by the Free Software Foundation with the Invariant Sections being LIST THEIR TITLES with the Front Cover Texts being LIST and with the Back Cover Texts being LIST A copy of the license is included in the section entitled GNU Free Documentation License If you have no Invariant Sections write with no Invariant Sections instead of saying which ones are invariant If you have no Front Cover Texts write no Front Cover Texts instead of Front Cover Texts being LIST likewise for Back Cover Texts If your document contains nontrivial examples of program code we recommend releasing these examples in parallel under your choice of free software license such as the GNU General Public License to permit their use in free software Developer Manual V2 5 2015 10 24 76 77 Chapter 8 Index A acme screw 67 axis 67 B backlash 67 backlash compensation 67 ball nut 67 ball screw 67 CNC 67 comp 68 coordinate measuring machine 68 D display units 68 DRO 68 E EDM 68 EMC 68 EMCIO 68 EMCMOT 68 encoder 68 F feed 68 feed rate 68 feedback 68 feedrate override 68 G G Code 69 GUI 67 69 H HA
31. iosh cc Parameter Type Developer Manual V2 5 2015 10 24 56 77 3 13 2 EMC HALT Description NML 1602 Obs not used Written From none Read To none Parameter Type 3 13 3 EMC ABORT TYPE Description NML Type 1603 Obs not used Written From none Read To none Parameter Type 3 13 4 EMC SET CYCLE TIME Description NML Type 1604 Obs not used Written From none Read To none Parameter Type cycleTime double 3 13 5 EMC STAT TYPE Description NML Type status for IO not sent as a message but used as is 1699 Written From none Read To none Parameter Type heartbeat unsigned long int too EMC TOOL STAT spindle EMC SPINDLE STAT coolant EMC COOLANT STAT aux EMC AUX STAT lube EMC LUBE STAT 3 14 EMCINIT HALT amp ABORT 3 14 1 EMC INIT TYPE Description NML Type 1901 Obs not used Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24 57 77 3 14 2 HALT Description NML 1902 Obs not used Written From none Read To none Parameter Type 3 14 3 EMC ABORT TYPE Description NML Type 1903 Obs not used Written From none Read To none Parameter Type 3 15 EMCLOG 3 15 1 EMC LOG OPEN TYPE Description NML Type opens the log file 1904 Obs not used in 2 it was used in EMC 1 from emclog tcl Written From
32. is added Much of that code is identical or nearly identical for every parameter 2 8 Backlash and Screw Error Compensation Developer Manual V2 5 2015 10 24 16 77 2 9 Task controller EMCTASK 2 10 controller EMCIO 2 11 User Interfaces 2 12 libnml Introduction libnml is derived from the NIST rcslib without all the multi platform support Many of the wrappers around platform specific code has been removed along with much of the code that is not required by LinuxCNC It is hoped that sufficient compatibility remains with rcslib so that applications can be implemented on non Linux platforms and still be able to communicate with LinuxCNC This chapter is not intended to be a definitive guide to using libnml or rcslib instead it will eventually provide an overview of each C class and their member functions Initially most of these notes will be random comments added as the code scrutinized and modified 2 13 LinkedList Base class to maintain a linked list This is one of the core building blocks used in passing NML messages and assorted internal data structures 2 14 LinkedListNode Base class for producing a linked list Purpose to hold pointers to the previous and next nodes pointer to the data and the size of the data No memory for data storage is allocated 2 15 SharedMemory Provides a block of shared memory along with a semaphore inherited from the Semaphore class Creation and destruction of th
33. is not Transparent is called Opaque Examples of suitable formats for Transparent copies include plain ASCII without markup Texinfo input format LaTeX input format SGML or XML using a publicly available DTD and standard conforming simple HTML designed for human modi fication Opaque formats include PostScript PDF proprietary formats that can be read and edited only by proprietary word processors SGML or XML for which the DTD and or processing tools are not generally available and the machine generated HTML produced by some word processors for output purposes only The Title Page means for a printed book the title page itself plus such following pages as are needed to hold legibly the material this License requires to appear in the title page For works in formats which do not have any title page as such Title Page means the text near the most prominent appearance of the work s title preceding the beginning of the body of the text 2 VERBATIM COPYING You may copy and distribute the Document in any medium either commercially or noncommercially provided that this License the copyright notices and the license notice saying this License applies to the Document are reproduced in all copies and that you add no other conditions whatsoever to those of this License You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute However you may accept compensation in exch
34. src emc nml intf emctool h with CANON PO CKETS MAX entries Indexed by pocket number aka slot number Index 0 is the spindle indexes 1 POCKETS 1 are the pockets in the tool changer On a random toolchanger pocket numbers are meaningful On a nonrandom toolchanger pockets are meaningless the pocket numbers in the tool table file are ignored and tools are assigned to tool table slots sequentially settings tool change at 230 settings tool change guill settings tool change with spindle These are set from ini variables in the EMCIO section and control how tool changes are performed Developer Manual V2 5 2015 10 24 28 77 Chapter 3 NML Messages 3 1 EMC OPERATOR 3 1 1 EMC OPERATOR ERROR TYPE Description NML Type textual error message to the operator 11 Written From emccanon cc iosh cc Read To emctaskmain cc emcsh cc Parameter Type error char LINELEN 3 1 2 EMC OPERATOR TEXT TYPE Description NML Type textual information message to the operator 12 Written From emctaskmain cc Read To emctaskmain cc emcsh cc Parameter Type text char LINELEN 3 1 3 EMC OPERATOR DISPLAY TYPE Description NML Type URL or filename of a document to display 13 Obs not used only read Written From none Read To emctaskmain cc emcsh cc Parameter display char LINELEN 3 2 NULL SET DEBUG amp SYSTEM 3 2 1 EMC NULL TYPE Desc
35. to an embedded system that does not implement NML UDP protocols have fewer checks on data and allows a percentage of packets to be dropped TCP is more reliable but is marginally slower If LinuxCNC is to be connected to a network one would hope that it is local and behind a firewall About the only reason to allow access to LinuxCNC via the Internet would be for remote diagnostics This can be achieved far more securely using other means perhaps by a web interface The exact behavior when timeout is set to zero or a negative value is unclear from the NIST documents Only INF and positive values are mentioned However buried in the source code of rcslib it is apparent that the following applies timeout gt 0 Blocking access until the timeout interval is reached or access to the buffer is available timeout 0 Access to the buffer is only possible if no other process is reading or writing at the time timeout 0 or INF Access is blocked until the buffer is available 2 21 NML base class Expand on the lists and the relationship between NML NMLmsg and the lower level cms classes Not to be confused with NMLmsg RCS STAT MSG or RCS CMD MSG NML is responsible for parsing the config file configuring the cms buffers and is the mechanism for routing messages to the correct buffer s To do this NML creates several lists for cms buffers created or connected to processes and the buffers they connect to along list of forma
36. 0 or you re doing something wrong Re think the function and split it into smaller pieces A human brain can generally easily keep track of about 7 different things anything more and it gets confused You know you re brilliant but maybe you d like to understand what you did 2 weeks from now 4 7 Commenting Comments are good but there is also a danger of over commenting NEVER try to explain HOW your code works in a comment it s much better to write the code so that the working is obvious and it s a waste of time to explain badly written code Developer Manual V2 5 2015 10 24 61 77 Generally you want your comments to tell WHAT your code does not HOW A boxed comment describing the function return value and who calls it placed above the body is good Also try to avoid putting comments inside a function body if the function is so complex that you need to separately comment parts of it you should probably re read the Functions section again You can make small comments to note or warn about something particularly clever or ugly but try to avoid excess Instead put the comments at the head of the function telling people what it does and possibly WHY it does it If comments along the lines of Fix me are used please please say why something needs fixing When a change has been made to the affected portion of code either remove the comment or amend it to indicate a change has been made and needs testing 4 8 Shell Scri
37. 0 which represents the spindle So after a tool change pocket 0 in the tool table has the tool information for the new tool and the pocket that the new tool came from has the tool information for the old tool the tool that was in the spindle before the tool change if any Note In LinuxCNC configured for random toolchanger tool 0 TO has no special meaning It is treated exactly like any other tool in the tool table It is customary to use TO to represent no tool ie a tool with zero TLO so that the spindle can be conveniently emptied when needed 2 23 2 The Tool Table LinuxCNC keeps track of tools in a file called the tool table The tool table records the following information for each tool tool number An integer that uniquely identifies this tool Tool numbers are handled differently by LinuxCNC when configured for random and nonrandom toolchangers When LinuxCNC is configured for a nonrandom toolchanger this number must be positive TO gets special handling and is not allowed to appear in the tool table Developer Manual V2 5 2015 10 24 23 77 When LinuxCNC is configured for a random toolchanger this number must be non negative TO is allowed in the tool table and is usually used to represent no tool ie the empty pocket pocket number An integer that identifies the pocket or slot in the toolchanger hardware where the tool resides Pocket numbers are handled differently by LinuxCNC when configured for
38. 12 2 Results Currently nothing The old watchdog was a strange thing that used a specific sound card A new watchdog interface may be designed in the future 2 7 13 PAUSE The PAUSE command stops the trajectory planner It has no effect in free or teleop mode At this point I don t know if it pauses all motion immediately or if it completes the current move and then pauses before pulling another move from the gueue 2 7 13 1 Reguirements None The command can be issued at any time and will always be accepted 2 7 13 2 Results The trajectory planner pauses 2 7 14 RESUME The RESUME command restarts the trajectory planner if it is paused It has no effect in free or teleop mode or if the planner is not paused 2 7 44 4 Requirements None The command can be issued at any time and will always be accepted 2 7 14 2 Results The trajectory planner resumes 2 7 15 STEP The STEP command restarts the trajectory planner if it is paused and tells the planner to stop again when it reaches a specific point It has no effect in free or teleop mode At this point I don t know exactly how this works add more documentation here when I dig deeper into the trajectory planner Developer Manual V2 5 2015 10 24 13 77 2 7 15 1 Reguirements None The command can be issued at any time and will always be accepted 2 7 15 2 Results The trajectory planner resumes and later pauses when it reaches a specific point 2 7
39. 2 334 EMC MOTION SET ADUE 222222225595 N As NUES 42 353 EMC MOTION SET DOUT TYPE 22222222222 222222522 24 42 330 MOTION eh UR RR RR 43 Ek God IA OE S BOR ER e beg 43 261 DASK INIT TYPE SSA Ea Kian katie SS vd 43 Ae EMC TASK HALE hs eseo ia nee 43 3 6 3 EMC TASK ABORT 624i 20 sd ob wae ee we 225525955 de ew Xo e x wy d 43 64 EMC TASK SET MODE 2552 25 IRSE Cede Eo SES E 43 4103 EMC TASK SET SIATE TYPE EIS E RISORSE SUUS 43 366 TASK PLAN OPEN TYPE os ceco 4 64 ebb Re 9o f Rh ea ree POR OR 44 287 EMC TASK PLAN TYPE k OR Rok E e E de ee 44 29524 EMC TASK PLAN READ ea 8 Ken S A 44 TASK PLAN Fre 44 EMC TASK PLAN PAUSE Re we en 44 3611 EMC TASK PLAN STEP need ee 44 2012 EMC TASK PLAN RESUME 2405 ese ek ce bed 45 32 0 15 EMC TASK PLAN END TYPE EON KOIN 62 45 3 6 14 TASK PLAN CLOSE ere Le ee hal Yo 45 30615 EMC TASK PLAN TYPE 222222225552 EUR o 45 3 6 16 EMC TASK PLAN SYNCH vua 45
40. 2225 si Serta wn des 22 2222 Ehe Tool Dale Yo e RON Av 40808 8 22 2 4233 OpbodesaffecOng 10018 0 044 344 488 KA ARA 1 kon kos n GA 23 Developer Manual V2 5 2015 10 24 v TRE MEME 23 SO i e 23 2 2333 CMOICHE DOMO EN ERS PER IERI REG x we 24 223 94 DIOLELBHWEIL ROUES A Ba RU 24 212333 2222 2222 eb ee Pt ee hans 25 22030 AACE GI Ae 25 GAO od She eae led ed ESR EWES amp x 25 2 234 Internal state variables 22 s 08 8 Ran reine EACUS RE ee 25 A Cc 26 Were Sm eed REGE d 26 3 NML Messages 28 Ad OBNICOPBENIOR EERE ee Eie edt BR ee ee 28 ALI OPERATOR ERROR TYPE Er aa nen 28 312 EMC OPERATOR TEXT TYPE 2222 2 222222522222 4 2 2 28 3 1 3 EMC OPERATOR DISPLAY TYPE ocene 2033 REG Rog Rae ee ee 28 3 2 EMC NULL SET DEBUG 6 SYSTEM 2 2 2 2 28 AI EM NULL s douce EUR RR ROBUR RU a ee ee 16 28 422 EMC SET DEBUG v o zepa ae Xue 29 323 EMIL SYSTEM CMD TYPE a
41. A X RE SR 8 29 23 BMC SIS RC rcc 29 33 1 EMC AXIS SET AXIS TYPE 29 3 42 EMC AXIS SET UNITS TYPE ee UE X BAe Sk 29 433 EMC AXIS SEI GAINS TYPE nue kun ea BESS a bode PRA 29 234 EMC AXIS SET CYCLE TIME ee Ges RR 29 3 353 EMC AXIS SET INPUT SCALE 2 2 2 2252 30 3 3 6 AXIS SET OUTPUT SCALE 30 3 37 EMC AXIS SET MIN POSITION LIMIT TYPE 30 3 3 8 AXIS SET MAX POSITION LIMIT 30 3 3 9 AXIS SET MIN OUTPUT LIMIT TYPE 22222 2 2 22 30 3 3 10 AXIS SET MAX OUTPUT LIMIT TYPE 30 3 3 11 AXIS SEI PERROR 22 22 222 31 3 3 12 AXIS SET HOMING VEL TYPE 31 33 13 EMC AXIS SEI HOME TYPE 2 5 150444 x23 5240400 2 ED Ee 31 3 3 14 AXIS SET OPPSET TYPE 2 zu 25 254 05 668 bee X E Ro Robes 6 9 31 3 3 15 AXIS SET MIN FERROR 31 3 3 16 AXIS SET MAX VELOCITY TYPE 32 EMC AXK TYPE Berka 32 3 3 18 EMC AXIS HAIT TYPE f GE URGE hun 32
42. C source is maintained in the revision control system git 5 4 1 LinuxCNC official git repo The official LinuxCNC git repo is at http git linuxcnc org The anonymous clone command is git clone git git linuxcnc org git linuxcnc git linuxcnc dev http git sem com Developer Manual V2 5 2015 10 24 64 77 If you are a registered developer with push access the ssh clone command is git clone ssh YOUGgit linuxcnc org git linuxcnc git linuxcnc dev Note that both the clone commands put the local LinuxCNC repo in a directory called linuxcnc dev instead of the default linuxcnc This is because the LinuxCNC software by default expects configs and G code programs in a directory called HOME linuxcnc and having the git repo there too is confusing 5 4 2 LinuxCNC on github There is a regularly updated git clone on github https github com jepler linuxcnc mirror 5 4 3 git tutorials There are many excellent free git tutorials on the internet The first place to look is probably the gittutorial manpage This manpage is accessible by running man gittutorial in a terminal if you have the git manpages installed The gittutorial and its follow on documentation are also available online here e git tutorial https www kernel org pub software scm git docs gittutorial html e git tutorial 2 https www kernel org pub software scm git docs gittutorial 2 html Everyday git with 20 commands or so https www kernel
43. CLE TIME TYPE Description NML Type cycle time for the servo task 104 Written From none Read To emctaskmain cc Parameter Type axis in AXIS CMD MSG int cycleTime double Developer Manual V2 5 2015 10 24 30 77 3 3 5 AXIS SET INPUT SCALE Description NML Type scale factor and offset for the position input 105 Obs currently if 0 ed used only directly from iniaxis Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetInputScale minimilllbridgeporttaskintf cc which sends EMCMOT SET INPUT SCALE Parameter Type axis in AXIS CMD MSG int scale double offset double 3 3 6 AXIS SET OUTPUT SCALE Description NML Type scale factor and offset for the position output 106 Obs currently if 0 ed used only directly from iniaxis Written From none Read To emcTaskIssueCommand emctaskmain cc Parameter Type axis in AXIS CMD MSG int scale double offset double 3 3 7 EMC AXIS SET MIN POSITION LIMIT TYPE Description NML Type sets min limit 107 Obs also handled by iniaxis which directly calls emcAxisSetMinPositionLimit Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetMinPositionLimit taskintf cc which sends EMCMOT SET POSITION LIMITS Parameter Type axis in AXIS MSG int limit double 3 3 8 AXIS SET MAX POSITION LIMIT TYPE Description NML Typ
44. Description NML Type status for traj not sent as a message but used as is 299 Written From none Read To none Parameter Type a HUGE load of params Developer Manual V2 5 2015 10 24 42 77 3 5 3 5 1 Description NML 301 Obs not used Written From none Read To none Parameter Type 3 5 2 EMC MOTION HALT TYPE Description NML Type 302 Obs not used Written From none Read To none Parameter Type 3 5 3 EMC MOTION ABORT TYPE Description NML Type 303 Obs not used Written From none Read To none Parameter Type 3 5 4 EMC MOTION SET AOUT TYPE Description NML Type sets an analog output value coordinated with motion 304 Obs emccanon cc currently lacks this in EMC2 not used in EMC2 needs to go to HAL Written From none Read emcTaskIssueCommand emctaskmain cc calls emcMotionSetAout minimill bridgeporttaskintf cc which sends SET AOUT Parameter index unsigned char start double end double now unsigned char 3 5 5 EMC MOTION SET DOUT TYPE Description NML Type sets an digital output value coordinated with motion 305 Obs emccanon cc currently lacks this in EMC2 not used in EMC2 needs to go to HAL Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcMotionSetDout minimill bridgeporttaskintf cc which sends EMCMOT SET DOUT Parameter
45. Developer Manual V2 5 2015 10 24 2 8 2 9 2 10 2 11 2 12 2 13 2 14 243 2 16 2 17 2 18 2 19 2 20 2 21 222 222 2 120 a 14 C CT 14 3211 14 27252 224 ee PR 555 OBA a REOS OR RE So ae 15 INO Sue e ie eg a gant ee EMS ed due TS dp Sos S s 15 24 23 CIRCLE PA ee e 15 2 324 SET TELEOP VECTOR 26 s Ro Echo o Rom cot Eo m XA dC EUR 15 2 1549 PROBE eee ede Top OE Ye ede n eid ne 15 27 26 PROBE NUR 5 15 Eu vue Seed ues oe we Be ew ie od d 15 Backlash and Screw Error Compensation 2 2 15 Task controler lt 2 Pass kia Pahkin m PKA dem 16 IO controller EMCIO E Xo X 3 9 X3 3 3 16 User Internat cogo pondo PY ORR SURE RORIS RURSUS UE EUR ee erh E 16 ItrodacHof 22202222254 ome moy EURO Xo Xo ko Re Ro e xD yo e XL m 16 lt lt lt ssa uk gg E RR Eh Bas 16 ou ion lon Go 3
46. Developer Manual V2 5 2015 10 24 Developer Manual V2 5 2015 10 24 Developer Manual V2 5 2015 10 24 ii Contents 1 Introduction 1 2 Code Notes 2 2A Tntended audience eke Kaa kisan eg EEG TT 2 Zu MARTA c bre ep Erud ee nee de qmi suite eee ded W 2 2 3 dele lt lt ls oe 552 a SOS E 2 cus su RE NR E koh ORO Nur EAD Ne Ow ein 8 3 23 Motion Controller Introduction vs sl os RR ES KOR KIN 5 26 Bl ckdweanms and Data Plow 22 22 2225 Bom SOEUR Or ms 4 09 de SOROR EUR 7 Of OIS IET 8 ie meer Gwe ele x 8 22220 Ka k REAL SSA eh 8 2012 ROAS PCT 8 2 12 FREE Eo n Mie ee Gea EA NUS e 8 4721 Reem k RR d mom eh 9 NOCET ee 9 2 59 TBEBOP s goe te eee bi eb AER She we E 9 2741 222200 beta D Rm mm t Bobo S 8 t E GR m 9 LET E I ETE 9 2 55 COORD de Be Ue v a eR m dee 9 2741 22222 oro Rho obo 25 9 EP SON Io NM EDT 10 BNABLE 222525652 wem ee v
47. Developer Manual V2 5 2015 10 24 44 77 3 6 6 TASK PLAN OPEN Description NML Type 506 Written From none Read To none Parameter file char LINELEN 3 6 7 EMC TASK PLAN RUN TYPE Description NML Type 507 Written From none Read To none Parameter Type line int 3 6 8 EMC TASK PLAN READ TYPE Description NML Type 508 Written From none Read To none Parameter Type 3 6 9 EMC TASK PLAN EXECUTE TYPE Description NML Type 509 Written From none Read To none Parameter Type command char LINELEN 3 6 10 EMC TASK PLAN PAUSE TYPE Description NML Type 510 Written From none Read To none Parameter Type 3 6 11 EMC TASK PLAN STEP TYPE Description NML Type 511 Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24 45 77 3 6 12 EMC TASK PLAN RESUME TYPE Description NML Type 512 Written From none Read To none Parameter Type 3 6 13 EMC TASK PLAN END TYPE Description NML Type 513 Written From none Read To none Parameter Type 3 6 14 EMC TASK PLAN CLOSE TYPE Description NML Type 514 Written From none Read To none Parameter Type 3 6 15 EMC TASK PLAN INIT TYPE Description NML Type 515 Written From none Read To none Parameter Type 3 6 16 EMC TASK PLAN SYNCH TYPE Description NML Type 516 Written From none Read To none Parameter Type
48. Developer Manual V2 5 2015 10 24 vi 3 3 10 EMC AXIS ABORT 2222 22 ee Re 32 Ad BMC AXIS ENABLE oi 4 P GUESS SOY heeds REG SE SES eee S S d 32 3 3 21 EMC AXIS DISABLE 55 54 54455 m RE e a ee a 33 3 3 22 EMC AXIS TYPE 24 64 68 RR nee eee ee dea ee 33 oes EMC AXIS JOKE TSE oou eu ee eee Ee a ewe Slyn Sue ss 33 3 3 24 EMC ANIS INCR JOG e G 33 3 3 25 EMC AXIS ABS JOG TYPE lt doo Roo d ko ok ho A ew ae 0 33 2220 EMC AXIS ACTIVATE TYPE pe 2554842544 ee eb be ehem om EGRE E e eR 34 2222 EMC AXIS DBACTIVATE 222525556 GU Ou RU ROG X ea eat 34 328 EMC ANIS OVERRIDE LIMITS 2266 es K ek EN Na Pew 34 3 249 EMC AXIS SET OUTPUT 34 3 3 30 AXIS LOAD 2 2 2 225222 2 2 2 34 Am EMU AXIS TYPO LEENI See bbe ES E EES 35 3 3 32 EMC AXIS SET STEP PARAMS 1 55 A x RR RI N KON NUES st 35 2 9 49 EMC AXIS STAT TYPE uoc ERE ea ee aan m e x does e Oe voe Reden 35 EMG TRAL o opins e RR URGE ERREUR EGRE RD den 35 EMC TRAJ SET AXES TYPE oe cad Yah awn ee OMI Nie 35 242 EMC TRAJ SET UNITS
49. H controls which of these kinds of hardware LinuxCNC thinks it s connected to 2 23 1 1 Nonrandom Toolchangers Nonrandom toolchanger hardware puts each tool back in the pocket it was originally loaded from Examples of nonrandom toolchanger hardware are the manual toolchanger lathe tool turrents and rack toolchangers When configured for a nonrandom toolchanger LinuxCNC does not change the pocket number in the tool table file as tools are loaded and unloaded Internal to LinuxCNC on tool change the tool information is copied from the tool table s source pocket to pocket 0 which represents the spindle replacing whatever tool information was previously there Note In LinuxCNC configured for nonrandom toolchanger tool 0 TO has special meaning no tool TO may not appear in the tool table file and changing to TO will result in LinuxCNC thinking it s got an empty spindle 2 23 1 2 Random Toolchangers Random toolchanger hardware swaps the tool in the spindle if any with the requested tool on tool change Thus the pocket that a tool resides in changes as it is swapped in and out of the spindle An example of random toolchanger hardware is a carousel toolchanger When configured for a random toolchanger LinuxCNC swaps the pocket number of the old and the new tool in the tool table file when tools are loaded Internal to LinuxCNC on tool change the tool information is swapped between the tool table s source pocket and pocket
50. L 69 home 69 I INI 69 Instance 69 J jog 69 joint coordinates 69 K kinematics 69 L lead screw 69 loop 70 M machine units 69 MDI 69 N NIST 69 NML 70 offsets 70 part Program 70 program units 70 R rapid 70 rapid rate 70 real time 70 RS274NGC 70 RTAI 70 RTAPI 70 RTLINUX 70 S servo motor 70 Signed Integer 70 spindle 70 stepper motor 71 T TASK 71 Tk 71 Traverse Move 71 Developer Manual V2 5 2015 10 24 77177 U units 71 Unsigned Integer 71 W world coordinates 71
51. R o ssa mukai Ed Gea Ru PEED HE 59 44 BEADES 222222252255 ee eek eek Ge CR REUS eS 59 45 Name PERE AE Reha eae ea ee ERR eek See o Gea 60 46 Punetion ss vs son eR OE EORR ee ee ee 60 S uon ie eo i eee Seid a eee Gets be 60 48 Shell Scripts amp Makehles lt a sa A ER Re gum Re eee a 61 AI Conventions 222222252525 dg R Ros wo E RA 61 4 10 Python coding standards p o oom ye Ux ea ewm Re AO 62 4 11 Comp coding standards lt lt u s A kokon Roo ae e ea ee n 62 Developer Manual V2 5 2015 10 24 x 5 Contributing to LinuxCNC 63 31 ons p Rede EUR X CR E ok nom ee Eae len Thy 63 32 Communication among Linux CNC developers QC Na 63 33 Thebianxt Source Forge project s 22555655654 ran 63 54 The git Revision Control System se poe eo RR Rm RR t KAI K m EUR e 63 SELL anus IE DUICISE SE ov wR ener Bee te Oe eee Se Sa 63 342 e Ee om Roh 64 343 quta BS m Ege de RR EON P de Rl i 64 Dor KRIISIT POCOS eun mee e WAS iesu se 64 5 2 22 ETT
52. T TOOL emccanon cc Read To emcTaskIssueCommand emctaskmain cc calls emcToolPrepare iotaskintf cc which sends it to the IO controller Parameter Type too int Developer Manual V2 5 2015 10 24 47 77 3 7 5 EMC TOOL LOAD TYPE Description NML Type changes the current tool with the prepared tool 1105 Obs loads the actual tool makes toolprepped 0 Written From CHANGE TOOL emccanon cc Read To emcTaskIssueCommand emctaskmain cc calls emcToolLoad iotaskintf cc which sends it to the IO controller main simloControl cc ioControl cc Parameter Type 3 7 6 EMC TOOL UNLOAD TYPE Description NML Type unloads the current tool from the spindle 1106 Obs unloads the current tool not written in EMC2 only read Written From none Read emcTaskIssueCommand emctaskmain cc calls emcToolUnLoad iotaskintf cc which sends it to the IO controller main simIoControl cc ioControl cc Parameter Type 3 7 7 TOOL LOAD TOOL TABLE Description NML Type loads the tool table without this tool comp can t be made 1107 Written From sendLoadToolTable emcsh cc Read To none Parameter Type file char LINELEN 3 7 8 EMC TOOL SET OFFSET TYPE Description NML Type 1108 Written From none Read To none Parameter Type tool int length double diameter double 3 7 9 EMC TOOL STAT TYPE Description NML Type 1199 Written From none Read To none Parameter Ty
53. TII 65 37 ENDEN ede RR Ja 65 Hal Lone couv he or doe v e UG Sees 65 5 12 Write goed commit iiessages o ce esete cet eeo k Re or Roh ho Y XO eae POE RO we 65 25 13 Comite the proper BOR we NIE ete m E euh OX 65 5 144 Ussmultipie commits to organize changes 222222222222 EU ES 65 5 55 Follow the style of the surrounding 65 5 7 6 Simplify complicated history before sharing with fellow developers 66 347 Make commu builds s s sas on RE ese m RR AR REARS 66 5 560 Renaming Kes 222222222222 22292 ede P Ee eee 66 2 59 Jeter DARET 225202202 eee oes Y 66 5 9 Other ways a EDO 66 6 Glossary 67 7 Legal Section 72 TA BE Vers in m mA Jt nnas ne 72 72 GNU Free Documentation License 72 8 Index 76 Developer Manual V2 5 2015 10 24 1 77 Chapter 1 Introduction This handbook is a work in progress If you are able to help with writing editing or graphic preparation please contact any member of the writing team or join and send an email to emc usersOlists sourceforge net Copyright O 2000 2012 LinuxCNC org P
54. TUS i Developer Manual V2 5 2015 10 24 5 77 LinuxCNC software architecture At the coarsest level LinuxCNC is a hierarchy of three controllers the task level command handler and program interpreter the motion controller and the discrete I O controller The discrete I O controller is implemented as a hierarchy of controllers in this case for spindle coolant and auxiliary e g estop lube subsystems The task controller coordinates the actions of the motion and discrete I O controllers Their actions are programmed in conventional numerical control G and M code programs which are interpreted by the task controller into NML messages and sent to either the motion or discrete I O controllers at the appropriate times 2 5 Motion Controller Introduction The motion controller receives commands from user space modules via a shared memory buffer and executes those commands in realtime The status of the controller is made available to the user space modules through the same shared memory area The motion controller interacts with the motors and other hardware using the HAL Hardware Abstraction Layer This document assumes that the reader has a basic understanding of the HAL and uses terms like HAL pins HAL signals etc without explaining them For more information about the HAL see the HAL Manual Another chapter of this document will eventually go into the internals of the HAL itself but in this chapter we only use the HAL API a
55. YPE Description NML Type 1313 Written From none Read To none Parameter Type 3 9 14 EMC SPINDLE ENABLE TYPE Description NML Type 1314 Written From none Read To none Parameter Type 3 9 15 EMC SPINDLE DISABLE TYPE Description NML Type 1315 Written From none Read To none Parameter Type 3 9 16 EMC SPINDLE STAT TYPE Description NML Type 1399 Written From none Read To none Parameter Type speed double direction int brake int increasing int enabled int Developer Manual V2 5 2015 10 24 52 77 3 10 EMCCOOLANT 3 10 1 EMC COOLANT INIT Description NML Type initializes the COOLANT controller currently part of the IO controller 1401 Obs not written in EMC2 only read in EMCI it was sent when TOOL INIT was sent Written From none Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type none 3 10 2 COOLANT HALT TYPE Description NML Type stops the COOLANT 1402 Obs not written in EMC2 only read in EMCI it was sent when TOOL HALT was sent Written From none Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type none 3 10 5 EMC COOLANT ABORT TYPE Description NML Type aborts the COOLANT 1403 Obs not written in EMC2 only read in EMCI it was sent when TOOL ABORT was sent Written From none Read To main ioControl cc simloControl cc emc io get comma
56. ancels any motion that is currently in progress 2 7 1 1 Requirements None The command is always accepted and acted on immediately 2 7 1 2 Results In free mode the free mode trajectory planners are disabled That results in each joint stopping as fast as its accel decel limit allows The stop is not coordinated In teleop mode the commanded Cartesian velocity is set to zero I don t know exactly what kind of stop results coordinated uncoordinated etc but will figure it out eventually In coord mode the coord mode trajectory planner is told to abort the current move Again I don t know the exact result of this but will document it when I figure it out 2 7 2 FREE The FREE command puts the motion controller in free mode Free mode means that each joint is independent of all the other joints Cartesian coordinates poses and kinematics are ignored when in free mode In essence each joint has its own simple trajectory planner and each joint completely ignores the other joints Some commands like JOG only work in free mode Other commands including anything that deals with Cartesian coordinates do not work at all in free mode Tt seems that the higher level code TASK and above also use ABORT to clear faults Whenever there is a persistent fault such as being outside the hardware limit switches the higher level code sends a constant stream of ABORTS to the motion controller trying to make the fault go away Thousands of
57. ange for copies If you distribute a large enough number of copies you must also follow the conditions in section 3 You may also lend copies under the same conditions stated above and you may publicly display copies 3 COPYING IN QUANTITY If you publish printed copies of the Document numbering more than 100 and the Document s license notice requires Cover Texts you must enclose the copies in covers that carry clearly and legibly all these Cover Texts Front Cover Texts on the front cover and Back Cover Texts on the back cover Both covers must also clearly and legibly identify you as the publisher of these copies The front cover must present the full title with all words of the title equally prominent and visible You may add other material on the covers in addition Copying with changes limited to the covers as long as they preserve the title of the Document and satisfy these conditions can be treated as verbatim copying in other respects If the required texts for either cover are too voluminous to fit legibly you should put the first ones listed as many as fit reasonably on the actual cover and continue the rest onto adjacent pages If you publish or distribute Opaque copies of the Document numbering more than 100 you must either include a machine readable Transparent copy along with each Opaque copy or state in or with each Opaque copy a publicly accessible computer network location containing a complete Transparent copy of the Do
58. ation of the Document or its derivatives with other separate and independent documents or works in or on a volume of a storage or distribution medium does not as a whole count as a Modified Version of the Document provided no compilation copyright is claimed for the compilation Such a compilation is called an aggregate and this License does not apply to the other self contained works thus compiled with the Document on account of their being thus compiled if they are not themselves derivative works of the Document If the Cover Text reguirement of section 3 is applicable to these copies of the Document then if the Document is less than one guarter of the entire aggregate the Document s Cover Texts may be placed on covers that surround only the Document within the aggregate Otherwise they must appear on covers around the whole aggregate 8 TRANSLATION Translation is considered a kind of modification so you may distribute translations of the Document under the terms of section 4 Replacing Invariant Sections with translations reguires special permission from their copyright holders but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections You may include a translation of this License provided that you also include the original English version of this License In case of a disagreement between the translation and the original English version of this License the original E
59. bably be removed settings toolchange flag Interp sets this to true when calling Canon s CHANGE function It is checked in Interp convert tool length offset to decide which pocket to use for G43 with no H word settings gt current pocket if the tool change is still in progress pocket 0 the spindle if the tool change is complete settings random toolchanger Set from the ini variable EMCIO RANDOM TOOLCHANGER at startup Controls various tool table handling logic IO also reads this ini variable and changes its behavior based on it For example when saving the tool table random toolchanger save the tool in the spindle pocket 0 but non random toolchanger save each tool in its home pocket settings tool offset This is an EmcPose variable Used to compute position in various places Sent to Motion via the EMCMOT SET OFFSET message motion does with the offsets is export them to the HAL pins motion 0 tooloffset xyzabcuvw FIXME export these from someplace closer to the tool table io or interp probably and remove the EMCMOT SET OFFSET message settings pockets max Used interchangably with POCKETS MAX a defined constant set to 56 as of 2012 December 30 FIXME This settings variable is not currently useful and should probably be removed Developer Manual V2 5 2015 10 24 27 77 settings tool table This is an array of CANON TOOL TABLE structures defined in
60. by others This License is a kind of copyleft which means that derivative works of the document must themselves be free in the same sense It complements the GNU General Public License which is a copyleft license designed for free software We have designed this License in order to use it for manuals for free software because free software needs free documentation a free program should come with manuals providing the same freedoms that the software does But this License is not limited to software manuals it can be used for any textual work regardless of subject matter or whether it is published as a printed book We recommend this License principally for works whose purpose is instruction or reference 1 APPLICABILITY AND DEFINITIONS This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License The Document below refers to any such manual or work Any member of the public is a licensee and is addressed as you A Modified Version of the Document means any work containing the Document or a portion of it either copied verbatim or with modifications and or translated into another language A Secondary Section is a named appendix or a front matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document s overall subject or to related matters and contains no
61. chine There are two types of kinematics Forward kinematics is used to calculate world coordinates from joint coordinates Inverse kinematics is used for exactly the opposite purpose Note that kinematics does not take into account the forces moments etc on the machine It is for positioning only Lead screw An screw that is rotated by a motor to move a table or other part of a machine Lead screws are usually either ball screws or acme screws although conventional triangular threaded screws may be used where accuracy and long life are not as important as low cost Machine units The linear and angular units used for machine configuration These units are specified and used in the ini file HAL pins and parameters are also generally in machine units MDI Manual Data Input This is a mode of operation where the controller executes single lines of G code as they are typed by the operator NIST National Institute of Standards and Technology An agency of the Department of Commerce in the United States Developer Manual V2 5 2015 10 24 70 77 NML Neutral Message Language provides a mechanism for handling multiple types of messages in the same buffer as well as simplifying the interface for encoding and decoding buffers in neutral format and the configuration mechanism Offsets An arbitrary amount added to the value of something to make it equal to some desired value For example gcode programs are often written around some convenien
62. ciated with a single joint but does not change the joint s amp enable output pin 2 7 9 Requirements None The command can be issued at any time and will always be accepted 2 7 9 2 Results Calculations for the specified joint are enabled The amp enable pin is not changed however any subsequent ENABLE or DISABLE commands will modify the joint s amp enable pin 2 7 10 DEACTIVATE JOINT The DEACTIVATE JOINT command turns off all the calculations associated with a single joint but does not change the joint s amp enable output pin 2 7 10 1 Requirements None The command can be issued at any time and will always be accepted 2 7 10 2 Results Calculations for the specified joint are enabled The amp enable pin is not changed and subsequent ENABLE or DISABLE commands will not modify the joint s amp enable pin 2 7 11 ENABLE WATCHDOG The ENABLE WATCHDOG command enables a hardware based watchdog if present 2 7 11 1 Requirements None The command can be issued at any time and will always be accepted Developer Manual V2 5 2015 10 24 12 77 2 7 11 2 Results Currently nothing The old watchdog was a strange thing that used a specific sound card A new watchdog interface may be designed in the future 2 7 12 DISABLE WATCHDOG The DISABLE WATCHDOG command disables a hardware based watchdog if present 2 7 12 1 Requirements None The command can be issued at any time and will always be accepted 2 7
63. ck succession each new command changes the target position and the machine goes to the final commanded position The free mode planner accelerates at the joint accel limit at the beginning of the move and will decelerate at the joint accel limit to stop at the target position 2 7 22 SET LINE The SET LINE command adds a straight line to the trajectory planner queue More later 2 7 23 SET CIRCLE The SET CIRCLE command adds a circular move to the trajectory planner queue More later 2 7 24 SET TELEOP VECTOR The SET TELEOP VECTOR command instructs the motion controller to move along a specific vector in Cartesian space More later 2 7 25 PROBE The PROBE command instructs the motion controller to move toward a specific point in Cartesian space stopping and recording its position if the probe input is triggered More later 2 7 26 CLEAR PROBE FLAG The CLEAR PROBE FLAG command is used to reset the probe input in preparation for a PROBE command Question why shouldn t the PROBE command automatically reset the input More later 2 7 27 SET xix There are approximately 15 SET xxx commands where xxx is the name of some configuration parameter It is anticipated that there will be several more SET commands as more parameters are added I would like to find a cleaner way of setting and reading configuration parameters The existing methods require many lines of code to be added to multiple files each time a parameter
64. cking reads are prevented gueue Enables gueued message passing ascii Encode messages in a plain text format disp Encode messages a format suitable for display 222 xdr Encode messages in External Data Representation see rpc xdr h for details diag Enables diagnostics stored in the buffer timings and byte counts 2 20 3 Process line The original NIST format of the process line is P name buffer type host ops server timeout master c num type specific configs P identifies this line as a Process configuration name is the identifier of the process buffer is one of the buffers defined elsewhere in the config file type defines whether this process is local or remote relative to the buffer host specifies where on the network this process is running Ops gives the process read only write only or read write access to the buffer server specifies if this process will running a server for this buffer timeout sets the timeout characteristics for accesses to the buffer master indicates if this process is responsible for creating and destroying the buffer c num an integer between zero and max procs 1 Developer Manual V2 5 2015 10 24 20 77 2 20 4 Configuration Comments Some of the configuration combinations are invalid whilst others imply certain constraints On a Linux system GLOBMEM is obsolete whilst PHANTOM is only really useful in the testing stage of an application li
65. cument free of added material which the general network using public has access to download anonymously at no charge using public standard network protocols If you use the latter option you must take reasonably prudent steps when you begin distribution of Opaque copies in quantity to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy directly or through your agents or retailers of that edition to the public It is requested but not required that you contact the authors of the Document well before redistributing any large number of copies to give them a chance to provide you with an updated version of the Document 4 MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above provided that you release the Modified Version under precisely this License with the Modified Version filling the role of the Document thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it In addition you must do these things in the Modified Version Developer Manual V2 5 2015 10 24 74 77 A Use in the Title Page and on the covers if any a title distinct from that of the Document and from those of previous versions which should if there were any be listed in the History section of the Document You may use the same title as a previ
66. d an EMC TOOL SI ET OFFSI ET message with the new tool information and send it to Task which passes it to IO IO updates the specified pocket in its internal copy of the tool table emcioStatus tool toolT able and if the specified tool is currently loaded it is compared to emcioStatus tool toollInSpindle then the new tool information is copied to pocket 0 the spindle as well FIXME that s a buglet should only be copied on nonrandom machines Finally IO saves the new tool table 4 Back in interp if the modified tool is currently loaded in the spindle and if the machine is a non random toolchanger then the new tool information is copied from the tool s home pocket to pocket 0 the spindle interp s copy of the tool table settings tool table This copy is not needed on random tool changer machines because there tools don t have a home pocket and instead we just updated the tool in pocket 0 directly 5 The relevant numbered parameters 45400 45413 are updated from tool information in the spindle by copying the information from interp s settings gt tool table to settings gt parameters FIXME this is a buglet the params should only be updated if it was the current tool that was modified 6 If the modified tool is currently loaded in the spindle and if the config is for a nonrandom toolchanger then the new tool information is written to the tool table s pocket 0 as well via a second call to SET TOOL
67. e a motion controller EMCMOT a discrete IO controller EMCIO a task executor which coordinates them EMCTASK and several text mode and graphical User Interfaces Each of them will be described in the current document both from the design point of view and from the developers point of view where to find needed data how to easily extend modify things etc Developer Manual V2 5 2015 10 24 4 77 COORDINATING CONTROLLER PID UNIT UNIT CONVERT CONVERT ENCODER DIA LIMIT COUNTER CONVERTER SWITCHES POWER oN 1 ho Wm ENCODER MOTOR REALTIME HARDWARE DEVICES AIN 4 SPINDLE AUXILIARY CONTROLLER CONTROLLER COOLANT CONTROLLER GUI E NML STAT ERR Te por eee eee EMCTASK peels SEQUENCING GCODE LOGIC INTERPRETER A NML STAT ERR NML stat ERR NOERFELTIDE SHARED MEMORY BUFFER REALTIME i FIFOS res EC ettet Formen COMMANDS STATUS EMCMOT TRAJECTORY 2 PLANNER i i FORWARD INVERSE LIMIT amp HOME i i KINEMATICS KINEMATICS STA
68. e aborts motion on an axis e g GUI jogs 120 Obs used from the GUI when stopping a manual jog Written From sendJogStop emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisAbort taskintf cc which sends EMCMOT AXIS ABORT Parameter Type axis in EMC AXIS CMD MSG int 3 3 00 EMC AXIS ENABLE TYPE Description NML Type enables axis 121 Obs not used from tkemc amp mini Written From sendAxisEnable emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisEnable taskintf cc which sends EMCMOT ENABLE AMPLIFIER Parameter Type axis in EMC AXIS CMD MSG int Developer Manual V2 5 2015 10 24 33 77 3 3 21 EMC AXIS DISABLE TYPE Description NML Type disable axis 122 Obs not used from tkemc amp mini Written From sendAxisDisable emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisDisable taskintf cc which sends EMCMOT DISABLE AMPLIFIER Parameter Type axis in EMC AXIS CMD MSG int 3 3 22 EMC AXIS HOME TYPE Description NML Type home an axis at current position 123 Obs used from tkemc amp mini through emc home Written From sendHome emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisHome taskintf cc which sends EMCMOT HOME Parameter Type axis in EMC AXIS CMD MSG int 3 3 23 AXIS JOG TYPE Description NML Type jogs an axis continuously 124 Obs used on jogging Written From sendJogCont emcsh
69. e sets max limit 108 Obs also handled by iniaxis which directly calls emcAxisSetMaxPositionLimit Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetMaxPositionLimit taskintf cc which sends EMCMOT SET POSITION LIMITS Parameter Type axis in AXIS CMD MSG int limit double 3 3 9 EMC AXIS SET MIN OUTPUT LIMIT TYPE Description NML Type 109 Obs not used Written From none Read To none Parameter Type axis in AXIS CMD MSG int limit double 3 3 10 AXIS SET MAX OUTPUT LIMIT Description NML Type 110 Obs not used Written From none Read To none Parameter Type axis in EMC AXIS CMD MSG int limit double Developer Manual V2 5 2015 10 24 31 77 3 3 11 EMC AXIS SET FERROR TYPE Description NML Type sets max following error 111 Obs also handled by iniaxis which directly calls emcAxisSetFerror Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetFerror taskintf cc which sends EM CMOT SET Parameter Type axis in EMC AXIS CMD MSG int ferror double 3 3 12 AXIS SET HOMING VEL TYPE Description NML Type 112 Obs EMC2 those are SET HOMING PARAMS double home double offset double search vel double latch vel int use index int ignore limits Written From none Read To none Parameter Type axis in AXIS CMD MSG int ferror double
70. e easier to read if they avoid underscores and use an is prefix not to be confused with methods that manipulate a boolean Rationale Identifies the return value as TRUE or FALSE and nothing else e g isOpen isHomed Do NOT use Not in a boolean name it leads only leads to confusion when doing logical tests e g isNotOnLimit or is_not_on_limit are BAD Variable names should avoid the use of upper case and underscores except for local or private names The use of global variables should be avoided as much as possible Rationale Clarifies which are variables and which are methods Public e g axislimit Private e g maxvelocity_ Specific method naming conventions The terms get and set should be used where an attribute is accessed directly Rationale Indicates the purpose of the function or method e g get_foo set_bar For methods involving boolean attributes set amp reset is preferred Rationale As above e g set_amp_enable reset_amp_fault Math intensive methods should use compute as a prefix Rationale Shows that it is computationally intensive and will hog the CPU e g compute_PID Abbreviations in names should be avoided where possible The exception is for local variable names Rationale Clarity of code e g pointer is preferred over ptr compute is preferred over cmp compare is again preferred over cmp Enumerates and other constants can be prefixed by a common type name e g enum COLOR COLOR_RED COLOR_BLUE Excessive us
71. e of macros and defines should be avoided Using simple methods or functions is preferred Rationale Improves the debugging process Developer Manual V2 5 2015 10 24 62 77 Include Statements Header files must be included at the top of a source file and not scattered throughout the body They should be sorted and grouped by their hierarchical position within the system with the low level files included first Include file paths should NEVER be absolute Use the compiler I flag instead Rationale Headers may not be in the same place on all systems Pointers and references should have their reference symbol next to the variable name rather than the type name Rationale Reduces confusion e g float x or int amp i Implicit tests for zero should not be used except for boolean variables e g if spindle speed 0 NOT if spindle speed Only loop control statements must be included in a for construct e g sum 0 for i 0 i lt 10 i sum value i NOT for 1 0 sum 20 i lt 10 i sum value i Likewise executable statements in conditionals must be avoided e g if fd open file name is bad Complex conditional statements should be avoided Introduce temporary boolean variables instead Parentheses should be used in plenty in mathematical expressions Do not rely on operator precedence when an extra parentheses would clarify things File names C sources and headers use cc and hh extension The use of
72. e semaphore is handled by the SharedMemory constructor and destructor 2 16 ShmBuffer Class for passing NML messages between local processes using a shared memory buffer Much of internal workings are inherited from the CMS class Developer Manual V2 5 2015 10 24 17 77 2 17 The Timer class provides a periodic timer limited only by the resolution of the system clock If for example a process needs to be run every 5 seconds regardless of the time taken to run the process the following code snippet demonstrates how main timer new Timer 5 0 Initialize a timer with 5 second loop while 0 Do some process timer wait mest 5 Second delete timer 2 18 Semaphore The Semaphore class provides a method of mutual exclusions for accessing a shared resource The function to get a semaphore can either block until access is available return after a timeout or return immediately with or without gaining the semaphore The constructor will create a semaphore or attach to an existing one if the ID is already in use The Semaphore destroy must be called by the last process only 2 19 CMS At the heart of libnml is the CMS class it contains most of the functions used by libnml and ultimately NML Many of the internal functions are overloaded to allow for specific hardware dependent methods of data passing Ultimately everything revo
73. e size of the buffer neut a boolean to indicate if the data in the buffer is encoded in a machine independent format or raw RPC Obsolete Place holder retained for backward compatibility only buffer A unique ID number used if a server controls multiple buffers max procs is the maximum processes allowed to connect to this buffer key is a numerical identifier for a shared memory buffer Developer Manual V2 5 2015 10 24 19 77 2 20 2 Type specific configs The buffer type implies additional configuration options whilst the host operating system precludes certain combinations In an attempt to distill published documentation in to a coherent format only the SHMEM buffer type will be covered default mode for providing semaphore locking of the buffer memory mutex none Not used mutex no interrupts not applicable on a Linux system mutex no switching not applicable on a Linux system mutex mao split Splits the buffer in to half or more and allows one process to access part of the buffer whilst a second process is writing to another part TCP port number Specifies which network port to use UDP port number ditto STCP port number ditto serialPortDevName serial port Undocumented passwd file name pwd Adds a layer of security to the buffer by reguiring each process to provide a password bsem NIST documentation implies a key for a blocking semaphore and if bsem 1 blo
74. ect the COORD command with an error message if the kinematics cannot be activated because the one or more axes have not been homed In addition if any joint is in motion GET MOTION INPOS FLAGY FALSE then the command will be ignored with no error message This behavior is controlled by code that is now located in the function set operating mode in control c I believe the command should not be silently ignored instead the command handler should determine whether it can be executed and return an error if it cannot Developer Manual V2 5 2015 10 24 10 77 2 7 4 2 Results If the machine is already in coord mode nothing Otherwise the machine is placed in coord mode The kinematics code is activated interpolators are drained and flushed and the trajectory planner gueues are empty The trajectory planner is active and awaiting a LINE CIRCLE or PROBE command 2 7 5 ENABLE The ENABLE command enables the motion controller 2 7 51 Requirements None The command can be issued at any time and will always be accepted 2 7 5 2 Results If the controller is already enabled nothing If not the controller is enabled Queues and interpolators are flushed Any movement or homing operations are terminated The amp enable outputs associated with active joints are turned on If forward kinematics are not available the machine is switched to free mode 2 7 6 DISABLE The DISABLE command disables the motion controller 2 7 6 1 R
75. ee ER ee ee Oe ante 12 Requiem o ses daei 12 Lr RoW ea eR ae RO RO BRAGS ADR ade 12 PAUSE uon Ama y Ek Raro Go WOR ROT eee ee ee 12 2 49 daa T S Sari oH be BLS SHES ES 12 dee do eS dp de E ee 12 RESUME oe Lek exe Ugo e o e oh Dey XO OR RO wae 12 os voeem Seed RES qe eH gp dus wets us 12 PANICO Jo C OTT teren 12 A MM CT TT 12 2 7 13 us knees ee ee 13 I S MEETS 13 BC LE 52022 ye ents spe Gru pee Gh tte G 13 2 7 10 222222522222 are rin 13 41182 CT 13 OVERRIDE IMIS 255502255 USE ERS Bee tees he en 13 oe Rex een Re Re EA e A 13 2 243 04 dav ewe eb eh ORO E AU Soy rn 13 HOME Ro UR RA DOR ads 13 cae ea dene ba ee 13 Pole BPO ee eee eS dee xx S es 13 JOG CONT Gee hed eh ee e ede de isi da 14 4274191 2 22 2222 orem ee Oa Ae ae 14 uo MDC Serta ee eee wa he 4 14 JOU INCE oe 4 2 oe ee ee a deus eo 14 27 201 222222222222 22 2 2 55 14
76. em That means that the motion controller should avoid persistent faults This needs to be looked into Developer Manual V2 5 2015 10 24 9 77 2 7 2 1 Requirements The command handler applies no reguirements to the FREE command it will always be accepted However if any joint is in motion GET MOTION INPOS FLAG FALSE then the command will be ignored This behavior is controlled by code that is now located in the function set operating mode in control c that code needs to be cleaned up believe the command should not be silently ignored instead the command handler should determine whether it can be executed and return an error if it cannot 2 7 2 2 Results If the machine is already in free mode nothing Otherwise the machine is placed in free mode Each joint s free mode trajectory planner is initialized to the current location of the joint but the planners are not enabled and the joints are stationary 2 7 3 TELEOP The TELEOP command places the machine in teleoperating mode In teleop mode movement of the machine is based on Cartesian coordinates using kinematics rather than on individual joints as in free mode However the trajectory planner per se is not used instead movement is controlled by a velocity vector Movement in teleop mode is much like jogging except that it is done in Cartesian space instead of joint space On a machine with trivial kinematics there is little difference between teleop mode and free
77. equirements None The command can be issued at any time and will always be accepted 2 7 6 2 Results If the controller is already disabled nothing If not the controller is disabled Queues and interpolators are flushed Any movement or homing operations are terminated The amp enable outputs associated with active joints are turned off If forward kinematics are not available the machine is switched to free mode 2 7 7 ENABLE AMPLIFIER The ENABLE AMPLIFIER command turns on the amp enable output for a single output amplifier without changing anything else Can be used to enable a spindle speed controller 2 7 7 1 Requirements None The command can be issued at any time and will always be accepted 2 7 7 2 Results Currently nothing A call to the old extAmpEnable function is currently commented out Eventually it will set the amp enable HAL pin true Developer Manual V2 5 2015 10 24 11 77 2 7 8 DISABLE AMPLIFIER The DISABLE AMPLIFIER command turns off the amp enable output for a single amplifier without changing anything else Again useful for spindle speed controllers 2 7 8 1 Requirements None The command can be issued at any time and will always be accepted 2 7 8 2 Results Currently nothing A call to the old extAmpEnable function is currently commented out Eventually it will set the amp enable HAL pin false 2 7 9 ACTIVATE JOINT The ACTIVATE JOINT command turns on all the calculations asso
78. eral purpose I O unrelated to the actual motion of the axes EMCMOT The module within LinuxCNC that handles the actual motion of the cutting tool It runs as a real time program and directly controls the motors Encoder A device to measure position Usually a mechanical optical device which outputs a quadrature signal The signal can be counted by special hardware or directly by the parport with LinuxCNC Feed Relatively slow controlled motion of the tool used when making a cut Feed rate The speed at which a cutting motion occurs In auto or mdi mode feed rate is commanded using an F word F10 would mean ten machine units per minute Feedback A method e g quadrature encoder signals by which LinuxCNC receives information about the position of motors Feedrate Override A manual operator controlled change in the rate at which the tool moves while cutting Often used to allow the operator to adjust for tools that are a little dull or anything else that requires the feed rate to be tweaked Floating Point Number A number that has a decimal point 12 300 In HAL it is known as float Developer Manual V2 5 2015 10 24 69 77 G Code The generic term used to refer to the most common part programming language There are several dialects of G code LinuxCNC uses RS274 NGC GUI Graphical User Interface General A type of interface that allows communications between a computer and a human in most cases via the manipu
79. ermission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 1 1 or any later version published by the Free Software Foundation with no Invariant Sections no Front Cover Texts and one Back Cover Text This LinuxCNC Handbook is the product of several authors writing for linuxCNC org As you find it to be of value in your work we invite you to contribute to its revision and growth A copy of the license is included in the section entitled GNU Free Documentation License If you do not find the license you may order a copy from Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 LINUX is the registered trademark of Linus Torvalds in the U S and other countries The registered trademark Linux is used pursuant to a sublicense from LMI the exclusive licensee of Linus Torvalds owner of the mark on a world wide basis Developer Manual V2 5 2015 10 24 2 77 Chapter 2 Code Notes 2 1 Intended audience This document is a collection of notes about the internals of LinuxCNC It is primarily of interest to developers however much of the information here may also be of interest to system integrators and others who are simply curious about how LinuxCNC works Much of this information is now outdated and has never been reviewed for accuracy 2 2 Organization There will be a chapter for each of the major components of LinuxCNC as well as chapter s
80. et position that happen while the move is in progress so multiple JOG INCR commands can be issued in quick succession The free mode planner accelerates at the joint accel limit at the beginning of the move and will decelerate at the joint accel limit to stop at the target position 2 7 21 JOG ABS The JOG ABS command initiates an absolute jog on a single joint An absolute jog is a simple move to a specific location in joint coordinates Normally absolute jogs stop when they reach the desired location however they also stop when they hit a limit or on an ABORT command 2 7 21 4 Requirements The command handler will silently reject the JOG ABS command if machine is not in free mode or if any joint is in motion GET MOTION INPOS FALSE or if motion is not enabled It will also silently ignore the command if the joint is already at or beyond its limit and the commanded jog would make it worse Developer Manual V2 5 2015 10 24 15 77 2 7 21 2 Results The free mode trajectory planner for the joint identified by emcmotCommand axis is activated the target position is set to emcmotCommand offset and the velocity limit is set to emcmotCommand gt vel The free mode trajectory planner will generate a smooth trapezoidal move from the present position to the target position The planner can correctly handle changes in the target position that happen while the move is in progress If multiple JOG ABS commands are issued in qui
81. extract a couple of variables It would make more sense to do ALL the parsing and save the variables in a struct that is passed to the cms constructor This would eliminate string handling and reduce duplicate code in cms 2 21 1 2 NML read write Calls to NML read and NML write both perform similar tasks in so much as processing the message The only real variation is in the direction of data flow A call to the read function first gets data from the buffer then calls format output whilst a write function would call for mat input before passing the data to the buffer It is in format xxx that the work of constructing or deconstructing the message takes place A list of assorted functions are called in turn to place various parts of the NML header not to be confused with the cms header in the right order The last function called is emcFormat in emc cc 2 21 1 3 NML msg and NML relationships NMLmsg is the base class from which all message classes are derived Each message class must have a unique ID defined and passed to the constructor and also an update cms function The update will be called by the NML read write functions when the NML formatter is called The pointer to the formatter will have been declared in the NML constructor at some point By virtue of the linked lists NML creates it is able to select cms pointer that is passed to the formatter and therefor which buffer is to be used 2 22 Adding custom NML co
82. full name git config global user email you example com Use your real name not a handle and use an unobfuscated e mail address 5 7 Effective use of git 5 7 1 Commit contents Keep your commits small and to the point Each commit should accomplish one logical change to the repo 5 7 2 Write good commit messages Keep commit messages around 72 columns wide so that in a default size terminal window they don t wrap when shown by git 109 Use the first line as a summary of the intent of the change almost like the subject line of an e mail Follow it with a blank line then a longer message explaining the change Example Get rid of RTAPI SUCCESS use 0 instead test retval lt 0 should feel familiar it s the same kind of test you use in userspace returns 1 for error and in kernel space returns ERRNO for error 5 7 3 Commit to the proper branch Bugfixes should go on the oldest applicable branch New features should go in the master branch If you re not sure where a change belongs ask on irc or on the mailing list 5 7 4 Use multiple commits to organize changes When appropriate organize your changes into a branch a series of commits where each commit is a logical step towards your ultimate goal For example first factor out some complex code into a new function Then in a second commit fix an underlying bug Then in the third commit add a new feature which is made easier by the refactori
83. hand made prototype needs to be digitized for moldmaking or to check the accuracy of machined or molded parts Display units The linear and angular units used for onscreen display DRO A Digital Read Out is a system of position measuring devices attached to the slides of a machine tool which are connected to a numeric display showing the current location of the tool with respect to some reference position DROs are very popular on hand operated machine tools because they measure the true tool position without backlash even if the machine has very loose Acme screws Some DROs use linear quadrature encoders to pick up position information from the machine and some use methods similar to a resolver which keeps rolling over EDM EDM is a method of removing metal in hard or difficult to machine or tough metals or where rotating tools would not be able to produce the desired shape in a cost effective manner excellent example is rectangular punch dies where sharp internal corners are desired Milling operations can not give sharp internal corners with finite diameter tools A wire EDM machine can make internal corners with a radius only slightly larger than the wire s radius A sinker EDM can make internal corners with a radius only slightly larger than the radius on the corner of the sinking electrode EMC The Enhanced Machine Controller Initially a NIST project Renamed to LinuxCNC in 2012 EMCIO The module within LinuxCNC that handles gen
84. have some random integer loop counter it should probably be called i Calling it loop counter is non productive if there is no chance of it being misunderstood Similarly tmp can be just about any type of variable that is used to hold a temporary value If you are afraid to mix up your local variable names you have another problem which is called the function growth hormone imbalance syndrome See next chapter 4 6 Functions Functions should be short and sweet and do just one thing They should fit on one or two screenfuls of text the ISO ANSI screen size is 80x24 as we all know and do one thing and do that well The maximum length of a function is inversely proportional to the complexity and indentation level of that function So if you have a conceptually simple function that is just one long but simple case statement where you have to do lots of small things for a lot of different cases it s OK to have a longer function However if you have a complex function and you suspect that a less than gifted first year high school student might not even understand what the function is all about you should adhere to the maximum limits all the more closely Use helper functions with descriptive names you can ask the compiler to in line them if you think it s performance critical and it will probably do a better job of it that you would have done Another measure of the function is the number of local variables They shouldn t exceed 5 1
85. ing but endorsements of your Modified Version by various parties for example statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard You may add a passage of up to five words as a Front Cover Text and a passage of up to 25 words as a Back Cover Text to the end of the list of Cover Texts in the Modified Version Only one passage of Front Cover Text and one of Back Cover Text may be added by or through arrangements made by any one entity If the Document already includes a cover text for the same cover previously added by you or by arrangement made by the same entity you are acting on behalf of you may not add another but you may replace the old one on explicit permission from the previous publisher that added the old one The author s and publisher s of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version 5 COMBINING DOCUMENTS You may combine the Document with other documents released under this License under the terms defined in section 4 above for modified versions provided that you include in the combination all of the Invariant Sections of all of the original documents unmodified and list them all as Invariant Sections of your combined work in its license notice The combined work need only contain one copy of this License and multiple identical Invariant Sections may
86. is caused when external forces think cutting tool pulling on the work piece are the source of the motion Ball Screw A type of lead screw that uses small hardened steel balls between the nut and screw to reduce friction Ball screws have very low friction and backlash but are usually quite expensive Ball Nut A special nut designed for use with a ball screw It contains an internal passage to re circulate the balls from one end of the screw to the other CNC Computer Numerical Control The general term used to refer to computer control of machinery Instead of a human operator turning cranks to move a cutting tool CNC uses a computer and motors to move the tool based on a part program Developer Manual V2 5 2015 10 24 68 77 Comp A tool used to build compile and install LinuxCNC HAL components Configuration n A directory containing a set of configuration files Custom configurations are normally saved in the users home linuxcnc configs directory These files include LinuxCNC s traditional INI file and HAL files A configuration may also contain several general files that describe tools parameters and NML connections Configuration v The task of setting up LinuxCNC so that it matches the hardware on a machine tool Coordinate Measuring Machine A Coordinate Measuring Machine is used to make many accurate measurements on parts These machines can be used to create CAD data for parts where no drawings can be found when a
87. it is generated by applying inverse kins to 1 In free mode it is copied from 3 I think 3 emcmotStatus gt joints n pos cmd This is the desired position in joint coords after interpolation new set of these coords is generated every servo period In coord mode it is generated from 2 by the interpolator In teleop mode it is generated from 2 by the interpolator In free mode it is generated by the free mode traj planner 4 emcmotStatus gt joints n motor pos cmd This is the desired position in motor coords Motor coords are generated by adding backlash compensation lead screw error compensation and offset for homing to 3 It is generated the same way regardless of the mode and is the output to the PID loop or other position loop Developer Manual V2 5 2015 10 24 8 77 5 emcmotStatus gt joints n motor pos fb This is the actual position in motor coords It is the input from encoders or other feedback device or from virtual encoders on open loop machines It is generated by reading the feedback device 6 emcmotStatus gt joints n pos fb This is the actual position in joint coordinates It is generated by subtracting offset lead screw error compensation and backlash compensation from 5 It is generated the same way regardless of the operating mode 7 emcmotStatus gt carte pos fb This is the actual position in Cartesian coordinates It is updated at the traj rate not the servo rate Ideal
88. kewise for FILEMEM LOCMEM is of little use for a multi process application and only offers limited performance advantages over SHMEM This leaves SHMEM as the only buffer type to use with LinuxCNC The neut option is only of use in a multi processor system where different and incompatible architectures are sharing a block of memory The likelihood of seeing a system of this type outside of a museum or research establishment is remote and is only relevant to GLOBMEM buffers The RPC number is documented as being obsolete and is retained only for compatibility reasons With a unique buffer name having a numerical identity seems to be pointless Need to review the code to identify the logic Likewise the key field at first appears to be redundant and it could be derived from the buffer name The purpose of limiting the number of processes allowed to connect to any one buffer is unclear from existing documentation and from the original source code Allowing unspecified multiple processes to connect to a buffer is no more difficult to implement The mutex types boil down to one of two the default sem or mao split Most of the NML messages are relatively short and can be copied to or from the buffer with minimal delays so split reads are not essential Data encoding is only relevant when transmitted to a remote process Using TCP or UDP implies XDR encoding Whilst ASCII encoding may have some use in diagnostics or for passing data
89. l prep number and iocontrol 0 tool prepare IO then repeatedly calls read tool inputs to poll the HAL pin iocontrol 0 tool prepared which signals from the toolchanger hardware via HAL to IO that the requested tool prep is complete When that pin goes True IO sets emcioStatus tool pocketPrepped to the requested tool s pocket number 2 Back in interp settings gt selected pocket is assigned the pocket number of the requested tool xxx 2 23 32 6 Tells the toolchanger to switch to the currently selected tool selected the previous Txxx command Handled by Interp convert tool change 1 The machine is asked to change to the selected tool by calling the Canon function CHANGE TOOL with settings gt selected pocket a saicanon Sets sai s active slot to the passed in pocket number Tool information is copied from the selected pocket of of the tool table ie from sais tools active slot tothe spindle aka sais tools 0 Developer Manual V2 5 2015 10 24 24 77 b emccanon Sends an EMC TOOL LOAD message to Task which sends it to IO IO sets emcioStatus tool toolInSpindle to the tool number of the tool in the pocket identified by emcioStatus tool pocketPrep ped set by Txxx aka SELECT POCKET It then requests that the toolchanger hardware perform a tool change by setting the HAL pin iocontrol 0 tool change to True Later IO s read tool inputs will sense that the HAL pin iocontrol 0 tool changed ha
90. lation of icons and other elements widgets on a computer screen LinuxCNC An application that presents a graphical screen to the machine operator allowing manipulation of the machine and the corresponding controlling program HAL Hardware Abstraction Layer At the highest level it is simply a way to allow a number of building blocks to be loaded and interconnected to assemble a complex system Many of the building blocks are drivers for hardware devices However HAL can do more than just configure hardware drivers Home A specific location in the machine s work envelope that is used to make sure the computer and the actual machine both agree on the tool position ini file A text file that contains most of the information that configures LinuxCNC for a particular machine Instance One can have an instance of a class or a particular object The instance is the actual object created at runtime In programmer jargon the Lassie object is an instance of the Dog class Joint Coordinates These specify the angles between the individual joints of the machine See also Kinematics Jog Manually moving an axis of a machine Jogging either moves the axis a fixed amount for each key press or moves the axis at a constant speed as long as you hold down the key In manual mode jog speed can be set from the graphical interface kernel space See real time Kinematics The position relationship between world coordinates and joint coordinates of a ma
91. loodOff iotaskintf cc which sends it to the IO controller main simloControl cc ioControl cc iosh cc Parameter Type none 3 10 8 EMC COOLANT STAT TYPE Description NML Type status for coolant not sent as a message but used as is 1499 Written From none Read To none Parameter Type mist int flood int 3 11 EMC LUBE 3111 EMC LUBE INIT TYPE Description NML Type initializes the LUBE controller currently part of the IO controller 1501 Developer Manual V2 5 2015 10 24 54 77 Obs not written in EMC2 only read in EMCI it was sent when TOOL INIT was sent Written From none Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type none 3 11 2 EMC LUBE HALT TYPE Description NML Type stops the LUBE 1502 Obs not written in EMC2 only read in EMCI it was sent when TOOL HALT was sent Written From none Read main ioControl cc simloControl cc emc io get command iosh cc Parameter Type none 3 11 3 EMC LUBE ABORT TYPE Description NML Type aborts the LUBE 1503 Obs not written in EMC2 only read in EMCI it was sent when TOOL ABORT was sent Written From none Read To main ioControl cc simloControl cc emc io get command iosh cc Parameter Type none 3 11 4 EMC LUBE ON TYPE Description NML Type starts LUBE 1504 Obs written only by the GUIs emcsh cc Written From sendLubeOn emcsh cc Read To emcTaskIssueCommand emctask
92. lves around a central block of memory referred to as the message buffer or just buffer This buffer may exist as a shared memory block accessed by other CMS NML processes or a local and private buffer for data being transferred by network or serial interfaces The buffer is dynamically allocated at run time to allow for greater flexibility of the CMS NML sub system The buffer size must be large enough to accommodate the largest message a small amount for internal use and allow for the message to be encoded if this option is chosen encoded data will be covered later The following figure is an internal view of the buffer space Developer Manual V2 5 2015 10 24 18 77 Buffer Name 32 char CMS Header 1 Read Message ID Message Size Data Space CMS buffer The CMS base class is primarily responsible for creating the communications pathways and interfacing to the O S 2 20 Configuration file format NML configuration consists of two types of line formats One for Buffers and a second for Processes that connect to the buffers 2 20 1 Buffer line The original NIST format of the buffer line is name type host size neut RPC bufferf max procs key type specific configs B identifies this line as a Buffer configuration name is the identifier of the buffer type describes the buffer type SHMEM LOCMEM FILEMEM PHANTOM or GLOBMEM host is either an IP address or host name for the NML server size is th
93. ly actualPos would always be calculated by applying forward kinematics to 6 However forward kinematics may not be available or they may be unusable because one or more axes aren t homed In that case the options are A fake it by copying 1 or B admit that we don t really know the Cartesian coordinates and simply don t update actualPos Whatever approach is used I can see no reason not to do it the same way regardless of the operating mode I would propose the following If there are forward kins use them unless they don t work because of unhomed axes or other problems in which case do B If no forward kins do A since otherwise actualPos would never get updated 2 7 Commands This section simply lists all of the commands that can be sent to the motion module along with detailed explanations of what they do The command names are defined in a large typedef enum in emc2 src emc motion motion h called cmd code t Note that in the code each command name starts with EMCMOT which is omitted here The commands are implemented by a large switch statement in the function emcmotCommandHandler which is called at the servo rate More on that function later There are approximately 44 commands this list is still under construction 2 7 1 ABORT The ABORT command simply stops all motion It can be issued at any time and will always be accepted It does not disable the motion controller or change any state information it simply c
94. main cc calls emcLubeOn iotaskintf cc which sends it to the IO controller main ioControl cc simIoControl cc emc io get command iosh cc Parameter Type none 3 11 5 EMC LUBE OFF TYPE Description NML Type stops LUBE 1505 Obs written only by the GUIs emcsh cc Written From sendLubeOff emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcLubeOff iotaskintf cc which sends it to the IO controller main ioControl cc simIoControl cc emc io get command iosh cc Parameter Type none Developer Manual V2 5 2015 10 24 55 77 3 11 6 EMC LUBE STAT TYPE Description NML Type status for LUBE not sent as a message but used as is 1599 Written From none Read To none Parameter Type on int level int 3 12 EMCSET 3 12 1 EMC SET DIO INDEX TYPE Description NML Type 5001 Obs not used Written From none Read To none Parameter Type value int index int 3 12 2 EMC SET AIO INDEX TYPE Description NML Type 5002 Obs not used Written From none Read To none Parameter Type value int index int 3 12 3 EMC SET POLARITY TYPE Description NML Type 5003 Obs not used Written From none Read To none Parameter Type value int polarity int 3 13 EMCIO 3 13 1 EMC IO INIT TYPE Description NML Type 1601 Obs not written in EMC2 only read Written From none Read main ioControl cc simloControl cc emc io get command
95. mmands LinuxCNC is pretty awesome but some parts need some tweaking As you know communication is done through NML channels the data sent through such a channel is one of the classes defined in emc hh implemented in emc cc If somebody needs a message type that doesn t exist he should follow these steps to add a new one The Message I added in the example is called EMC IO GENERIC inherits EMC IO CMD MSG inherits RCS CMD MSG 1 add the definition of the EMC IO GENERIC class to emc2 src emc nml intf emc hh 2 add the type define define EMC IO GENERIC TYPE NMLTYPE 1605 a I chose 1605 because it was available to emc2 src emc nml intf emc hh 3 add case EMC IO GENERIC TYPE to emcFormat in emc2 src emc nml intf emc cc 4 add case IO GENERIC TYPE to emc symbol lookup in emc2 src emc nml intf emc cc 5 add EMC IO GENERIC update function to emc2 src emc nml intf emc cc Recompile and the new message should be there The next part is to send such messages from somewhere and receive them in another place and do some stuff with it Developer Manual V2 5 2015 10 24 22 77 2 23 Tool Table Toolchanger LinuxCNC interfaces with toolchanger hardware and has an internal toolchanger abstraction LinuxCNC manages tool informa tion in a tool table file 2 23 1 Toolchanger abstraction in LinuxCNC LinuxCNC supports two kinds of toolchanger hardware called nonrandom and random The ini setting EMCIOJRANDOM TOOLC
96. mode and GUIs for those machines might never even issue this command However for non trivial machines like robots and hexapods teleop mode is used for most user commanded jog type movements 2 7 31 Requirements The command handler will reject the TELEOP command with an error message if the kinematics cannot be activated because the one or more axes have not been homed In addition if any joint is in motion GET MOTION INPOS FLAG FALSE then the command will be ignored with no error message This behavior is controlled by code that is now located in the function set operating mode in control c I believe the command should not be silently ignored instead the command handler should determine whether it can be executed and return an error if it cannot 2 7 8 2 Results If the machine is already in teleop mode nothing Otherwise the machine is placed in teleop mode The kinematics code is activated interpolators are drained and flushed and the Cartesian velocity commands are set to zero 2 7 4 COORD The COORD command places the machine in coordinated mode In coord mode movement of the machine is based on Cartesian coordinates using kinematics rather than on individual joints as in free mode In addition the main trajectory planner is used to generate motion based on queued LINE CIRCLE and or PROBE commands Coord mode is the mode that is used when executing a G code program 2 7 4 4 Requirements The command handler will rej
97. nd iosh cc Parameter Type none 3 10 4 EMC COOLANT MIST ON TYPE Description NML Type starts MIST coolant 1404 Obs used written by emccanon cc Written From MIST ON emccanon cc sendMistOn emcsh cc Read emcTaskIssueCommand emctaskmain cc calls emcCoolantMistOn iotaskintf cc which sends it to the IO controller main simloControl cc ioControl cc iosh cc Parameter Type none Developer Manual V2 5 2015 10 24 53 77 3 10 5 EMC COOLANT MIST OFF TYPE Description NML Type stops MIST coolant 1405 Obs used written by emccanon cc Written From MIST OFF emccanon cc sendMistOff emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcCoolantMistOff iotaskintf cc which sends it to the IO controller main simloControl cc ioControl cc iosh cc Parameter Type none 3 10 6 COOLANT FLOOD ON TYPE Description NML Type starts FLOOD coolant 1406 Obs used written by emccanon cc Written From FLOOD ON emccanon cc sendFloodOn emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcCoolantFloodOn iotaskintf cc which sends it to the IO controller main simloControl cc ioControl cc iosh cc Parameter Type none 3 10 7 EMC COOLANT FLOOD OFF TYPE Description NML Type stops FLOOD coolant 1407 Obs used written by emccanon cc Written From FLOOD OFF emccanon cc sendFloodOff emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcCoolantF
98. ng and which would not have worked without fixing that bug This is helpful to reviewers because it is easier to see that the factor out code into new function step was right when there aren t other edits mixed in it s easier to see that the bug is fixed when the change that fixes it is separate from the new feature and so on 5 7 5 Follow the style of the surrounding code Make an effort to follow the prevailing indentation style of surrounding code In particular changes to whitespace make it harder for other developers to track changes over time When reformatting code must be done do it as a commit separate from any semantic changes Developer Manual V2 5 2015 10 24 66 77 5 7 6 Simplify complicated history before sharing with fellow developers With git it s possible to record every edit and false start as a separate commit This is very convenient as a way to create checkpoints during development but often you don t want to share these false starts with others Git provides two main ways to clean history both of which can be done freely before you share the change git commit amend lets you make additional changes to the last thing you committed optionally modifying the commit message as well Use this if you realized right away that you left something out of the commit or if you typo d the commit message git rebase interactive upstream branch lets you go back through each commit made since you forked your feature
99. nglish version will prevail 9 TERMINATION You may not copy modify sublicense or distribute the Document except as expressly provided for under this License Any other attempt to copy modify sublicense or distribute the Document is void and will automatically terminate your rights under this License However parties who have received copies or rights from you under this License will not have their licenses terminated so long as such parties remain in full compliance 10 FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new revised versions of the GNU Free Documentation License from time to time Such new versions will be similar in spirit to the present version but may differ in detail to address new problems or concerns See http www gnu org copyleft Each version of the License is given a distinguishing version number If the Document specifies that a particular numbered version of this License or any later version applies to it you have the option of following the terms and conditions either of that specified version or of any later version that has been published not as a draft by the Free Software Foundation If the Document does not specify a version number of this License you may choose any version ever published not as a draft by the Free Software Foundation ADDENDUM How to use this License for your documents To use this License in a document you have written include a copy of the License
100. or public access to a Transparent copy of the Document and likewise the network locations given in the Document for previous versions it was based on These may be placed in the History section You may omit a network location for a work that was published at least four years before the Document itself or if the original publisher of the version it refers to gives permission In any section entitled Acknowledgements or Dedications preserve the section s title and preserve in the section all the substance and tone of each of the contributor acknowledgements and or dedications given therein L Preserve all the Invariant Sections of the Document unaltered in their text and in their titles Section numbers or the equivalent are not considered part of the section titles M Delete any section entitled Endorsements Such a section may not be included in the Modified Version N Do not retitle any existing section as Endorsements or to conflict in title with any Invariant Section If the Modified Version includes new front matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document you may at your option designate some or all of these sections as invariant To do this add their titles to the list of Invariant Sections in the Modified Version s license notice These titles must be distinct from any other section titles You may add a section entitled Endorsements provided it contains noth
101. org pub software scm git docs everyday html Git User s Manual https www kernel org pub software scm git docs user manual html For a more thorough documentation of git see the Pro Git book http git scm com book Another online tutorial that has been recommended is Git for the Lazy http wiki spheredev org Git for the lazy 5 5 Overview of the process The high level overview of how to contribute changes to the source goes like this Communicate with the project developers and let us know what you re hacking on Clone the git repo Commit the changes you desire to a local branch Share your changes with the other project developers in one of two ways Push your branch to a publicly visible git repo such as github bitbucket your own publicly accessible server etc or Email your commits to emc developers mailing list using git format patch Champion your patch Explain what problem it addresses and why it should be included in LinuxCNC Be receptive to questions and feedback from the developer community Itis not uncommon for a patch to go through several revisions before it is accepted Developer Manual V2 5 2015 10 24 65 77 5 6 git configuration In order to be considered for inclusion in the LinuxCNC source commits must have correct Author fields identifying the author of the commit A good way to ensure this is to set your global git config git config global user name Your
102. ous version if the original publisher of that version gives permission B List on the Title Page as authors one or more persons or entities responsible for authorship of the modifications in the Modified Version together with at least five of the principal authors of the Document all of its principal authors if it has less than five C State on the Title page the name of the publisher of the Modified Version as the publisher D Preserve all the copyright notices of the Document E Add an appropriate copyright notice for your modifications adjacent to the other copyright notices F Include immediately after the copyright notices a license notice giving the public permission to use the Modified Version under the terms of this License in the form shown in the Addendum below G Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in Document s license notice H Include an unaltered copy of this License I Preserve the section entitled History and its title and add to it an item stating at least the title year new authors and publisher of the Modified Version as given on the Title Page If there is no section entitled History in the Document create one stating the title year authors and publisher of the Document as given on its Title Page then add an item describing the Modified Version as stated in the previous sentence J Preserve the network location if any given in the Document f
103. pe Developer Manual V2 5 2015 10 24 48 77 3 8 EMC AUX 3 8 1 EMC AUX INIT TYPE Description NML Type 1201 Written From none Read To none Parameter Type 3 8 2 EMC AUX HALT TYPE Description NML Type 1202 Written From none Read To none Parameter Type 3 8 3 EMC AUX ABORT TYPE Description NML Type 1203 Written From none Read To none Parameter Type 3 8 4 EMC AUX DIO WRITE TYPE Description NML Type 1204 Written From none Read To none Parameter Type index int value int 3 8 5 EMC AUX AIO WRITE TYPE Description NML Type 1205 Written From none Read To none Parameter Type index int value double 3 8 06 EMC AUX ESTOP ON TYPE Description NML Type 1206 Written From none Read To none Parameter Type Developer Manual V2 5 2015 10 24 49 77 3 8 7 EMC AUX ESTOP OFF TYPE Description NML Type 1207 Written From none Read To none Parameter Type 3 8 8 EMC AUX STAT TYPE Description NML Type 1299 Written From none Read To none Parameter Type estop int estopIn int dout unsigned charJEMC AUX DOUT unsigned char EMC AUX MAX DIN aout doubleJEMC AUX MAX AOUT ain double EMC AUX MAX 3 9 SPINDLE 3 9 1 EMC SPINDLE INIT TYPE Description NML Type 1301 Written From none Read To none Parameter Type 3 9 2 EMC SPINDLE HALT TYPE Description NML Type
104. pts amp Makefiles Not everyone has the same tools and packages installed Some people use vi others emacs A few even avoid having either package installed preferring a lightweight text editor such as nano or the one built in to Midnight Commander gawk versus mawk Again not everyone will have gawk installed mawk is nearly a tenth of the size and yet conforms to the Posix AWK standard If some obscure gawk specific command is needed that mawk does not provide than the script will break for some users The same would apply to mawk In short use the generic awk invocation in preference to gawk or mawk 4 9 C Conventions C coding styles are always likely to end up in heated debates a bit like the emacs versus vi arguments One thing is certain however a common style used by everyone working on a project leads to uniform and readable code Naming conventions Constants either from defines or enumerations should be in upper case through out Rationale Makes it easier to spot compile time constants in the source code e g 55 Classes and Namespaces should capitalize the first letter of each word and avoid underscores Rationale Identifies classes constructors and destructors e g GtkWidget Methods or function names should follow the C recommendations above and should not include the class name Rationale Maintains a common style across C and C sources e g get_foo_bar However boolean methods ar
105. rameter Type task EMC TASK STAT motion MOTION STAT io EMC IO STAT logFile char LINELEN logType int logSize int logSkip int logOpen int logStarted int logPoints int Developer Manual V2 5 2015 10 24 59 77 Chapter 4 Coding Style This chapter describes the source code style preferred by the LinuxCNC team 4 1 Donoharm When making small edits to code in a style different than the one described below observe the local coding style Rapid changes from one coding style to another decrease code readability Never check in code after running indent on it The whitespace changes introduced by indent make it more difficult to follow the revision history of the file Do not use an editor that makes unneeded changes to whitespace e g which replaces 8 spaces with a tabstop on a line not otherwise modified or word wraps lines not otherwise modified 4 2 Tab Stops A tab stop always corresponds to 8 spaces Do not write code that displays correctly only with a differing tab stop setting 4 3 Indentation Use 4 spaces per level of indentation Combining 8 spaces into one tab is acceptable but not required 4 4 Placing Braces Put the opening brace last on the line and put the closing brace first qox 4 do something appropriate The closing brace is on line of its own except in the cases where it is followed by continuation of the same statemen
106. random and nonrandom toolchangers When LinuxCNC is configured for a nonrandom toolchanger the pocket number in the tool file can be any positive integer pocket 0 is not allowed LinuxCNC silently compactifies the pocket numbers when it loads the tool file so there may be a difference between the pocket numbers in the tool file and the internal pocket numbers used by LinuxCNC with nonrandom toolchanger When LinuxCNC is configured for a random toolchanger the pocket numbers in the tool file must be between 0 and 55 inclusive Pockets 1 55 are in the toolchanger pocket 0 is the spindle diameter Diameter of the tool in machine units tool length offset Tool length offset also called TLO in up to 9 axes in machine units Axes that don t have a specified TLO get 0 2 23 3 Gcodes affecting tools The gcodes that use or affect tool information are 2 23 31 Txxx Tells the toolchanger hardware to prepare to switch to a specified tool xxx Handled by Interp convert tool select 1 The machine is asked to prepare to switch to the selected tool by calling the Canon function SELECT POCKET with the pocket number of the requested tool a saicanon No op b emccanon Builds an TOOL PREPARE message with the requested pocket number and sends it to Task which sends it on to IO IO gets the message and asks HAL to prepare the pocket by setting iocontrol 0 tool prep pocket iocontrol 0 too
107. rideLimits emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisOverrideLimits taskintf cc which sends EMCMOT OVERRIDE LIMITS Parameter Type axis in EMC AXIS MSG int 3 3 29 AXIS SET OUTPUT TYPE Description NML Type sets an DAC output value 130 Obs currently not used in EMC2 needs to go to HAL Written From sendAxisSetOutput emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetOutput taskintf cc which sends EMCMOT DAC OUT Parameter Type axis in EMC AXIS CMD MSG int output double 3 3 30 AXIS LOAD COMP TYPE Description NML Type loads compensation values from a file 131 Obs currently usrmotLoadComp if 0 ed in EMC2 Written From sendAxisLoadComp emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisLoadComp minimilllbridgeporttaskintf cc which calls usrmotLoadComp Parameter Type axis in EMC AXIS CMD MSG int file char LINELEN Developer Manual V2 5 2015 10 24 35 77 3 3 31 EMC AXIS ALTER TYPE Description NML Type loads the alter value to modify the axis position 132 Written From sendAxisAlter emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcAxisAlter taskintf cc which calls usrmotAlter Parameter Type axis in EMC AXIS MSG int alter double 3 3 32 AXIS SET STEP PARAMS TYPE Description NML Type was used to set step related params 133 Obs currentl
108. ription NML Type used to reset serial number to original 21 Written From thisOuit emcsh cc Read To emctaskmain cc Parameter Type none Developer Manual V2 5 2015 10 24 29 77 3 2 2 EMC SET DEBUG TYPE Description NML Type sets debug level 22 Written From emcloSetDebug iotaskintf cc sendDebug emcsh cc Read To emctaskmain cc ioControl cc Parameter Type debug int 3 2 3 SYSTEM Description NML system command 30 Written From user defined add m code emctask cc Read To emcSystemCmd emctaskmain cc Parameter Type string char LINELEN 3 3 EMC AXIS 3 3 1 AXIS SET AXIS TYPE Description NML Type axis type to linear or angular 101 Obs not used Written From none Read To none Parameter Type axis in AXIS CMD MSG int axisType unsigned char 3 3 2 EMC AXIS SET UNITS TYPE Description NML Type units conversion factor 102 Obs not used Written From none Read To none Parameter Type axis in EMC AXIS CMD MSG int units double 3 3 3 EMC AXIS SET GAINS TYPE Description NML Type Set the PID gains 103 Obs currently not used in EMC2 needs to go to HAL Written From none Read To emctaskmain cc Parameter Type axis in EMC AXIS CMD MSG int p double i double d double ff0 double ff1 double ff2 double backlash double bias double maxError double 3 3 4 AXIS SET CY
109. rity int Developer Manual V2 5 2015 10 24 41 77 3 4 28 EMC TRAJ CLEAR PROBE TRIPPED FLAG TYPE Description NML Type clears the probe tripped 228 Obs used Written From TURN PROBE ON emccanon cc sendClearProbeTrippedFlag emcsh cc Read emcTaskIssueCommand emctaskmain cc calls emcTrajClearProbeTrippedFlag minimill bridgeporttaskintf cc which sends EMCMOT CLEAR PROBE FLAGS Parameter Type 3 4 29 EMC TRAJ PROBE TYPE Description NML Type performs a straight probe move 229 Obs used Written From STRAIGHT PROBE emccanon cc sendProbe emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcTrajProbe minimill bridgeporttaskintf cc which sends EMCMOT PROBE Parameter Type pos EmcPose 3 4 30 EMC TRAJ SET TELEOP ENABLE TYPE Description NML Type sets the traj mode to teleop 230 Obs used Written From sendSetTeleopEnable emcsh cc Read emcTaskIssueCommand emctaskmain cc calls emcTrajSetMode minimill bridgeporttaskintf cc which sends EMCMOT TELEOP Parameter Type enable int 3 4 31 EMC TRAJ SET TELEOP VECTOR TYPE Description NML Type jogs in teleop mode 231 Obs used for jogging in teleop mode Written From sendJogCont emcsh cc Read emcTaskIssueCommand emctaskmain cc calls emcTrajSetTeleop Vector minimill bridgeporttaskintf cc which sends EMCMOT SET TELEOP VECTOR Parameter Type vector EmcPose 3 4 32 EMC TRAJ STAT TYPE
110. rts of the machine Joints are distinct from axes although the two terms are sometimes mis used to mean the same thing In LinuxCNC a joint is a physical thing that can be moved not a coordinate in space For example the quill knee saddle and table of a Bridgeport mill are all joints The shoulder elbow and wrist of a robot arm are joints as are the linear actuators of a hexapod Every joint has a motor or actuator of some type associated with it Joints do not necessarily correspond to the X Y and Z axes although for machines with trivial kinematics that may be the case Developer Manual V2 5 2015 10 24 3 77 Even on those machines joint position and axis position are fundamentally different things In this document the terms joint and axis are used carefully to respect their distinct meanings Unfortunately that isn t necessarily true everywhere else In particular GUIs for machines with trivial kinematics may gloss over or completely hide the distinction between joints and axes In addition the ini file uses the term axis for data that would more accurately be described as joint data such as input and output scaling etc e POSE A pose is a fully specified position in 3 D Cartesian space In the LinuxCNC motion controller when we refer to a pose we mean an EmcPose structure containing three linear coordinates and three angular ones 2 4 Architecture overview There are four components contained in the LinuxCNC Architectur
111. s been set to True indicating the toolchanger has completed the tool change When this happens it calls 1 to update the machine state i load tool with a nonrandom toolchanger config copies the tool information from the selected pocket to the spindle pocket 0 ii load tool with a random toolchanger config swaps tool information between pocket 0 the spindle and the selected pocket then saves the tool table 2 Back in interp settings current pocket is assigned the new tool from settings gt selected pocket set by Txxx The relevant numbered parameters 5400 5413 are updated with the new tool information from pocket 0 spindle 2 23 3 3 G43 G43 1 G49 Apply tool length offset G43 uses the TLO of the currently loaded tool or of a specified tool if the H word is given in the block G43 1 gets TLO from axis words in the block G49 cancels the TLO it uses 0 for the offset for all axes Handled by Interp convert tool length offset 1 It starts by building an EmcPose containing the 9 axis offsets to use For G43 1 these tool offsets come from axis words in the current block For G43 these offsets come from the current tool the tool in pocket 0 or from the tool specified by the H word in the block For G49 the offsets are all 0 2 The offsets are passed to Canon s USE TOOL LENGTH OFFSET function a saicanon Records the TLO in tool offset
112. s defined in src hal hal h Developer Manual V2 5 2015 10 24 6 77 SHARED MEMORY BUFFER NML CMD STAT ERR mM CARTESIAN MOTION POSITION COMMANDS STATUS EMCMOT EMCIO passaa DEN k n TRAJECTORY Kod PLANNER Ko N ro Kod FORWARD INVERSE LIMIT amp HOME i n ot Fog KINEMATICS KINEMATICS STATUS Ko TEE bs o a bd AXIS 1 AXISN EE INTERPOLATOR T E EN itr 1 n Ko UV Po Y E Fdo 1 ot PID EE hio na SERVO E N E i E E i Ko UNIT UNIT Ko MEME i CONVERT CONVERT Po b Xa ty i 1 HARDWARE ABSTRACTION LAYER DEFINED IN AND IMPLEMENTED IN EXT C ENCODER MOTO nn AM N an ih 7 2 ENCODER D A DIGITAL ll DIGITAL 1 0 COUNTER CONVERTER gat ANALOG 1 0 i i i 4 Y Y POWER LIMIT vc Fe gt i SPINDLE DRIVE COOLANT Ds GS TOOL I UE YS CHANGER Developer Manual V2 5 2015 10
113. sendLogOpen emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcLogOpen taskintf cc which sends EMCMOT OPEN LOG Parameter Type file char LINELEN type int size int skip int which int triggerType int triggerVar int triggerThreshold double 3 15 2 EMC LOG START TYPE Description NML Type starts logging 1905 Obs not used in 2 it was used in EMC 1 from emclog tcl Written From sendLogStart emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcLogStart taskintf cc which sends EMCMOT START LOG Parameter Type none 3 15 3 EMC LOG STOP TYPE Description NML Type stops logging 1906 Obs not used in EMC2 it was used in EMC 1 from emclog tcl Written From sendLogStop emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcLogStop taskintf cc which sends EMCMOT STOP LOG Parameter Type none Developer Manual V2 5 2015 10 24 58 77 3 15 4 EMC LOG CLOSE TYPE Description NML Type closes the log file 1907 Obs not used in EMC2 it was used in EMC 1 from emclog tcl Written From sendLogClose emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcLogClose taskintf cc which sends EMCMOT CLOSE LOG Parameter Type none 3 16 EMC STAT 3 16 4 STAT TYPE Description NML Type aggregation of all the status messages not sent as a message but used as is all over the place 1999 Written From none Read To none Pa
114. sport more than just Z offset used for tool length Written From USE TOOL LENGTH OFFSET emccanon cc Read emcTaskIssueCommand emctaskmain cc remembers the origin offset into emcStatus gt task origin Parameter Type offset EmcPose 3 4 24 EMC TRAJ SET ORIGIN TYPE Description NML Type sets the origin coords 7 224 Obs used Written From SET ORIGIN OFFSETS emccanon cc Read emcTaskIssueCommand emctaskmain cc remembers the tool length offset Parameter Type origin EmcPose 3 4 25 EMC TRAJ SET HOME TYPE Description NML Type 225 Obs not used Written From none Read To none Parameter Type home EmcPose 3 4 00 EMC TRAJ SET PROBE INDEX TYPE Description NML Type sends the index pin used for probing 226 Obs should get obsolete probin pin should get routed by HAL Written From sendSetProbeIndex emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcTrajSetProbeIndex minimill bridgeporttaskintf cc which sends EMCMOT SET PROBE INDEX Parameter Type index int 3 4 27 EMC TRAJ SET PROBE POLARITY TYPE Description NML Type sends the polarity for the pin used for probing 227 Obs should get obsolete probin pin polarity should get routed by HAL Written From sendSetProbePolarity emcsh cc Read To emcTaskIssueCommand emctaskmain cc calls emcTrajSetProbePolarity minimill bridgeporttaskintf cc which sends EMCMOT SET PROBE POLARITY Parameter Type pola
115. t 1 while in a do statement or an else in an if statement like this do 1 something important while x 0 Developer Manual V2 5 2015 10 24 60 77 and ae v 1 do one thing else if x lt y do another thing else lel This brace placement also minimizes the number of empty or almost empty lines which allows a greater amount of code or comments to be visible at once in a terminal of a fixed size 4 5 Naming Cis a Spartan language and so should your naming be Unlike Modula 2 and Pascal programmers C programmers do not use cute names like This VariableIsATemporaryCounter A C programmer would call that variable tmp which is much easier to write and not the least more difficult to understand However descriptive names for global variables are a must To call a global function foo is a shooting offense GLOBAL variables to be used only if you really need them need to have descriptive names as do global functions If you have a function that counts the number of active users you should call that count active users or similar you should not call it cntusr Encoding the type of a function into the name so called Hungarian notation is brain damaged the compiler knows the types anyway and can check those and it only confuses the programmer No wonder Microsoft makes buggy programs LOCAL variable names should be short and to the point If you
116. t functions for each message type This last item is probably nub of much of the malignment of libnml rcslib and NML in general Each message that is passed via NML requires a certain amount of information to be attached in addition to the actual data To do this several formatting functions are called in sequence to assemble fragments of the overall message The format functions will include NML TYPE MSG TYPE in addition to the data declared in derived NMLmsg classes Changes to the order in which the formatting functions are called and also the variables passed will break compatibility with rcslib if messed with There are reasons for maintaining rcslib compatibility and good reasons for messing with the code The question is which set of reasons are overriding Developer Manual V2 5 2015 10 24 21 77 2 21 1 NML internals 2 21 1 1 NML constructor NML NML parses the config file and stores it in a linked list to be passed to cms constructors in single lines It is the function of the NML constructor to call the relevant cms constructor for each buffer and maintain a list of the cms objects and the processes associated with each buffer It is from the pointers stored in the lists that NML can interact with cms and why Doxygen fails to show the real relationships involved Note The config is stored in memory before passing a pointer to a specific line to the cms constructor The cms constructor then parses the line again to
117. t point such as YO Fixture offsets can be used to shift the actual execution point of that gcode program to properly fit the true location of the vise and jaws Tool offsets can be used to shift the uncorrected length of a tool to equal that tool s actual length Part Program A description of a part in a language that the controller can understand For LinuxCNC that language is RS 274 NGC commonly known as G code Program Units The linear and angular units used in a part program The linear program units do not have to be the same as the linear machine units See G20 and G21 for more information The angular program units are always measured in degrees Python General purpose very high level programming language Used in LinuxCNC for the Axis GUI the Stepconf configuration tool and several G code programming scripts Rapid Fast possibly less precise motion of the tool commonly used to move between cuts If the tool meets the workpiece or the fixturing during a rapid it is probably a bad thing Rapid rate The speed at which a rapid motion occurs In auto or mdi mode rapid rate is usually the maximum speed of the machine It is often desirable to limit the rapid rate when testing a g code program for the first time Real time Software that is intended to meet very strict timing deadlines Under Linux in order to meet these requirements it is necessary to install a realtime kernel such as RTAI and build the software to run in
118. the special real time environment For this reason real time software runs in kernel space RTAI Real Time Application Interface see https www rtai org the real time extensions for Linux that LinuxCNC can use to achieve real time performance RTLINUX See https en wikipedia org wiki RTLinux an older real time extension for Linux that LinuxCNC used to use to achieve real time performance Obsolete replaced by RTAI RTAPI A portable interface to real time operating systems including RTAI and RTLINUX RS 274 NGC The formal name for the language used by LinuxCNC part programs Servo Motor Generally any motor that is used with error sensing feedback to correct the position of an actuator Also a motor which is specially designed to provide improved performance in such applications Servo Loop A control loop used to control position or velocity of an motor equipped with a feedback device Signed Integer A whole number that can have a positive or negative sign In HAL it is known as s32 A signed 32 bit integer has a usable range of 2 147 483 647 to 2 147 483 647 Spindle The part of a machine tool that spins to do the cutting On a mill or drill the spindle holds the cutting tool On a lathe the spindle holds the workpiece Developer Manual V2 5 2015 10 24 71 77 Spindle Speed Override A manual operator controlled change in the rate at which the tool rotates while cutting Often used to allow the operator to adjust
119. thing that Developer Manual V2 5 2015 10 24 73 77 could fall directly within that overall subject For example if the Document is part a textbook of mathematics Secondary Section may not explain any mathematics The relationship could be a matter of historical connection with the subject or with related matters or of legal commercial philosophical ethical or political position regarding them The Invariant Sections are certain Secondary Sections whose titles are designated as being those of Invariant Sections in the notice that says that the Document is released under this License The Cover Texts are certain short passages of text that are listed as Front Cover Texts or Back Cover Texts in the notice that says that the Document is released under this License A Transparent copy of the Document means a machine readable copy represented in a format whose specification is available to the general public whose contents can be viewed and edited directly and straightforwardly with generic text editors or for images composed of pixels generic paint programs or for drawings some widely available drawing editor and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subseguent modification by readers is not Transparent A copy that
120. ving and the move will continue until stopped by an ABORT command or by hitting a limit The free mode planner accelerates at the joint accel limit at the beginning of the move and will decelerate at the joint accel limit when it stops 2 7 20 JOG INCR The JOG INCR command initiates an incremental jog on a single joint Incremental jogs are cumulative in other words issuing two JOG INCR commands that each ask for 0 100 inches of movement will result in 0 200 inches of travel even if the second command is issued before the first one finishes Normally incremental jogs stop when they have traveled the desired distance however they also stop when they hit a limit or on an ABORT command 2 7 20 1 Requirements The command handler will silently reject the INCR command if machine is not in free mode or if any joint is in motion GET MOTION INPOS FALSE or if motion is not enabled It will also silently ignore the command if the joint is already at or beyond its limit and the commanded jog would make it worse 2 7 20 2 Results The free mode trajectory planner for the joint identified by emcmotCommand gt axis is activated the target position is increment ed decremented by emcmotCommand gt offset and the velocity limit is set to emcmotCommand gt vel The free mode trajectory planner will generate a smooth trapezoidal move from the present position to the target position The planner can correctly handle changes in the targ
121. xes like rotary tables are referred to as A B and C Additional linear axes relative to the tool are called U V and W respectively Axis GUI One of the Graphical User Interfaces available to users of LinuxCNC It features the modern use of menus and mouse buttons while automating and hiding some of the more traditional LinuxCNC controls It is the only open source interface that displays the entire tool path as soon as a file is opened Backlash The amount of play or lost motion that occurs when direction is reversed in a lead screw or other mechanical motion driving system It can result from nuts that are loose on leadscrews slippage in belts cable slack wind up in rotary couplings and other places where the mechanical system is not tight Backlash will result in inaccurate motion or in the case of motion caused by external forces think cutting tool pulling on the work piece the result can be broken cutting tools This can happen because of the sudden increase in chip load on the cutter as the work piece is pulled across the backlash distance by the cutting tool Backlash Compensation Any technique that attempts to reduce the effect of backlash without actually removing it from the mechanical system This is typically done in software in the controller This can correct the final resting place of the part in motion but fails to solve problems related to direction changes while in motion think circular interpolation and motion that
122. y not used in EMC2 needs to go to HAL maybe directly from the ini not through NML Written From none Read To emcTaskIssueCommand emctaskmain cc calls emcAxisSetStepParams taskintf cc which sends EMCMOT SET STEP PARAMS Parameter Type axis in AXIS CMD MSG int setup time double hold time double 3 3 33 EMC AXIS STAT TYPE Description NML Type status for axis not sent as a message but used as is 199 Written From none Read To none Parameter Type a HUGE load of params 3 4 EMC TRAJ 3 4 1 TRAJ SET AXES Description NML Type 201 Obs not used Written From none Read To none Parameter Type axes int 3 4 2 TRAJ SET UNITS Description NML Type 202 Obs not used Written From none Read To none Parameter Type linearUnits double angularUnits double Developer Manual V2 5 2015 10 24 36 77 3 4 3 TRAJ SET CYCLE TIME Description NML Type 203 Obs not used Written From none Read To none Parameter Type cycleTime double 3 4 4 EMC TRAJ SET MODE TYPE Description NML Type 204 Obs not used Written From none Read To none Parameter Type mode enum EMC TRAJ MODE ENUM 3 4 5 EMC TRAJ SET VELOCITY TYPE Description NML Type sends a reguest to set the vel which is in internal units sec 205 Written From sendVelMsg emccanon cc Read emcTaskIssueCommand emctaskmain cc

Download Pdf Manuals

image

Related Search

Related Contents

Argo Navis User Manual  SCA031U サイドカメラ接続アダプター  SHAKE-5  Hampton Bay ES0746BN Use and Care Manual  InSinkErator H-CONTOUR-SS Use and Care Manual  basic in-ground fence™ - Drs. Foster and Smith  IC-F50/F51 SERVICE MANUAL - R  ClosetMaid 6209 Instructions / Assembly  

Copyright © All rights reserved.
Failed to retrieve file