Tool_in_spindle probleme with current_pocket

More
05 Feb 2024 19:27 #292552 by greg23_78
I have a small problem with the programming and settings of my M6 remapping.

To start with, at the moment the carousel is working perfectly but my problem comes from the condition

o103 if [#<tool_in_spindle> NE #<current_pocket>]
       (abort, tool changer in wrong position)
o103 endif

I have a little program called mdi_command, which when you press a physical button turns the carousel to tool 16 (No tool change). This mini program works.

on the other hand if I ask for tool number 2, the program does not abort, but executes the tool change. so the tool currently in the spindle is in pocket 16.

First tool change ( tool 3)

carousel.0.pocket-number - 3
carousel.0.current-position - 3
iocontrol.0.tool-number - 3

Mini program

carousel.0.pocket-number - 16
carousel.0.current-position - 16
iocontrol.0.tool-number - 3

second tool change ( Tool 5)

carousel.0.pocket-number - 5
carousel.0.current-position - 5
iocontrol.0.tool-number - 5

but the tool 3 is in the pocket 16

I have the impression that #<tool_in_spindle> is not working properly, how can I remedy this problem?
 
Attachments:

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

More
15 Feb 2024 01:51 #293359 by smc.collins
is it configured for a random tool changer ?

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

More
18 Feb 2024 16:28 #293687 by greg23_78
it's not for a random tool change, i have a carousel with 30 tools. my carousel is surrounded by safety casing except in 1 place, opposite the spindle.
when my button is pressed, the carousel shows tool 1 in front of the slot, so tool 16 in front of the spindle, to avoid having to press jog 15-16 times to be in front of tool number 1.

the mini-program (MDI_command) is as follows:
o<button_home_carousel> sub

; Move carousel section

;o900 IF [#<current_pocket> NE 16]
    M68 E0 Q16 ;set the carousel to move to the right pocket
    M64 P0  ;Enable Carousel
    G4 P2  ; Wait 2 seconds

    M66 P0 L3 Q120 ; wait for carousel-ready = true
        o203 if [#5399 LT 0]
        (abort, carousel not finished)
        o203 endif
    
    M65 P0  ;Disable carousel enable

;o900 ENDIF    

o<button_home_carousel> endsub [1]   

it shows tool number 1 in front of the slot, but if I call tool number 2 in the spindle using M6, it should display an error message.

(abort, tool changer in wrong position)

but as said before, it executes the tool change program, so the current tool in the spindle is inserted into pocket number 16 or the pocket immediately in front of it. Whereas in the M6 remapping I did insert the condition
	o103 if [#<tool_in_spindle> NE #<current_pocket>]
       (abort, tool changer in wrong position)
    o103 endif
Attachments:

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

More
19 Feb 2024 20:01 #293782 by smc.collins
That's precisely how the random tool changer option behaves  the system manages tools and pockets.

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

More
23 Feb 2024 00:37 #294038 by polobear189
Did you change it to random tool changer?

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

More
27 Feb 2024 22:17 #294648 by greg23_78
yes, sorry, I've just tried it out and it works perfectly!

But I have some questions to improve the M6 remap.

I tried to save tool number in var file and load on start like this link below but it doesn't work.

forum.linuxcnc.org/38-general-linuxcnc-q...le-and-load-on-start

during M6 at the end of my macro I inserted #4999=#5400
I get the information back when I restart linuxcnc and press home all because I integrated a mdi command to enable the carousel to do this homing procedure and at the end I insert the M61 Q#4999 command.
o<home_carousel> sub

; Move carousel section

;M68 E0 Q1 ;set the carousel to move to the right pocket
    M64 P0  ;Enable Carousel
    G4 P2  ; Wait 2 seconds

    M66 P0 L3 Q120 ; wait for carousel-ready = true
        o203 if [#5399 LT 0]
        (abort, carousel not finished)
        o203 endif
    
    M65 P0  ;Disable carousel enable

    M61 Q#4999

o<home_carousel> endsub [1]   

When I change tool, my variable is always 0 (the variable must not be implemented) and this causes me a lot of problems because I don't have tool number 0.

So my .var file never shows 4999 and 5400 after closing linuxcnc.

Finally, what variable can I use to make it understand that there was no tool in the spindle when linuxcnc was closed?
 

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

More
30 Mar 2024 15:45 #297216 by greg23_78
i'm reopening the post, after several attempts with the random tool change and having quite a few problems with the positioning of the tools, i've gone back to non-random toolchanger. however, i'm having the same problem as at the beginning of the post.

Is there a way to make this little program work in non-random toolchanger?
o110 if [#<tool_in_spindle> NE #<current_pocket>]

        M68 E0 Q#<tool_in_spindle> ;set the carousel to move to the right pocket

        M64 P0  ;Enable Carousel

        G4 P2  ; Wait 2 seconds

        M66 P0 L3 Q120 ; wait for carousel-ready = true
            o111 if [#5399 LT 0]
                (abort, carousel not finished)
            o111 endif
    
    M65 P0  ;Disable carousel enable
    
    o110 endif

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

More
30 Mar 2024 16:10 #297220 by smc.collins
no idea, I gave up messing with carousel and just wrote a custom hal component to manage my tool changer and My machine is not set in random.

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

Time to create page: 0.119 seconds
Powered by Kunena Forum