http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/toolchange-osub-iov2

This branch integrates two major changes to how tool changing is handled in 
EMC: the iocontrolv2 component, and toolchange handling through G-code o-word 
subroutines.

The reason why they are integrated in this branch is: the support in 
iocontrolv2 for soft-failing toolchanges (e.g. jammed toolchanger) and the 
handling of Tx and M6 commands through oword subroutines can work together 
('soft-fail' meaning: 'set a #5xxx parameter and continue' as opposed to 
'abort').

This branch is not merge-ready, and has some debug code in it. I publish this 
hoping to get feedback wether the feature set makes sense, is worthwhile, and 
uncover any glaring defects or missing features I didnt think of, or didnt find.


The iocontrolv2 component:
--------------------------
This is really a replacement for iocontrol. It matches the description in 
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ToolchangerProtocolProposal .
I havent gone for a patch but a replacement binary because of pervasive changes 
to a critical component, and I didnt want to force everybody to switch. It is 
possible to run the oword-sub based toolchanger Tx/M6 commands with the old 
iocontrol, but its less flexible wrt aborts of the change process.

The Tx/M6 replacement Oword handlers
------------------------------------
There are three new inifile options which selectively activate handling of Tx 
and M6 through oword subroutines, or leave the existing mechanism in place 
(default).

These are (see configs/sim/owordm6-ui.ini):

[RS274NGC]
# remap T<pocket> to a named oword subroutine.
# The tool number will be passed as parameter #1
# The pocket number will be passed as parameter #2
T_COMMAND=o<tdemo>call

# remap M6 to a named oword subroutine.
# the tool number currently loaded (in spindle) is passed as parameter #1
M6_COMMAND=o<m6demo>call

# handler gsub called on IoAborts - to cleanup HAL pins etc
ON_ABORT_COMMAND=o<on_abort>call

The third - ON_ABORT_COMMAND - warrants some explanation. 

Since T_COMMAND and M6_COMMAND refer to g-code subroutines, these may be 
aborted by the Escape key in Axis, the halui.abort pin and other mechanisms 
causing an abort. For instance, if the tool-prepare pin (or rather its 
motion.digital-out-XX equivalent) is asserted and then an abort happens, that 
pin would remain active. To make sure the abort will recover to a defined 
state, any cleanup commands may be added to the oword sub referred to by 
ON_ABORT_COMMAND, like resetting those HAL pins. For you Pythonistas, it's 
easiest to think of it as an EmcIoAbort exception handler.

Remapping M6 with M6_COMMAND effectively disables the existing iocontrol-based 
toolchanger support, replacing it by the oword subroutine. This may not always 
be desirable; for instance it makes perfect sense to leave Tx support as is, 
and use a remapped M6 oword subroutine.  This leaves open how the 
iocontrol-based toolchange is referred to. I have used the M69 unused M-code to 
provide the same semantics of the former M6.

Trying it all out
-----------------
- pull git://git.mah.priv.at/emc2-dev.git branch toolchange-osub-iov2
- build
- cd configs/sim
- emc owordm6-ui.ini
- home all, run .
You'll find a gladevcp panel on the right hand side of axis with leds showing 
the toolchanger HAL pins, and buttons to acknowledge the prepare and change 
pins.

Running the ngc file demonstrates Tx and M6 remapped to oword subs, and the 
abort handler 

See the nc_files/tdemo.ngc and nc_files/m6demo.ngc files for details.

To see the abort handler being called, just hit Escape in idle mode or press 
the halui.abort button. For details, see nc_files/on_abort.ngc .

Jog during toolchange
I havent tried this out just yet since I'm fighting with an M66 issue, but it 
should be possible to at least provide some basic jogging support through 
quering HAL pins and doing something reasonable. Halui-based jog most likely 
wont work.


Misc changes
I added a #5599 parameter to control the output of (DEBUG, xxx) messages

It's 1.0 by default - setting it to 0.0 will disable debug output.


Usage scenarios
---------------
- traditional iocontrol support: no change to ini file
- use iocontrolv2: change ini as follows: [EMCIO] EMCIO=iov2
- remap Tx, M6 or abort: see above
- use the toolchanger soft-fail feature in iov2: 
   remap M6 to gcode sub
   call M69 from that sub
   test for #5600 > 0.0
   #5601 will convey the toolchanger fault reason
   this enables you to handle the fault in the gcode sub, including recovery - 
it's handling is very similar to a G38.3/G38.5 failed probe 
- jog during toolchange:
   use timed reads on the acknowledge pins and use some other pins to read jog 
axis, amount and direction; execute G0/g1 as needed



Open issues:
------------

- Interp::execute() loops: the part I'm still unsure about are the loops in  
interp_convert.cc 2744-2746, interp_execute.cc 269-271, and rs74ngc_pre.cc 
around line 1753. Prima facie they seem to work, although I fail to fully 
understand why ;-); and Pavel doesnt approve either.

- jog during TC - I should add a demo here


-Michael


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to