Brother TC-225 / TC-229 adventure!

More
16 Aug 2017 19:09 #97593 by ihavenofish
this is from another thread

.ini:
[AXIS_2]
MAX_LIMIT = 0
MAX_LIMIT_TOOLCHANGE = 200

postgui.hal:
loadrt mux2
addf mux2.0 servo-thread
setp mux2.0.in0 #<_ini[AXIS_2]MAX_LIMIT>
setp mux2.0.in1 #<_ini[AXIS_2]MAX_LIMIT_TOOLCHANGE>
net extend_z_max motion.digital-out-10 => mux2.0.sel
net z-max-limit mux2.0.out => ini.2.max_limit

change.ngc:
M64 P#10 ; enable off-limit movement
G53 G0 Z[#<_ini[CHANGE_POSITION]Z>]
...
G53 G0 Z[#<_ini[AXIS_2]MAX_LIMIT>]
M65 P#10 ; restore z max limit


....................

is that what i would use to swap my z limits for tool change? the M64/M65 here reference non physical pins here correct?

thanks!

Please Log in or Create an account to join the conversation.

More
17 Aug 2017 03:15 #97609 by ihavenofish
I has a spinning tool changer.

m65/64 to set direction, then turn on motor. then m66 to read the deceleration track on the encoder to stop the motor.
stop instantly on a rising edge, right on each tool. works perfectly.

I can read the 4 absolute encoder tracks in hal scope and indeed, its just straight 4 bit binary to designate 1 through 10.

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.

fun fun :)

Please Log in or Create an account to join the conversation.

More
17 Aug 2017 11:45 #97614 by andypugh

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.

More
17 Aug 2017 15:16 #97642 by ihavenofish
you showed me that one before but it had me a little confused on how id use it. i wasn't ignoring it :)

thanks

Please Log in or Create an account to join the conversation.

More
17 Aug 2017 15:47 - 17 Aug 2017 15:49 #97646 by andypugh
Just hook it up in HAL and have it activated either by the tool-change-request pin or by a digital output from a G-code routine.

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?
Last edit: 17 Aug 2017 15:49 by andypugh.

Please Log in or Create an account to join the conversation.

More
17 Aug 2017 16:09 #97655 by ihavenofish
oh, ill look at it again.

my tool changer is complicated simplicity :P

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.

More
17 Aug 2017 16:14 #97656 by ihavenofish
thinking about it maybe you could see my atc identically to a lathe turret. atc home is turret unlock, and, then cw or ccw.

Please Log in or Create an account to join the conversation.

More
17 Aug 2017 21:18 #97672 by andypugh

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.

More
17 Aug 2017 21:30 #97675 by ihavenofish
ok.

would account for the deceleration track? the stop is not triggered by reading the encoder position,. but the deceleration track as it has to brake precisely.

Please Log in or Create an account to join the conversation.

More
18 Aug 2017 04:43 #97688 by ihavenofish
ok i can command to atc to go to any tool now in the shortest distance.

sorry andy, i did it in g/m code, i know you want people to use crousel so you can improve and refine it, but it made more sense inside my non programmers head the way i did it in g/m code.

the obstacles i had were:

the encoder and deceleration tracks line up on a rising edge clockwise, so you could wait for the decal edge, and ask where it was, then decide if you needed to stop.

trouble was, the other direction, nothing lined up, and you needed to stop the motor and dwell half a second to read the encoder correctly. any faster and it missed its stop.

so, i went more simple and just counted how many spots i was supposed to move, stopped the turret, and THEN asked for position. i will have it toss up an error if it was the wrong position.

the second issue i had was that weighted sums are s32, and m66 is expecting a bit. so i just did the weighted sum inside the g code. works fine, just a few more lines of code.

tomorrows tack is to stick it in a m6 called file and work out the axis motion portion.

thanks for the help andy, id be totally lost without your input :)

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.118 seconds
Powered by Kunena Forum