Create Tool chnager component

I’m trying to create a tool changer component for a CNC machine. Basically the tool changer is a carousel with 20 tool positions. To pick a tool the CNC machine moves to a fixed location, the carousel rotate (with all tools) until correct tool is positioned in front of the machine spindle, the machine picks the tool and moves away. To pick another tool the machine moves back to the same fixed location, releases the tool and the carousel rotate until the next tool is positioned in front of the machine.

I’m stuck in how to create the logic to grab and release 20 tools between the CNC machine and the carousel. Any help is appreciated.


I don’t remember, but I think there is already a machine tending component in eCat that does this.

Anyway, you could create a dictionary with tool components as keys and the rotational values for the carousel joint as the values. Another dictionary could be used to store tool slot locations.

  • You could use either a String or Node List property to reference the available tools and define the needed tool.
  • If current tool does not match needed tool, lookup current tool slot location from dictionary, drive joint of carousel to needed value, use method in vcHelpers.Robot2 to place and attach current tool to carousel, and then repeat but this time pick and attach the needed tool.
So the overall process is tool change. Sub-process check current tool. Sub-process rotate carousel. Sub-process place and dismount tool. Sub-process pick and mount tool.

Is each tool a separate component that you attached and saved with the main component?


I’ve done it with a tool changer that could hold up 5 tools. It was only moving forward and back and external axises were grabbing and releasing the tools. So it was not rotating, but the principals stay the same.

The code I’m using:

def DrillTools():
ToolChangerNode = comp.findNode('NodeName')
Tools = ToolChangerNode.ChildComponents
Tool_Dict = {}
for Tool in Tools:
Matrix = Tool.PositionMatrix
Z_Axis = Matrix.P.Z
Y_Axis = Matrix.P.Y
Tool_Dict[Tool.Diameter] = [Tool, Y_Axis, Z_Axis]
return Tool_Dict

This code finds all the childcomponents of a toolchanger and return them to a dictonary.

def Get_Tool(Tool_Container, Drill_Container, Servo, Hole_Diameter, Tool_Dict):
Tool_Data = Tool_Dict.get(Hole_Diameter)
if Drill_Container.Components:
#The drill is already having a tool
Current_Tool = Drill_Container.Components[0]
#The drill isn't holding a tool currently
Current_Tool = None
if Current_Tool and Current_Tool.Diameter == Hole_Diameter:
#The drill is already having the correct tool
if Current_Tool and Current_Tool.Diameter != Hole_Diameter:
#The drill has a tool but's the wrong one
#Put the drill back
Old_Tool_Data = Tool_Dict.get(Current_Tool.Diameter)
Y = Old_Tool_Data[1]
Z = Old_Tool_Data[2]
if not Tool_Data:
if Tool_Data:
#Pick the new correct tool
Tool = Tool_Data[0]
Y = Tool_Data[1]
Z = Tool_Data[2]
Servo.move(Y + 105, Z)
Servo.move(Y, Z)
print "Couldn't find the right drill tool for hole diameter %s mm" % Hole_Diameter

This code checks if the component is holding the right tool if not, it does a tool change. If the tool isn’t there it prints a line.

My component has 5 tools but it simply could scale to 5+ components.


Thanks, it’s clear how to create the script in the Tool changer component, but how do you exchange information from the robot/machine program to the tool changer ? I.e. what program statement is used?

You could use signals to exchange information or read/write routine variables in robot program.

If a robot program will involve multiple tools, you may want to create subroutines for each tool’s operation. Another option is to use one tool frame, but use a Define Tool Statement to adjust the tool frame’s location and other properties during a simulation. For example, one tool may need a Z-axis height of 10mm, whereas another tool may need a Z-axis height of 30mm.

But depends on what you want to do versus need to do: Does the machine need to tell the robot what tool to use or should the robot already know and have it defined in its program?