My approach would be to use a facility that allowed custom Gcodes and Mcodes. They would be implemented as gcode subroutines. Then M6 would cause a gcode subroutine to be called.
The routine would first save the current X, Y, Z coordinates and other relevant state information. (If that state info is not currently available, some changes to the interpreter to support better introspection would be necessary.) Then the routine could use normal gcode commands to start and stop the spindle, move to the proper location, unload one tool, load the next tool, etc. Finally the routine would restore the state info including moving back to the saved XYZ position. I think this will be pretty easy once we have the necessary enhancements to EMC. (Integrator/User defined Gcodes/Mcodes and more complete introspection.) Ken John Kasunich wrote: > Andrew Bailey wrote: >> I have read the message about a custom toolchanger: >> >> http://sourceforge.net/mailarchive/message.php?msg_id=47E551A7.7040908%40sover.net >> >> We plan to implement a toolchanger by moving the spindle to a fixed >> location and then use the spindle motor at low rpm to perform the >> toolchange using a solenoid to secure the toolchanger fixed to the >> spindle. The tools would be in a linear rack with springs in the base. >> >> >> The procedure would be something like this: >> >> Receive change command: >> >> net tool-change iocontrol.0.tool-change => myprogram.change >> net tool-number iocontrol.0.tool-prep-number => myprogram.number >> >> If there is no current tool in the spindle: >> >> 1 Lookup the position of the tool >> 2 Perform a linear move the spindle in z to a safe position >> 3 Perform a linear move the spindle in x and y to the position of the tool >> 4 Perform a linear move in z to the position of the tool >> 5 Turn on Solenoid >> 6 Rotate spindle until torque limit reached, tool now gripped >> 7 reverse of movements 4,3,2 >> >> Inform emc that the tool has been prepared >> >> net tool-changed iocontrol.0.tool-changed <= myprogram.changed >> >> What does this line do? >> net tool-prepare-loopback iocontrol.0.tool-prepare => >> iocontrol.0.tool-prepared >> > > Do I need to set this using the program or is the loopback setting ok. > > > > EMC (and many other controls) let you select the next tool before you > issue the actual tool change. The simplest toolchange in EMC g-code is > "TxM6", where x is the number of the tool that you want. That line of > g-code says "select tool x, then insert that tool in the spindle". Some > machines have many tools, and it may take a long time to rotate the tool > carrier to the proper tool. To minimize wasted time, you can do the > following: > > T1M6 (select tool 1 and load it) > G1 (start cutting with tool 1) > T2 (select tool 2) > G1 (continue cutting with tool 1) > G2 (more cutting) > ... (many more lines of cutting, etc) > G1 (finish cutting with tool 1) > M6 (load tool 2 that was selected many lines ago) > T3 (select the next tool) > G1 (start cutting tool 2) > etc. > > That allows you to overlap the time it takes to retrieve the new tool > with the cutting time of the current tool. > > When you issue Tx, EMC sends the tool number 'x' to pin tool-prep-number > and sets pin tool-prepare true. When you issue M6, EMC first waits > until pin tool-prepared is true, then it sets pin tool-change true, and > waits until pin tool-changed goes true. > > For machines that don't attempt to overlap the tool selection process > with cutting time, or that don't have a 'tool selection process', the > tool-prepare-loopback signal tells EMC to immediately proceed with the > tool change when you issue M6. > >> How can you override the emc g code control of the motion and send >> these custom linear movement commands, temporarily? > > That is difficult at the moment. We have been unable to come up with a > clean and simple way to allow toolchange logic to control machine > motion. This has been discussed in the past, because quite a few > machines use the kind of toolchanger where each tool is stored in a > different place, and the machine axes are used to move to the proper > place for each tool. > >> I have looked at the file tp.c, but am not sure how to call it or >> whether calling it will interfere with emc motion control. > > You don't want to call tp.c for this. > > Some of the ideas considered for your kind of toolchanger have involved > g-code subroutines, since they can control both motion and logic. Other > possibilities including writing the toolchanger logic in classicladder, > and providing hooks to allow classicladder to issue motion commands > during a toolchange. All of the methods discussed so far have had one > or more serious problems, and nobody has been sufficiently motivated to > work out the details. (In part because none of the active developers > has a machine with such a toolchanger.) Perhaps your project will be an > opportunity to work out a solution. > >> Hope someone can help out. >> >> Any code we write will be contributed back to the community. >> >> Thanks in advance. > > Regards, > > John Kasunich > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users -- Kenneth Lerman Mark Kenny Products Company, LLC 55 Main Street Newtown, CT 06470 888-ISO-SEVO 203-426-7166 ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users