Changing Tools

From Jubilee
Jump to navigation Jump to search

Overall Behavior

GCode Commands

Picking up a tool change from GCode is one command. It is simply a T<x> command where <x> is the index of the tool you would like to pick up. If the carriage is currently holding onto a tool, that tool is first parked before picking up the next tool. Assuming you have set tool offsets for all of your tools, whenever a tool has been picked up from the parking post, the motion system will adjust the control point (its point of reference) such that all position commands are relative to the tip of the current tool.

Parking a tool is also one command. It is simply T-1. Once the carriage parks the prior tool, the motion system will adjust its reference point such that all position commands are relative to the trigger point of the Zprobe on the carriage.

Picking Up a Single Tool

Starting State:

  • machine is homed
  • carriage is empty (not holding onto any tools)
  • machine is at some arbitrary starting location
  • user (or program) has just issued a T0 command

Behavior:

  1. The machine saves the current control point location z value to a save slot. Let this location be the prior position z.
  2. The machine rapids in x and y to the pre-pickup position for tool 0. This position is directly behind tool 0's parking location by about 10mm. This point is defined such that the carriage can freely move in x without crashing the twist lock pin into any other tools on the rack.
  3. The machine saves the pre-pickup position x and y values to a save slot.
  4. The machine moves forward in y until the twist lock is inside tool 0's wedge plate and the coupling pins are approximately contacting the tool balls on tool 0.
  5. The machine engages the lock. The twist lock rotates until it reaches the torque limit. The tool coupling points are pulled into contact, and the tool is considered locked.
  6. Tool offsets for tool 0 are now in effect. All future commands with the tool loaded will be relative to the current tool tip.
  7. The machine restores the prior position z value. With tool offsets in effect, the result is that the bed height adjusts such that the tool tip is at the same height as the prior tool. Retracting the tool from this point does not risk crashing into the bed if the tool is tall.
  8. The machine restores the pre-pickup position y value. With tool offsets in effect, the result is that the carriage retracts the tool by moving backwards in y and the tool is released from the parking post.
  9. The machine restores the pre-pickup position x. With tool offsets in effect, the result is that the current tool tip is now at the same point in space as the Zprobe trigger point when the pre-pickup position was saved.
  10. The machine is now ready to process subsequent GCodes.

Swapping Between Tools

Starting State:

  • machine is homed
  • carriage is holding onto tool 0. Tool offsets for tool 0 are in effect.
  • machine is at some arbitrary starting location
  • user (or program) has just issued a T1 command

Behavior:

  1. The machine saves the current control point location z value to a save slot. Let this location be the prior position z.
  2. The machine increases z height slightly by a relative amount (2mm to 5mm is sufficient) such that future x and y moves do not collide with any items on the bed.
  3. The machine rapids to the pre-park position for tool 0. This position is a point specified in space that is directly behind tool 0's parking location by about 10mm. Because tool offsets are in effect, issuing a move command to this location needs to either (1) account for the tool offset or (2) specify the movement in "world" coordinates such that the tool offsets are ignored. (Option 2 can be done by prefixing GCode based movement commands with G53.) This point can be the same same as the pre-pickup position for tool 0.
  4. The machine saves x and y of this pre-park position in a save slot.
  5. The machine moves forward in y until tool 0 is fully inserted into its parking post.
  6. The machine disengages the lock. (The twist lock pin will be horizontal.)
  7. The carriage is now empty and tool offsets for tool 0 are no longer in effect. All future commands with the tool loaded use the Zprobe trigger point as the control point.
  8. The machine retracts the pin out of the tool by moving backwards in y to pre-park position y.
  9. The machine restores the carriage to the pre-park position x. This behavior causes the carriage to move such that the Zprobe trigger x and y position is now at the same point in space that the tool tip was when the point was when the position was saved.
  10. Everything from now onwards is identical to the procedure in Picking Up a Single Tool starting from (2) where the tool to be picked up is tool 1.

FAQs

Why does saving pre-park and pre-pickup positions matter?

Both of these concept serve as restore points. When the machine picks up a tool, it applies tool offsets such that the next move is relative to the tool tip. Usually, this next move is likely a point in space directly over the bed, close to where the previous tool left off as would be the case for multimaterial 3D printing. If both tools are approximately the same height, then moving in a straight line to the resume point on the bed will not likely encounter any obstacles. But if one tool is substantially taller (i.e: has a longer tool tip) than the other, then, moving in a straight line with the taller tip could crash into something on the bed or, worse, into the bed itself! Saving positions just before letting go and picking up a tool, and then returning to them ensures that the straight line movements directly back to an arbitrary point over the bed will clear the bed and the bed contents.

Implementation

Duet2/3

Duet 2 and Duet 3 boards use the built-in tool change macros to implement the behavior specified above. Invoking a tool change with T<x>, where <x> is the tool number, runs a series of certain macros (specified in the link above), depending on (1) the current tool loaded and (2) the next tool to pick up. Additionally, before invoking these macros, the Duet does two things. First, it saves the machine state. After the macros finish execution, the machine restores the machine state. This behavior enables the macro to freely toggle between absolute and relative mode within the macro without needing to worry about the mode that the machine started in. Second, the Duet saves the current location to save slot 0. This is the equivalent of invoking G60 S2. This is a convenience. This position can be restored in the macro by invoking G1 R2. This position can also be restored only on specific degrees of freedom (X, Y, or Z). In the 2.1.2 implementation and beyond, this feature is used to restore the Z height before retracting the new tool such that the tool tip does not crash into the bed if the next tool is longer than the previous tool.


Klipper

In the works!