LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Overview of the Toolchange process


refers to the process where the tool required by the current program is inserted into the spindle. Toolchange can be either manual, or automatic, for instance by using a tool changer, like a rotatable carousel or turret to hold tools, and an arm mechanism to remove/insert tools and place them back into a pocket

a numbered place in a tool changer, to hold a tool.

moving a tool changers position so a given pocket is accessible to the change arm mechanism. The reason while prepare is a separate step from the actual change is that on some changers, prepare can run in parallel with machining which might save time.

Non-random tool changer
a type of changer where the current tool is unloaded into an empty pocket, the changer moved to the pocket holding the new tool, and the new tool is loaded from this pocket.

Random tool changer
a type of changer where the current tool is exchanged with the tool in the prepared pocket.

Tool number
unique identification for a tool. Depending on mechanism, a tool number might or might not identify a pocket. In the case of a random toolchanger, the tool table holds the mapping from tool number to pocket number; on tool change, the tool table is updated to reflect the tool's new pocket position.

Tool changing in EMC

EMC employs the iocontrol component to support a variety of different tool change process. iocontrol provides a range of pins to signal and handshake prepare and change operations, and to communicate tool and pocket numbers to a tool changer. It has specific support for random toolchangers if the RANDOM_TOOLCHANGER option is set in EMCIO.

The tool changer may be actual hardware connected to HAL lines, or a program mapping between hardware and iocontrol lines, for instance a ladder program, or Python script. In the case of a manual toolchanger, it would typically be a script like hal_manualtoolchange . In a simulated environment, it might make sense to disable the external toolchanger completely and "fake" immediate prepare and change completion by looping the tool-prepare and tool-prepared lines, and the tool-change and tool-changed lines respectively.

Prepare operation

The prepare operation is initiated by a T<toolnumber> command. This toolnumber is used in a later change step as the M6 command carries no tool number attribute by itself. The following signals support the prepare step

If a given toolchanger does not support prepare, or it is not needed (e.g. manual toolchange or simulator mode), these signals should be looped for immediate acknowledgement in HAL as follows:

 net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared 

Change operation

The change operation is initiated by an M6 command, which relies on the number of the tool to be loaded having been set by a previous T<toolnumber> command. When using a random toolchanger with prepare capability, it might make sense to execute the T<next-toolnumber> immediately after an M6 to give the prepare mechanism ample time to position. In nonrandom or manual toolchange scenarios this has no effect so T<toolnumber> and M6 could well be on the same line.

The following signals support the change step:

If in a given setup the tool change step is not needed (e.g. simulator mode), these signals should be looped for immediate acknowledgement in HAL as follows:

 net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed 

The current Toolchanger protocol

Here's a diagram of a complete prepare and change cycle. It leaves out those pins which convey tool and pocket numbers because they are not relevant for handshaking.



  1. A T<toolnumber> command causes the tool-prep-number pin set to <toolnumber>. With the RANDOM_TOOLCHANGER option, the tool's pocket number is read from the tool table, and reflected in pin tool-prep-pocket. Then the tool-prepare pin is raised. This is to signal the toolchanger which tool/pocket is next. It is expected to acknowledge immediately that it got the number, even if actual preparations takes a long time. FIXME: is the last sentence correct?
  2. To acknowledge it got the tool number to prepare next, the toolchanger asserts the tool-prepared pin. FIXME - does tool-prepared=1 mean 'I got the pocket number' or 'I moved the carousel to this number'?
  3. iocontrol sees the tool-prepared pin at 1, and deasserts tool-prepare to acknowledge.
  4. The toolchanger sees tool-prepare going low and in response deasserts tool-prepared. The prepare cycle is now complete.
  5. An M6 command initiates the tool loading cycle. iocontrol asserts tool-change.
  6. The toolchanger completes the tool load and signals that with asserting tool-changed.
  7. iocontrol the tool-changed pin at 1, and deasserts tool-change to acknowledge.
  8. The toolchanger sees tool-change going low and in response deasserts tool-changed. The change cycle is now complete.

Note that the prepare cycle only communicates the next tool number, it does not wait for the actual preparation to complete. FIXME: correct? The T<toolnumber> command completes only after iocontrol sees the tool-prepared pin at 1.

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited January 5, 2011 2:17 am by MichaelHaberler (diff)
Published under a Creative Commons License