Turret and Tailstock Toolchanger for a Lathe

More
19 Jan 2019 17:21 #124443 by Vitran
I am finishing up a Hardinge Superslant with an 8 tool turret and 8 tool tailstock.
What I have now:
Inputs:
- Turret and tailstock position is converted from the encoder to a number between 0-8 with 0 being the gap between turrets.
- Turret and tailstock raised/lowered
Outputs:
- Raise tool holder
- Spin tool holder clockwise
- Stop rotation. This has a paw to snap it to the desired spot so it does not overshoot.

I am looking at Carousel and have tools 1-8 are turret and 21-28 for tailstock
linuxcnc.org/docs/2.7/html/man/man9/carousel.9.html

So this has a few steps I want to do which are not too hard in Ladder, but I am unsure how to divide up the code. This is my thought process for a tool change, but I don't know exactly now.

1. Tool change requested (done in halui)
2. Figure out if on turret or tailstock (done in ladder)
3. Move axis (X for turret, W for tailstock) to max so it doesn't collide (O-code?)
4. Raise turret (Ladder)
5. Spin turret (Ladder)
6. Compare current pocket from encoder to desired pocket. When pocket=desired pocket, engage lock (Ladder)
7. Wait to ensure that lock didn't engage too late and compare again. Turn off spin motor (Ladder)
8. Lower toolhead
9. Ensure that toolhead lowered signal is on. If not, raise, turn off disable lock, lower. Maybe this could happen if there was a chip or the tool didn't get to the desired spot. If after X time, call error
10. Use new tool and tool table. Tool-changed = true

That is my game plan, but I don't know if the Carousel does that or how to do that. I would imagine what I am doing is fairly common and I am unsure if I need to do this in Ladder.

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

More
20 Jan 2019 13:04 #124477 by BigJohnT
I wrote a Lathe Turret Sim using Classicladder you can use it to experiment with.

gnipsel.com/linuxcnc/index.html

JT
The following user(s) said Thank You: nkp, Vitran

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

More
21 Jan 2019 13:47 #124533 by andypugh
I think that you might want two carousel components, one for each tool-changer.

(Actually, I have never seen a lathe with a tool-changing tailstock.)

Remap the M6 command to choose which carousel to move according to the tool number.
The following user(s) said Thank You: Vitran

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

More
23 Jan 2019 01:50 - 23 Jan 2019 01:52 #124643 by Vitran
I am trying to figure out Carousel. I know below is not complete but I am missing some key information to approach this.
# Tool	1	2	3	4	5	6	7	8
# BitD	0	0	0	0	0	0	0	1
# BitC	0	0	0	1	1	1	1	0
# BitB	0	1	1	0	0	1	1	0
# BitA	1	0	1	0	1	0	1	0

loadrt carousel pockets=8,8

setp   carousel.0.dir 1
setp   carousel.1.dir 1

net prep-num classicladder.0.s32in-01 <= iocontrol.0.tool-prep-number

net t1-bit0 wsum.0.bit.0.in <= hm2_5i25.0.7i64.0.2.input-19
net t1-bit1 wsum.0.bit.1.in <= hm2_5i25.0.7i64.0.2.input-20
net t1-bit2 wsum.0.bit.2.in <= hm2_5i25.0.7i64.0.2.input-21
net t1-bit3 wsum.0.bit.3.in <= hm2_5i25.0.7i64.0.2.input-22

net turret1-num wsum.0.sum => classicladder.0.s32in-01
net carousel.0.current-position => classicladder.0.s32in-02

#Turret 2
net t2-bit0 wsum.1.bit.0.in <= hm2_5i25.0.7i64.0.2.input-15
net t2-bit1 wsum.1.bit.1.in <= hm2_5i25.0.7i64.0.2.input-16
net t2-bit2 wsum.1.bit.2.in <= hm2_5i25.0.7i64.0.2.input-17
net t2-bit3 wsum.1.bit.3.in <= hm2_5i25.0.7i64.0.2.input-18

net turret2-num wsum.1.sum => classicladder.0.s32in-03
net carousel.0.current-position => classicladder.0.s32in-04

#Active signal. For the lifting/lowering of the turret
net carousel.0.active => classicladder.0.out-04
net carousel.1.active => classicladder.0.out-05


#Rotating the turrets
net carousel.0.motor-fwd => (Rotate Turret)
net carousel.1.motor-fwd => (Rotate Tailstock)

#Stop when in position
net carousel.0.ready => (Stop Block Turret) 
net carousel.1.ready => (Stop Block Tailstock)

I am unsure how to use the desired pin information. As is I have a comparison code inside the Classic Ladder that does the assignment of which carousel will become activated, but I know that is wrong. There is some way to tell which carousel what tools are inside it.

In Ladder, if the carousel becomes active and the turret starts to rotate, the turret will be raised. I have to raise the turret for half a second longer than it takes to come to position so that when the turret is lowered it is in the desired location. I will also ensure that the Turret Down pin is on after a tool change. If the turret drops too soon it does not lower all the way.

I don't know how to tell Carousel where it is. I know the pin %IW1 and %IW3 will be the turret and tailstock's number and I have that working, but I don't know where the input pin is for the carousel for that data. As well, I don't know how to use num_sense from the Carousel code, but I assume that is what I am missing.

I am unsure if I need to compare the tool requested to the Carousel, or how to tell the Carousel which tools are inside it. Carousel 0 has tools 1-8 and Carousel 1 has tools 21-28.

For rotating the carousel when unidirectional, will carousel.N.motor-fwd rotate the turret, or is it carousel.N.motor?
Last edit: 23 Jan 2019 01:52 by Vitran.

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

More
23 Jan 2019 11:10 - 23 Jan 2019 11:11 #124655 by andypugh

# Tool	1	2	3	4	5	6	7	8
# BitD	0	0	0	0	0	0	0	1
# BitC	0	0	0	1	1	1	1	0
# BitB	0	1	1	0	0	1	1	0
# BitA	1	0	1	0	1	0	1	0


This is simple binary encoding, you should probably tell the carousel component this, ie:
loadrt carousel pockets=8,8
becomes
carousel pockets=8,8 encoding=binary,binary dir=1,1
Simple binary typically needs a strobe bit, does your changer have this?

setp   carousel.0.dir 1
setp   carousel.1.dir 1

These pins don't exist, the dir is set at loadrt time.


I am unsure how to use the desired pin information. As is I have a comparison code inside the Classic Ladder that does the assignment of which carousel will become activated, but I know that is wrong. There is some way to tell which carousel what tools are inside it.

I don't know much about CL.
I don't think that there is a way to tell the system which tool is in which carousel, but by using pocket numbers you can tell the system which carousel each tool is in.
For example, if the tool table is set up so that pocket numbers > 100 indicate the second carousel and with the logic in a G-code subroutine and T and/or M6 remap.:
(#<pocket> is set from the T-word by the stdglue python routines)
O100 IF [#<pocket> GT 100]
    (move carousel 1 to T - 100)
    M68 E1 Q[#<pocket> - 100]
O100 ELSE
    (move carousel 0 to T-number]
    M68 E0 Q#<pocket>
O100 ENDIF

To do the same with CL I think that you would net iocontrol.0.tool-prep-number to a CL input, and then set one of two alternative outputs to the required tool number of the carousel that the pocket number encodes.

You do not need the wsum components, part of the point of the carousel component is to interpret the carousel position encoding.
Last edit: 23 Jan 2019 11:11 by andypugh.

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

More
23 Jan 2019 18:18 - 23 Jan 2019 21:40 #124676 by Vitran
I was up late after posting thinking about this last night. Came in and got it to work in 10 minutes. It works like a charm.

Andy, thanks for update.

What I want to do now is have an index button. A button when in manual mode that I press to go to the next tool. Is there a way to write to the iocontrol.0.tool-prep-number? I am thinking load the current tool from the turret/tailstock into ClassicLadder, add one, write it to iocontrol.0.tool-prep-number and then trigger tool change.

This is my circuit.
- Compare the value of the input to the tools in turret or tailstock. Turn on turret or tailstock
- Turn on and lift the tool (Q9)
- Rotate 1 second after tool is lifted (Q10)
- If tool is desired, engage break (Q11) and keep tool lifted for 1 more second
- If tool is dropped (I20) send out that the machine is done tool change (Q7)
- I22 is MIDI control
- I2 is System Power

EDIT: TON not TOF in the indexing block
Last edit: 23 Jan 2019 21:40 by Vitran.

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

More
25 Jan 2019 00:57 - 25 Jan 2019 01:00 #124779 by Vitran
After a small conversation with andypugh, he suggested I look at MDI_COMMAND

linuxcnc.org/docs/2.7/html/config/ini-co....html#_halui_section
linuxcnc.org/docs/2.7/html/gcode/overview.html#gcode:parameters

I could use a command such as MDI_COMMAND = T[#5400 + 1] in the INI file, however that would have complications. If I was using the tailstock and my tool was #22 and I pressed index the turret, the tailstock would index. Or if I was on tool #8 and pressed the index, it would try to go to tool #9, which does not exist.

I tried to do a ladder code IF/OR/AND statements, but realized it would be a headache for all the edge cases, so as there were only 16 cases, I made the following:

HAL:
#Manual Index Tool

net turret-man-index hm2_5i25.0.7i77.0.0.input-24 => classicladder.0.in-32
net tailstock-man-index hm2_5i25.0.7i77.0.0.input-23 => classicladder.0.in-33

net Tur1-2 classicladder.0.out-24 => halui.mdi-command-00
net Tur2-3 classicladder.0.out-25 => halui.mdi-command-01
net Tur3-4 classicladder.0.out-26 => halui.mdi-command-02
net Tur4-5 classicladder.0.out-27 => halui.mdi-command-03
net Tur5-6 classicladder.0.out-28 => halui.mdi-command-04
net Tur6-7 classicladder.0.out-29 => halui.mdi-command-05
net Tur7-8 classicladder.0.out-30 => halui.mdi-command-06
net Tur8-1 classicladder.0.out-31 => halui.mdi-command-07
net Tail1-2 classicladder.0.out-32 => halui.mdi-command-08
net Tail2-3 classicladder.0.out-33 => halui.mdi-command-09
net Tail3-4 classicladder.0.out-34 => halui.mdi-command-10
net Tail4-5 classicladder.0.out-35 => halui.mdi-command-11
net Tail5-6 classicladder.0.out-36 => halui.mdi-command-12
net Tail6-7 classicladder.0.out-37 => halui.mdi-command-13
net Tail7-8 classicladder.0.out-38 => halui.mdi-command-14
net Tail8-1 classicladder.0.out-39 => halui.mdi-command-15
INI
[HALUI]
MDI_COMMAND = M6 T[2]
MDI_COMMAND = M6 T[3]
MDI_COMMAND = M6 T[4]
MDI_COMMAND = M6 T[5]
MDI_COMMAND = M6 T[6]
MDI_COMMAND = M6 T[7]
MDI_COMMAND = M6 T[8]
MDI_COMMAND = M6 T[1]
MDI_COMMAND = M6 T[22]
MDI_COMMAND = M6 T[23]
MDI_COMMAND = M6 T[24]
MDI_COMMAND = M6 T[25]
MDI_COMMAND = M6 T[26]
MDI_COMMAND = M6 T[27]
MDI_COMMAND = M6 T[28]
MDI_COMMAND = M6 T[21]
LADDER


Is it ugly? YES. It also works fine. I have been trying to break it, but I don't think it has much of an issue other than using up a lot of Ladder out commands.
Last edit: 25 Jan 2019 01:00 by Vitran.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum