- Posts: 19899
- Thank you received: 4655
Brother TC-225 / TC-229 adventure!
- andypugh
- Offline
- Moderator
-
ihavenofish wrote: so my next step is to read them in the gcode, store them in a variable, convert that to a number, and then create something that will go to a specific tool, choosing the shortest direction. I suspect this shall be fairly easy. objective is then to put in in a subroutine, and be able to type M6 T(whatever) into mdi and have it go to that tool - no axis motion yet.
Or:
linuxcnc.org/docs/2.7/html/man/man9/carousel.9.html
Please Log in or Create an account to join the conversation.
- ihavenofish
- Offline
- Platinum Member
-
- Posts: 1029
- Thank you received: 286
thanks
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19899
- Thank you received: 4655
I set up a lathe toolchanger recently and it all worked with standard LinuxCNC, no remaps and no routines.
You probably need a prepare phase, and I don't know if you need to put a tool away before selecting the new one?
If it's a random changer then you probably just need
loadrt carousel parameters......
addf carousel.0 servo-thread
net tool-prepare iocontrol.0.tool-prepare => carousel.N.enable
net pocket-num iocontrol.0.tool-prep-pocket => carousel.N.pocket-number
net changer-in-position iocontrol.0.tool-prepared <= carousel.N.ready
For a non-random changer the carousel target pocket might well want to come from A g-code sub that first starts by outputting tool-in-spindle, puts that tool away, then outputs the new pocket and continues the routine on carousel.N.ready
There is a complete example here:
github.com/LinuxCNC/linuxcnc/tree/master...smach/VMC_toolchange
This is the G-code sub:
github.com/LinuxCNC/linuxcnc/blob/master...hange/toolchange.ngc
It is _very_ close to what you need. Have you even run the Vismach sim?
Please Log in or Create an account to join the conversation.
- ihavenofish
- Offline
- Platinum Member
-
- Posts: 1029
- Thank you received: 286
my tool changer is complicated simplicity
z moves up to atc home, carousel spins where it needs to, z moves down to work piece.
so when the z has moved up, the tool has already been removed mechanically from the spindle by its fixed "pocket"
so if i were doing what I'm doing now (ignoring carousel for the moment):
// axis has moved to ATC HOME
M66 P19 L0 Q1 // we confirm we are at atc home - if not, fail
M66 P20 L0 Q1 // we do a weighted sum in hal to get the tool number from the binary pins and call it with m66 - if invalid, fail.
// place this number into a variable. subtract it from the requested tool. this new number is the number of positions to move, - or +
M64 P04 M64 P03 // move the atc in the chosen direction
M66 P12 L1 Q1 // monitor the encoder decel track for a rising edge, counting them.
G1 X Y F590 // move the x and y to their next positions while the atc rotates.
M65 P03 // brake the tool changer after weve counted the right number of tools
M66 P20 L0 Q1 // we do a weighted sum in hal to get the tool number from the binary pins and call it with m66 - if it does not match the desired tool, fail,
// continue on with z motion etc
obviously we need all the if/else/while routines in there
this is why I'm a bit lost on your carousel, only because i am doing things DURING the tool change and your carousel component seems like a do everything in one box, and overkill just to get an encoder number returned? i assume I'm totally wrong there, but I'm slowly figuring all this out
Please Log in or Create an account to join the conversation.
- ihavenofish
- Offline
- Platinum Member
-
- Posts: 1029
- Thank you received: 286
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19899
- Thank you received: 4655
ihavenofish wrote: this is why I'm a bit lost on your carousel, only because i am doing things DURING the tool change and your carousel component seems like a do everything in one box, and overkill just to get an encoder number returned? i assume I'm totally wrong there, but I'm slowly figuring all this out
Carousel works out the gray-code or binary current position, works out the shortest direction, outputs a motor command then turns off the motors when in-position and returns a HAL pin reporting success.
You can quite readily do other things like move axes while this is going on.
Please Log in or Create an account to join the conversation.