setting up schaublin 125 cnc lathe with carousel toolchanger

More
29 Jan 2019 20:22 #125204 by trilobyte
i'm retrofitting a schaublin 125 cnc lathe. i use a 7i76e. most works well.
but i have some problemes with the carousel component.

the toolchanger uses 4 switches. every position has its own switch.
i wired these to the carousel.0.sense-0,1,2,3

if i start a toolchange with T1 M6 then the toolchanger begins to turn. but he will not stopp.
with the hal whatch list i can see the sense signals, but the current position is always 3 exept the sense 3 input is true, then the current position is for a moment 2.

here is video

and the code from the hal:

#
# HAL for Schaublin 125 Turret
#

# Load components
loadrt carousel pockets=4 encoding=single num_sense=4 dir=1
loadrt timedelay count=2
loadrt or2

# Adding function to realtime thread
addf carousel.0 servo-thread
addf timedelay.0 servo-thread
addf timedelay.1 servo-thread
addf or2.0 servo-thread

# Wire up stuff

# Setup time for air supply before toolchange, e.g 1sec
setp timedelay.0.on-delay 1
setp timedelay.0.off-delay 0
net tool_prepare iocontrol.0.tool-prepare => or2.0.in0 timedelay.0.in
net tool_prepared iocontrol.0.tool-prepared <= timedelay.0.out

# Holding time for air supply after tool change, e.g 0.5sec
setp timedelay.0.on-delay 0
setp timedelay.0.off-delay 0.5
net setup1 or2.0.out => timedelay.1.in
net setup2 timedelay.1.out => hm2_7i76e.0.7i76.0.0.output-04

net tool_change iocontrol.0.tool-change => carousel.0.enable
net tool_changed iocontrol.0.tool-changed <= carousel.0.ready
net tool_number iocontrol.0.tool-prep-number => carousel.0.pocket-number
net tc_pos_1 hm2_7i76e.0.7i76.0.0.input-15 => carousel.0.sense-0
net tc_pos_2 hm2_7i76e.0.7i76.0.0.input-14 => carousel.0.sense-1
net tc_pos_3 hm2_7i76e.0.7i76.0.0.input-13 => carousel.0.sense-2
net tc_pos_4 hm2_7i76e.0.7i76.0.0.input-12 => carousel.0.sense-3
net active_out carousel.0.active => or2.0.in1
net rotate_out carousel.0.motor-fwd => hm2_7i76e.0.7i76.0.0.output-05

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

More
29 Jan 2019 20:24 #125205 by trilobyte
is "single" the correct encoding option?

btw: i am using the latest 2.8 linuxcnc...

Peter

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

More
29 Jan 2019 21:43 #125210 by Mike_Eitel
Hi Peter
I have no glue about carousel, but watching your film the pros-switches seams to be always high, but one for short moment...
m5c
Mike

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

More
29 Jan 2019 23:23 - 29 Jan 2019 23:26 #125227 by andypugh

is "single" the correct encoding option?


It looks like it:
github.com/LinuxCNC/linuxcnc/blob/master...s/carousel.comp#L184

If you look at the individual sense pins (halmeter for example) is there only ever one true at a time?

Looking at the video, this is the problem. The switches are active-low.
(I hate how halshow uses red for false and yellow for true!)

You need to connect to the in-not (inverted) inputs of the 7i76.

I am not sure how well-tested "Single" is.
Last edit: 29 Jan 2019 23:26 by andypugh.

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

More
30 Jan 2019 21:50 #125344 by trilobyte
it was the problem with the inverted inputs!

@andy: the toolchanger works well for position 1-2-3, but in position 0 the enable gets true but the motor fwd command not.

is there a bug in the 2.8 version?

a video of the toolchanger in action: video

this is the code from the hal:

#
# HAL for Schaublin 125 Turret
#

# Load components
loadrt carousel pockets=4 encoding=single num_sense=4 dir=1
loadrt timedelay count=2
loadrt logic count=2 personality=0x202,0x204 # 2-Input OR, 4-inputs OR gate


# Adding function to realtime thread
addf carousel.0 servo-thread
addf timedelay.0 servo-thread
addf timedelay.1 servo-thread
addf logic.0 servo-thread
addf logic.1 servo-thread

# Wire up stuff

# Setup time for air supply before toolchange, e.g 1sec
setp timedelay.0.on-delay 1
setp timedelay.0.off-delay 0
net tool_prepare iocontrol.0.tool-prepare => logic.0.in-00 timedelay.0.in
net tool_prepared iocontrol.0.tool-prepared <= timedelay.0.out

# Holding time for air supply after tool change, e.g 0.5sec
setp timedelay.0.on-delay 0
setp timedelay.0.off-delay 0.5
net setup1 logic.0.or => timedelay.1.in
net setup2 timedelay.1.out => hm2_7i76e.0.7i76.0.0.output-05

net tool_change iocontrol.0.tool-change => carousel.0.enable
net tool_changed iocontrol.0.tool-changed <= carousel.0.ready
net tool_number iocontrol.0.tool-prep-number => carousel.0.pocket-number
net tc_pos_1 hm2_7i76e.0.7i76.0.0.input-15-not => carousel.0.sense-0 logic.1.in-00
net tc_pos_2 hm2_7i76e.0.7i76.0.0.input-14-not => carousel.0.sense-1 logic.1.in-01
net tc_pos_3 hm2_7i76e.0.7i76.0.0.input-13-not => carousel.0.sense-2 logic.1.in-02
net tc_pos_4 hm2_7i76e.0.7i76.0.0.input-12-not => carousel.0.sense-3 logic.1.in-03
net tc_pos_valid logic.1.or => carousel.0.strobe
net active_out carousel.0.active => logic.0.in-01
net rotate_out carousel.0.motor-fwd => hm2_7i76e.0.7i76.0.0.output-04


peter

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

More
31 Jan 2019 16:42 - 31 Jan 2019 16:43 #125406 by andypugh
I think that there is a bug in single mode.

Sorry about that.

Everywhere else in the code the assumption is that pocket numbering begins at 1. But the S mode begins at 0.

Luckily carousel is a .comp, so it's something you can fix yourself.
github.com/LinuxCNC/linuxcnc/blob/master...s/carousel.comp#L184
Where it says
p = i;
it needs to say
p = i + 1;
Are you in a position to try that out?
You need to edit carousel.comp then
sudo halcompile --install carousel.comp
Last edit: 31 Jan 2019 16:43 by andypugh.

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

More
31 Jan 2019 21:13 - 31 Jan 2019 21:27 #125434 by inoxix
I think this is not the only problem with the S mode.

1. Senor(0) is never correct evaluated, the loop aborts at i=0 regardless of signal state
case 'S': // individual sensors
        for (i = inst_sense - 1; sense(i) == 0 && i > 0 ; i--) {}
        p = i;
        break;
If no sensor is active p is then always assigned 0 (or 1 as above).

2. current_position is only updated when strobe is set.
if (strobe) {
        current_position = p;
        parity_error = (pcalc != (inst_parity ^ parity_));
    }
The moving state machine keeps just moving the turret. To use strobe doesn't make much sense in S mode. So, current_position is always 0. Of course we could bind all sensor signals with an or together and generate a strobe as workaround.

Regards,
Tom
Last edit: 31 Jan 2019 21:27 by inoxix.

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

More
31 Jan 2019 21:24 #125435 by trilobyte
halcompile does not work on my computer:

trilobyte@trilobyte:~$ ls
Bilder Dokumente linuxcnc Öffentlich Videos
carousel.comp Downloads Musik Schreibtisch Vorlagen
trilobyte@trilobyte:~$ sudo halcompile --install carousel.comp
[sudo] Passwort für trilobyte:
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1431, in <module>
main()
File "/usr/bin/halcompile", line 1401, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1267, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 424, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
trilobyte@trilobyte:~$

its a installation from this image:
www.linuxcnc.org/testing-stretch-rtpreempt/
i addet these stanzas:
deb buildbot.linuxcnc.org/ stretch master-rtpreempt
deb-src buildbot.linuxcnc.org/ stretch master-rtpreempt
to my sources.list.d

i updated the system with apt-get update, apt-get dist-upgrade

peter

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

More
01 Feb 2019 14:06 #125467 by andypugh

I think this is not the only problem with the S mode.
1. Senor(0) is never correct evaluated, the loop aborts at i=0 regardless of signal state


Good point. Something like this is probably required
case 'S': // individual sensors
        for (i = inst_sense - 1; sense(i) == 0 && i > 0 ; i--) {}
        if (sense(i)) p = i + 1;
        break;

Of course we could bind all sensor signals with an or together and generate a strobe as workaround.

That would be one approach but doesn't solve the off-by-one. (Note that strobe is set TRUE by default, it can only be FALSE if it is actually connected in HAL)

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

More
01 Feb 2019 14:10 #125468 by andypugh

halcompile does not work on my computer:
...
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpackr


This indicates that your carousel.comp file has been passed through a Windows (or Classic Mac) system and the end-of-line characters are no longer a simple \n (linefeed)
The line above is looking for the ";;" delimiter in a .comp file that separates the setup instructions from the actual C code.

And halcompile really ought to deal better with this situation.

If you can correct the end-of-line characters then it ought to work.

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

Time to create page: 0.097 seconds
Powered by Kunena Forum